You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ra...@apache.org on 2014/11/10 10:36:48 UTC

[10/25] git commit: updated refs/heads/master to 55b6e34

there is no transaction context during the mgt server start, thus causing transaction.close will delete op_lock table if aquireinlocktable is called Reviewed-by: Anthony and Min


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

Branch: refs/heads/master
Commit: ffdb38c496bffbf16701c401a2632cf4f08d4636
Parents: 77b71e1
Author: Edison Su <su...@gmail.com>
Authored: Thu Oct 30 02:19:02 2014 -0700
Committer: Edison Su <su...@gmail.com>
Committed: Thu Nov 6 15:30:19 2014 -0800

----------------------------------------------------------------------
 .../src/com/cloud/storage/snapshot/SnapshotSchedulerImpl.java   | 5 +++++
 1 file changed, 5 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ffdb38c4/server/src/com/cloud/storage/snapshot/SnapshotSchedulerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/storage/snapshot/SnapshotSchedulerImpl.java b/server/src/com/cloud/storage/snapshot/SnapshotSchedulerImpl.java
index 599e906..2fedeef 100644
--- a/server/src/com/cloud/storage/snapshot/SnapshotSchedulerImpl.java
+++ b/server/src/com/cloud/storage/snapshot/SnapshotSchedulerImpl.java
@@ -64,6 +64,7 @@ import com.cloud.utils.concurrency.TestClock;
 import com.cloud.utils.db.DB;
 import com.cloud.utils.db.GlobalLock;
 import com.cloud.utils.db.SearchCriteria;
+import com.cloud.utils.db.TransactionLegacy;
 
 @Component
 @Local(value = {SnapshotScheduler.class})
@@ -333,6 +334,8 @@ public class SnapshotSchedulerImpl extends ManagerBase implements SnapshotSchedu
             spstSchedVO = new SnapshotScheduleVO(policy.getVolumeId(), policyId, nextSnapshotTimestamp);
             _snapshotScheduleDao.persist(spstSchedVO);
         } else {
+            TransactionLegacy txn = TransactionLegacy.open(TransactionLegacy.CLOUD_DB);
+
             try {
                 spstSchedVO = _snapshotScheduleDao.acquireInLockTable(spstSchedVO.getId());
                 spstSchedVO.setPolicyId(policyId);
@@ -340,10 +343,12 @@ public class SnapshotSchedulerImpl extends ManagerBase implements SnapshotSchedu
                 spstSchedVO.setAsyncJobId(null);
                 spstSchedVO.setSnapshotId(null);
                 _snapshotScheduleDao.update(spstSchedVO.getId(), spstSchedVO);
+                txn.commit();
             } finally {
                 if (spstSchedVO != null) {
                     _snapshotScheduleDao.releaseFromLockTable(spstSchedVO.getId());
                 }
+                txn.close();
             }
         }
         return nextSnapshotTimestamp;