abh1sar commented on code in PR #14310:
URL: https://github.com/apache/cloudstack/pull/14310#discussion_r4193052895


##########
server/src/main/java/org/apache/cloudstack/backup/BackupManagerImpl.java:
##########
@@ -2055,12 +2064,20 @@ private void updateBackupUsageRecords(final 
BackupProvider backupProvider, DataC
                     Pair<Long, Long> sizes = entry.getValue();
                     Long backupSize = sizes.first();
                     Long protectedSize = sizes.second();
+                    Pair<Long, Long> key = new Pair<>(vm.getId(), offeringId);
+                    Pair<Long, Long> metric = new Pair<>(backupSize, 
protectedSize);
+                    published.put(key, metric);
+                    if (metric.equals(lastPublished.get(key))) {

Review Comment:
   Added a new BackupUsageMetrics table in DB to track the last updated value.
   Also added a lock so that two management servers don't race while syncing 
the backup metrics.
   Please take a look @Damans227 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to