Repository: cloudstack Updated Branches: refs/heads/master 8d3a9b760 -> b6d8ceda3
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/b6d8ceda Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/b6d8ceda Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/b6d8ceda Branch: refs/heads/master Commit: b6d8ceda3d4e05f144ca89598ba667f7a85fcf7d Parents: 8d3a9b7 Author: Edison Su <[email protected]> Authored: Thu Oct 30 02:19:02 2014 -0700 Committer: Edison Su <[email protected]> Committed: Thu Oct 30 02:21:29 2014 -0700 ---------------------------------------------------------------------- .../src/com/cloud/storage/snapshot/SnapshotSchedulerImpl.java | 5 +++++ 1 file changed, 5 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b6d8ceda/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;
