tanvipenumudy commented on code in PR #8591:
URL: https://github.com/apache/ozone/pull/8591#discussion_r2209522727


##########
hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/api/OMDBInsightEndpoint.java:
##########
@@ -627,6 +627,29 @@ private void getPendingForDeletionDirInfo(
     }
   }
 
+  private void calculateTotalPendingDeletedDirSizes(Map<String, Long> 
dirSummary) {
+    long totalUnreplicatedSize = 0L;
+    long totalReplicatedSize = 0L;
+
+    Table<String, OmKeyInfo> deletedDirTable = 
omMetadataManager.getDeletedDirTable();
+    try (TableIterator<String, ? extends Table.KeyValue<String, OmKeyInfo>> 
iterator = deletedDirTable.iterator()) {
+      while (iterator.hasNext()) {
+        Table.KeyValue<String, OmKeyInfo> kv = iterator.next();
+        OmKeyInfo omKeyInfo = kv.getValue();
+        if (omKeyInfo != null) {

Review Comment:
   Thank you @ArafatKhan2198 for the review, yes for the FSO deleted directory 
space calculation - it is indeed possible that both the parent and child 
directory entries might coexist within the `deletedDirectoryTable`, but this 
wouldn't result in double counting of the child directory's size because of how 
Recon processes delete events today, let's consider the below two scenarios for 
example:
   
   **Case 1:** `/dir1/dir2`, if `dir1` (parent) is deleted first -> then 
`/dir1` and `/dir1/dir2` wouldn't coexist in the `deletedDirectoryTable` at any 
given point in time (the directories would land in the `deletedDirectoryTable` 
in order from top to bottom) -> this shouldn't cause any impact.
   
   **Case 2:** `/dir1/dir2`, if `/dir1/dir2` is deleted first following which 
`/dir1` is deleted, then both `/dir1/dir2` and `/dir1` can coexist in the 
`deletedDirectoryTable`.
   - This wouldn't double-calculate the size of `/dir1/dir2` when both 
`/dir1/dir2` and `/dir1` are in the `deletedDirectoryTable` because Recon 
detaches the `/dir1/dir2` (child directory) from its parent (`/dir1`) in the 
NSSummaryTree as and when it sees this delete directory event.
   - Our approach would iterate over Recon's `deletedDirectoryTable` entries 
and recursively calculate the sizes of the entry's sub-directories:
   
       - We would first encounter `/dir1/dir2` in the `deletedDirectoryTable`, 
recursively calculate the sizes of directories under it.
       - We would then encounter `/dir1` in the `deletedDirectoryTable`, but 
since the child tree is detached -> we would only be recursively calculating 
the sizes of its existing sub-directories.



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