From 1e0eb141ca15667955a1c8c4047ea6b604470913 Mon Sep 17 00:00:00 2001 From: "shan.wu" Date: Mon, 29 Jul 2024 11:33:00 +0800 Subject: [PATCH] [snapshot]: fixed the issue where too many snapshots caused the qmp 'query block' command to fail when the maximum value of incremental snapshot exceeds 64, change it to 64. Resolves/Related: ZSTAC-67846 Resolves/Related: ZSV-9177 Change-Id: I717a65746462647666626263717674796f627973 --- conf/db/upgrade/V4.10.20__schema.sql | 3 +++ conf/globalConfig/snapshot.xml | 2 +- .../zstack/storage/snapshot/VolumeSnapshotGlobalConfig.java | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/conf/db/upgrade/V4.10.20__schema.sql b/conf/db/upgrade/V4.10.20__schema.sql index 6159313b0c7..8ec59cd0edf 100644 --- a/conf/db/upgrade/V4.10.20__schema.sql +++ b/conf/db/upgrade/V4.10.20__schema.sql @@ -26,9 +26,12 @@ WHERE t.current = true AND v.rootImageUuid IS NOT NULL AND t.rootImageUuid IS NULL; + DELETE ref FROM `zstack`.`VolumeSnapshotReferenceVO` ref INNER JOIN `zstack`.`VolumeEO` vol ON vol.uuid = ref.referenceVolumeUuid WHERE ref.referenceType = 'VolumeVO' AND ref.referenceVolumeUuid = ref.referenceUuid AND ref.referenceInstallUrl NOT LIKE CONCAT('%', SUBSTRING_INDEX(vol.installPath, '/', -1), '%'); +UPDATE `zstack`.`GlobalConfigVO` SET value="64", defaultValue="64" WHERE category="volumeSnapshot" AND name="incrementalSnapshot.maxNum" AND value > 120; + diff --git a/conf/globalConfig/snapshot.xml b/conf/globalConfig/snapshot.xml index 7e0be2676ef..fcfc393178c 100755 --- a/conf/globalConfig/snapshot.xml +++ b/conf/globalConfig/snapshot.xml @@ -4,7 +4,7 @@ volumeSnapshot incrementalSnapshot.maxNum The length of a volume snapshot chain. When the lenght of a volume snapshot chain reaches this value, the next volume snapshot will be a full snapshot - 128 + 64 java.lang.Integer diff --git a/storage/src/main/java/org/zstack/storage/snapshot/VolumeSnapshotGlobalConfig.java b/storage/src/main/java/org/zstack/storage/snapshot/VolumeSnapshotGlobalConfig.java index 079481d6eea..9948dbdf738 100755 --- a/storage/src/main/java/org/zstack/storage/snapshot/VolumeSnapshotGlobalConfig.java +++ b/storage/src/main/java/org/zstack/storage/snapshot/VolumeSnapshotGlobalConfig.java @@ -11,7 +11,7 @@ public class VolumeSnapshotGlobalConfig { public static final String CATEGORY = "volumeSnapshot"; - @GlobalConfigValidation(numberGreaterThan = 0) + @GlobalConfigValidation(numberGreaterThan = 0, numberLessThan = 120) public static GlobalConfig MAX_INCREMENTAL_SNAPSHOT_NUM = new GlobalConfig(CATEGORY, "incrementalSnapshot.maxNum"); @GlobalConfigValidation(numberGreaterThan = 0) public static GlobalConfig SNAPSHOT_DELETE_PARALLELISM_DEGREE = new GlobalConfig(CATEGORY, "delete.parallelismDegree");