This is an automated email from the ASF dual-hosted git repository.
winterhazel pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cloudstack.git
The following commit(s) were added to refs/heads/main by this push:
new cd801b85615 usage: widen usage_volume unique key to include vm_id
(#13909)
cd801b85615 is described below
commit cd801b8561580f5a867b5900b16597451abab133
Author: DT <[email protected]>
AuthorDate: Wed Aug 19 20:40:39 2026 +0100
usage: widen usage_volume unique key to include vm_id (#13909)
---
engine/schema/src/main/resources/META-INF/db/schema-42210to42300.sql | 5 +++++
1 file changed, 5 insertions(+)
diff --git
a/engine/schema/src/main/resources/META-INF/db/schema-42210to42300.sql
b/engine/schema/src/main/resources/META-INF/db/schema-42210to42300.sql
index ab5ac7b2b87..417d69a162e 100644
--- a/engine/schema/src/main/resources/META-INF/db/schema-42210to42300.sql
+++ b/engine/schema/src/main/resources/META-INF/db/schema-42210to42300.sql
@@ -646,3 +646,8 @@ CALL
`cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.backup_schedule', 'isolated', 'TINYI
UPDATE `cloud`.`configuration` SET `value`=CONCAT(`value`, ',
backupValidationCommandTimeout, backupValidationScreenshotWait,
backupValidationBootTimeout')
WHERE `name`='user.vm.readonly.details' AND `value` IS NOT NULL;
+
+-- Widen the unique key on cloud_usage.usage_volume to include vm_id, so the
two volume
+-- usage records introduced in 4.22.1 (cumulative and per-VM) can coexist. See
#13399.
+CALL `cloud_usage`.`IDEMPOTENT_DROP_INDEX`('id', 'cloud_usage.usage_volume');
+CALL `cloud_usage`.`IDEMPOTENT_ADD_UNIQUE_INDEX`('cloud_usage.usage_volume',
'id', '(volume_id ASC, created ASC, vm_id ASC)');