Change in ovirt-engine[master]: engine: Introducing using of Infinispan cache at TimeoutBase

mkublin at redhat.com mkublin at redhat.com
Tue Apr 23 07:29:10 UTC 2013


Michael Kublin has submitted this change and it was merged.

Change subject: engine: Introducing using of Infinispan cache at TimeoutBase
......................................................................


engine: Introducing using of Infinispan cache at TimeoutBase

The TimeoutBase was used for the following purpose:
1. The audit event which has expiration time was put to it internal cache
2. If the same event was tried to put again and it is expired, it was written to DB

Sound simple but a following implementation contains:
1. Memory leak - if we never tried to put event when it was already expired, internal cache
   never will be cleared
2. Restart - restart in the middle , event will be never send to DB

Solution:
I decided to use infinispan cache, from now if event has expiration time and it not contains in cache
it will be written to DB.
If event is contains in cache it will be skipped.
The cache has putIfAbsent() API which is similar to ConcurrentHashMap API, the entries are added to cache
with lifespan and will be cleared automatically by cache.

Change-Id: I2fbebb10c08c87d2c7fd4d7443d3e3b374541ed7
Signed-off-by: Michael Kublin <mkublin at redhat.com>
---
M backend/manager/conf/standalone.xml
M backend/manager/modules/dal/pom.xml
M backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dal/dbbroker/auditloghandling/AuditLogDirector.java
M backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dal/dbbroker/auditloghandling/TimeoutBase.java
M backend/manager/modules/dal/src/main/modules/org/ovirt/engine/core/dal/main/module.xml
M backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dal/dbbroker/auditloghandling/TimeoutBaseTest.java
M backend/manager/modules/utils/pom.xml
A backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/cache/CacheManager.java
M backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/ejb/BeanType.java
M backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/ejb/EngineEJBUtilsStrategy.java
M backend/manager/modules/utils/src/main/modules/org/ovirt/engine/core/utils/main/module.xml
M ear/pom.xml
M ear/src/main/resources/META-INF/MANIFEST.MF
M packaging/fedora/engine-service.xml.in
M pom.xml
15 files changed, 127 insertions(+), 136 deletions(-)

Approvals:
  Michael Kublin: Verified; Looks good to me, approved


--
To view, visit http://gerrit.ovirt.org/14117
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I2fbebb10c08c87d2c7fd4d7443d3e3b374541ed7
Gerrit-PatchSet: 3
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Michael Kublin <mkublin at redhat.com>
Gerrit-Reviewer: Barak Azulay <bazulay at redhat.com>
Gerrit-Reviewer: Eli Mesika <elimesika at gmail.com>
Gerrit-Reviewer: Juan Hernandez <juan.hernandez at redhat.com>
Gerrit-Reviewer: Michael Kublin <mkublin at redhat.com>
Gerrit-Reviewer: Ravi Nori <rnori at redhat.com>
Gerrit-Reviewer: Yair Zaslavsky <yzaslavs at redhat.com>



More information about the Engine-commits mailing list