cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From h...@apache.org
Subject git commit: updated refs/heads/master to 3f58368
Date Thu, 03 Oct 2013 10:40:43 GMT
Updated Branches:
  refs/heads/master a3babdd61 -> 3f583684c


Temporary fix for the chicken and egg problem when making changes to the configuration database.


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/3f583684
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/3f583684
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/3f583684

Branch: refs/heads/master
Commit: 3f583684c6ddcf7efb66adada63957f8ca06cfdc
Parents: a3babdd
Author: Hugo Trippaers <htrippaers@schubergphilis.com>
Authored: Thu Oct 3 12:33:10 2013 +0200
Committer: Hugo Trippaers <htrippaers@schubergphilis.com>
Committed: Thu Oct 3 12:36:34 2013 +0200

----------------------------------------------------------------------
 .../cache/manager/StorageCacheReplacementAlgorithmLRU.java   | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3f583684/engine/storage/cache/src/org/apache/cloudstack/storage/cache/manager/StorageCacheReplacementAlgorithmLRU.java
----------------------------------------------------------------------
diff --git a/engine/storage/cache/src/org/apache/cloudstack/storage/cache/manager/StorageCacheReplacementAlgorithmLRU.java
b/engine/storage/cache/src/org/apache/cloudstack/storage/cache/manager/StorageCacheReplacementAlgorithmLRU.java
index fc96a0d..ed1fc1a 100644
--- a/engine/storage/cache/src/org/apache/cloudstack/storage/cache/manager/StorageCacheReplacementAlgorithmLRU.java
+++ b/engine/storage/cache/src/org/apache/cloudstack/storage/cache/manager/StorageCacheReplacementAlgorithmLRU.java
@@ -60,7 +60,10 @@ public class StorageCacheReplacementAlgorithmLRU implements StorageCacheReplacem
 
     @PostConstruct
     public void initialize() {
-        unusedTimeInterval = NumbersUtil.parseInt(configDao.getValue(Config.StorageCacheReplacementLRUTimeInterval.key()),
30);
+        /* Avoid using configDao at this time, we can't be sure that the database is already
upgraded 
+         * and there might be fatal errors when using a dao.
+         */
+        //unusedTimeInterval = NumbersUtil.parseInt(configDao.getValue(Config.StorageCacheReplacementLRUTimeInterval.key()),
30);
     }
 
     public void setUnusedTimeInterval(Integer interval) {
@@ -69,6 +72,9 @@ public class StorageCacheReplacementAlgorithmLRU implements StorageCacheReplacem
 
     @Override
     public DataObject chooseOneToBeReplaced(DataStore store) {
+        if (unusedTimeInterval == null) {
+            unusedTimeInterval = NumbersUtil.parseInt(configDao.getValue(Config.StorageCacheReplacementLRUTimeInterval.key()),
30);
+        }
         Calendar cal = Calendar.getInstance();
         cal.setTime(DateUtil.now());
         cal.add(Calendar.DAY_OF_MONTH, -unusedTimeInterval.intValue());


Mime
View raw message