Doron Fediuck has posted comments on this change.

Change subject: core: Fast init cache
......................................................................


Patch Set 6: (6 inline comments)

....................................................
File 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/Backend.java
Line 228:                 vmPoolMonitorIntervalInMinutes, TimeUnit.MINUTES);
Line 229: 
Line 230:         int quotaCacheIntervalInMinutes = Config.<Integer> 
GetValue(ConfigValues.QuotaCacheIntervalInMinutes);
Line 231:         
SchedulerUtilQuartzImpl.getInstance().scheduleAFixedDelayJob(QuotaManager.getInstance(),
Line 232:                 "initializeCache",  new Class[] {}, new Object[] {},
quotaCache
Line 233:                 1, quotaCacheIntervalInMinutes, TimeUnit.MINUTES);
Line 234: 
Line 235:         try {
Line 236:             File fLock = new File(Config.<String> 
GetValue(ConfigValues.SignLockFile));


....................................................
File 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/quota/QuotaManager.java
Line 986: 
Line 987:     /**
Line 988:      * InitializeCache is called by SchedulerUtilQuartzImpl.
Line 989:      */
Line 990:     @OnTimerMethodAnnotation("initializeCache")
See if you can rename it to update or refresh, as initialize happens only once.

Since in runtime you have a cache, you can either refresh, update or 
re-initialize he existing cache.
Line 991:     public void initializeCache() {
Line 992:         if (!isNeedToInitializeCache()) {
Line 993:             return;
Line 994:         }


Line 992:         if (!isNeedToInitializeCache()) {
Line 993:             return;
Line 994:         }
Line 995: 
Line 996:         log.info("Updating Quota Cache...");
Please move the above log entry to debug level. In normal mode it's enough to 
say cache updated (and it took xxx second).
Line 997:         long timeStart = System.currentTimeMillis();
Line 998:         List<Quota> allQuotaIncludingConsumption = 
getQuotaDAO().getAllQuotaIncludingConsumption();
Line 999: 
Line 1000:         if (allQuotaIncludingConsumption.isEmpty()) {


Line 1015:         long timeEnd = System.currentTimeMillis();
Line 1016:         log.infoFormat("Quota Cache updated. ({0} msec)", 
timeEnd-timeStart);
Line 1017:     }
Line 1018: 
Line 1019:     public boolean isNeedToInitializeCache() {
This should probably be renamed as well.

How about isCacheUpdateNeeded() or isCacheReInitNeeded() ?
Line 1020:         int quotaCount = getQuotaDAO().getQuotaCount();
Line 1021:         int cacheCount = 0;
Line 1022: 
Line 1023:         lock.readLock().lock();


....................................................
Commit Message
Line 5: CommitDate: 2012-12-23 11:41:17 +0200
Line 6: 
Line 7: core: Fast init cache
Line 8: 
Line 9: Add DB and backend support for fast cache initialize in QuotaManager
Please add some more contents here.
Line 10: 
Line 11: Change-Id: Id3db08957e413d2f1e0480b764334dd7268c8221
Line 12: Bug-Url: https://bugzilla.redhat.com/??????


Line 8: 
Line 9: Add DB and backend support for fast cache initialize in QuotaManager
Line 10: 
Line 11: Change-Id: Id3db08957e413d2f1e0480b764334dd7268c8221
Line 12: Bug-Url: https://bugzilla.redhat.com/??????
Please update or drop the above bz link.


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

Gerrit-MessageType: comment
Gerrit-Change-Id: Id3db08957e413d2f1e0480b764334dd7268c8221
Gerrit-PatchSet: 6
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: ofri masad <oma...@redhat.com>
Gerrit-Reviewer: Doron Fediuck <dfedi...@redhat.com>
Gerrit-Reviewer: Eli Mesika <emes...@redhat.com>
Gerrit-Reviewer: Gilad Chaplik <gchap...@redhat.com>
Gerrit-Reviewer: Michael Kublin <mkub...@redhat.com>
Gerrit-Reviewer: Yair Zaslavsky <yzasl...@redhat.com>
Gerrit-Reviewer: ofri masad <oma...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to