Skip to content

Commit 38bc20e

Browse files
minchen07yadvr
authored andcommitted
CLOUDSTACK-6236:Negative ref_cnt of template(snapshot/volume)_store_ref results in out-of-range error in Mysql
(cherry picked from commit cd8af6a) Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com> Conflicts: engine/schema/src/org/apache/cloudstack/storage/datastore/db/TemplateDataStoreVO.java
1 parent e9d079a commit 38bc20e

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

‎engine/schema/src/org/apache/cloudstack/storage/datastore/db/VolumeDataStoreVO.java‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,12 @@ public Long getRefCnt() {
350350
}
351351

352352
public void setRefCnt(Long refCnt) {
353-
this.refCnt = refCnt;
353+
if (refCnt > 0) {
354+
refCnt--;
355+
}
356+
else {
357+
s_logger.warn("We should not try to decrement a zero reference count even though our code has guarded");
358+
}
354359
}
355360

356361
public void incrRefCnt() {

0 commit comments

Comments
 (0)