aswinshakil commented on code in PR #5301:
URL: https://github.com/apache/ozone/pull/5301#discussion_r1343033026


##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/service/KeyDeletingService.java:
##########
@@ -338,24 +398,137 @@ private void processSnapshotDeepClean(int delCount)
               if (delCount < keyLimitPerTask) {
                 // Deep clean is completed, we can update the SnapInfo.
                 deepCleanedSnapshots.add(currSnapInfo.getTableKey());
+                // exclusiveSizeList contains check is used to prevent
+                // case where there is no entry in deletedTable, this
+                // will throw NPE when we submit request.
+                if (previousSnapshot != null && exclusiveSizeMap
+                    .containsKey(previousSnapshot.getTableKey())) {
+                  completedExclusiveSizeSet.add(
+                      previousSnapshot.getTableKey());
+                }
               }
 
               if (!keysToPurge.isEmpty()) {
                 processKeyDeletes(keysToPurge, currOmSnapshot.getKeyManager(),
                     keysToModify, currSnapInfo.getTableKey());
               }
             } finally {
-              if (previousSnapshot != null) {
-                rcPrevOmSnapshot.close();
-              }
+              IOUtils.closeQuietly(rcPrevOmSnapshot, rcPrevToPrevOmSnapshot);
             }
           }
 
         }
       }
+
+      updateSnapshotExclusiveSize();
       updateDeepCleanedSnapshots(deepCleanedSnapshots);
     }
 
+    @SuppressWarnings("checkstyle:ParameterNumber")
+    private void calculateExclusiveSize(
+        SnapshotInfo previousSnapshot,
+        SnapshotInfo previousToPrevSnapshot,
+        OmKeyInfo keyInfo,
+        OmBucketInfo bucketInfo, long volumeId,
+        Table<String, String> snapRenamedTable,
+        Table<String, OmKeyInfo> previousKeyTable,
+        Table<String, String> prevRenamedTable,
+        Table<String, OmKeyInfo> previousToPrevKeyTable) throws IOException {
+      String prevSnapKey = previousSnapshot.getTableKey();
+      long exclusiveReplicatedSize =
+          exclusiveReplicatedSizeMap.getOrDefault(
+              prevSnapKey, 0L) + keyInfo.getReplicatedSize();
+      long exclusiveSize = exclusiveSizeMap.getOrDefault(
+          prevSnapKey, 0L) + keyInfo.getDataSize();

Review Comment:
   It is the current exclusive size. The default is only used to avoid `null` 
check for a key here. When a new key is added it is not in the map yet. So it's 
default is 0, only the first `getOrDefault` will give you a 0. Subsequent 
`getOrDefault` will only give the current exclusive size as we already have a 
mapping for it. 
   
   When snapshot is deleted, we need to recalculate the exclusive size for the 
next snapshot. So we again start with 0



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to