cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mc...@apache.org
Subject [44/50] [abbrv] git commit: updated refs/heads/rbac to 99bdc8d
Date Thu, 13 Mar 2014 18:06:31 GMT
CLOUDSTACK-6236:Negative ref_cnt of template(snapshot/volume)_store_ref results in out-of-range
error in Mysql


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

Branch: refs/heads/rbac
Commit: cd8af6a3e2a180ea4d2cfea8a273dbb0929e0a87
Parents: 40192cd
Author: Min Chen <min.chen@citrix.com>
Authored: Wed Mar 12 15:44:18 2014 -0700
Committer: Min Chen <min.chen@citrix.com>
Committed: Wed Mar 12 16:17:53 2014 -0700

----------------------------------------------------------------------
 .../storage/datastore/db/SnapshotDataStoreVO.java        | 11 ++++++++++-
 .../storage/datastore/db/TemplateDataStoreVO.java        | 11 ++++++++++-
 .../storage/datastore/db/VolumeDataStoreVO.java          | 11 ++++++++++-
 3 files changed, 30 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cd8af6a3/engine/schema/src/org/apache/cloudstack/storage/datastore/db/SnapshotDataStoreVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/org/apache/cloudstack/storage/datastore/db/SnapshotDataStoreVO.java
b/engine/schema/src/org/apache/cloudstack/storage/datastore/db/SnapshotDataStoreVO.java
index 8b68d6c..75b1d75 100644
--- a/engine/schema/src/org/apache/cloudstack/storage/datastore/db/SnapshotDataStoreVO.java
+++ b/engine/schema/src/org/apache/cloudstack/storage/datastore/db/SnapshotDataStoreVO.java
@@ -29,6 +29,8 @@ import javax.persistence.Table;
 import javax.persistence.Temporal;
 import javax.persistence.TemporalType;
 
+import org.apache.log4j.Logger;
+
 import org.apache.cloudstack.engine.subsystem.api.storage.DataObjectInStore;
 import org.apache.cloudstack.engine.subsystem.api.storage.ObjectInDataStoreStateMachine;
 import org.apache.cloudstack.engine.subsystem.api.storage.ObjectInDataStoreStateMachine.State;
@@ -44,6 +46,8 @@ import com.cloud.utils.fsm.StateObject;
 @Entity
 @Table(name = "snapshot_store_ref")
 public class SnapshotDataStoreVO implements StateObject<ObjectInDataStoreStateMachine.State>,
DataObjectInStore {
+    private static final Logger s_logger = Logger.getLogger(SnapshotDataStoreVO.class);
+
     @Id
     @GeneratedValue(strategy = GenerationType.IDENTITY)
     Long id;
@@ -272,7 +276,12 @@ public class SnapshotDataStoreVO implements StateObject<ObjectInDataStoreStateMa
     }
 
     public void decrRefCnt() {
-        refCnt--;
+        if (refCnt > 0) {
+            refCnt--;
+        }
+        else {
+            s_logger.warn("We should not try to decrement a zero reference count even though
our code has guarded");
+        }
     }
 
     public Long getVolumeId() {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cd8af6a3/engine/schema/src/org/apache/cloudstack/storage/datastore/db/TemplateDataStoreVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/org/apache/cloudstack/storage/datastore/db/TemplateDataStoreVO.java
b/engine/schema/src/org/apache/cloudstack/storage/datastore/db/TemplateDataStoreVO.java
index 897fee0..bb40bf5 100755
--- a/engine/schema/src/org/apache/cloudstack/storage/datastore/db/TemplateDataStoreVO.java
+++ b/engine/schema/src/org/apache/cloudstack/storage/datastore/db/TemplateDataStoreVO.java
@@ -29,6 +29,8 @@ import javax.persistence.Table;
 import javax.persistence.Temporal;
 import javax.persistence.TemporalType;
 
+import org.apache.log4j.Logger;
+
 import org.apache.cloudstack.engine.subsystem.api.storage.DataObjectInStore;
 import org.apache.cloudstack.engine.subsystem.api.storage.ObjectInDataStoreStateMachine;
 import org.apache.cloudstack.engine.subsystem.api.storage.ObjectInDataStoreStateMachine.State;
@@ -45,6 +47,8 @@ import com.cloud.utils.fsm.StateObject;
 @Entity
 @Table(name = "template_store_ref")
 public class TemplateDataStoreVO implements StateObject<ObjectInDataStoreStateMachine.State>,
DataObjectInStore {
+    private static final Logger s_logger = Logger.getLogger(TemplateDataStoreVO.class);
+
     @Id
     @GeneratedValue(strategy = GenerationType.IDENTITY)
     Long id;
@@ -367,7 +371,12 @@ public class TemplateDataStoreVO implements StateObject<ObjectInDataStoreStateMa
     }
 
     public void decrRefCnt() {
-        refCnt--;
+        if (refCnt > 0) {
+            refCnt--;
+        }
+        else{
+            s_logger.warn("We should not try to decrement a zero reference count even though
our code has guarded");
+        }
     }
 
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cd8af6a3/engine/schema/src/org/apache/cloudstack/storage/datastore/db/VolumeDataStoreVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/org/apache/cloudstack/storage/datastore/db/VolumeDataStoreVO.java
b/engine/schema/src/org/apache/cloudstack/storage/datastore/db/VolumeDataStoreVO.java
index fe6aca4..588eae8 100755
--- a/engine/schema/src/org/apache/cloudstack/storage/datastore/db/VolumeDataStoreVO.java
+++ b/engine/schema/src/org/apache/cloudstack/storage/datastore/db/VolumeDataStoreVO.java
@@ -29,6 +29,8 @@ import javax.persistence.Table;
 import javax.persistence.Temporal;
 import javax.persistence.TemporalType;
 
+import org.apache.log4j.Logger;
+
 import org.apache.cloudstack.engine.subsystem.api.storage.DataObjectInStore;
 import org.apache.cloudstack.engine.subsystem.api.storage.ObjectInDataStoreStateMachine;
 import org.apache.cloudstack.engine.subsystem.api.storage.ObjectInDataStoreStateMachine.State;
@@ -44,6 +46,8 @@ import com.cloud.utils.fsm.StateObject;
 @Entity
 @Table(name = "volume_store_ref")
 public class VolumeDataStoreVO implements StateObject<ObjectInDataStoreStateMachine.State>,
DataObjectInStore {
+    private static final Logger s_logger = Logger.getLogger(VolumeDataStoreVO.class);
+
     @Id
     @GeneratedValue(strategy = GenerationType.IDENTITY)
     Long id;
@@ -342,7 +346,12 @@ public class VolumeDataStoreVO implements StateObject<ObjectInDataStoreStateMach
     }
 
     public void setRefCnt(Long refCnt) {
-        this.refCnt = refCnt;
+        if (refCnt > 0) {
+            refCnt--;
+        }
+        else {
+            s_logger.warn("We should not try to decrement a zero reference count even though
our code has guarded");
+        }
     }
 
     public void incrRefCnt() {


Mime
View raw message