Skip to content

Commit 74017f5

Browse files
Recalculate the allocated size in bytes for each Object Storage provider
1 parent b56bbc2 commit 74017f5

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

‎engine/schema/src/main/resources/META-INF/db/schema-42210to42220.sql‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,3 +72,13 @@ JOIN cloud.vm_template vt ON vt.cross_zones = 1 AND vt.removed IS NULL
7272
WHERE dc.type = 'Edge' AND dc.removed IS NULL
7373
AND NOT EXISTS (SELECT 1 FROM cloud.template_zone_ref tzr
7474
WHERE tzr.zone_id = dc.id AND tzr.template_id = vt.id AND tzr.removed IS NULL);
75+
76+
--- Recalculate the allocated size in bytes for each Object Storage provider
77+
UPDATE `cloud`.`object_store`
78+
JOIN (
79+
SELECT object_store_id, SUM(quota) * 1024 * 1024 * 1024 AS total_quota
80+
FROM `cloud`.`bucket`
81+
WHERE removed IS NULL
82+
GROUP BY object_store_id
83+
) buckets_quota_sum_view ON `object_store`.id = buckets_quota_sum_view.object_store_id
84+
SET `object_store`.allocated_size = buckets_quota_sum_view.total_quota;

0 commit comments

Comments
 (0)