tanvipenumudy commented on code in PR #8591:
URL: https://github.com/apache/ozone/pull/8591#discussion_r2209554154
##########
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:
Taking another example for better clarity, consider the following directory
structure:
```
- dir1/
- file1 (1 GB)
- dir4/
- file2 (1 GB)
- file6 (1 GB)
- dir2/
- file3 (1 GB)
- dir3/
- file4 (1 GB)
- file5 (1 GB)
```
Suppose `/dir1/dir2/dir3` is deleted first, followed by the deletion of
`/dir1`:
- First, the link between `/dir1/dir2` and `/dir1/dir2/dir3` would be
detached.
- As per our approach, we would iterate over the `deletedDirectoryTable`
entries:
- We would first encounter: `/dir1/dir2/dir3` in `deletedDirectoryTable`
→ `/dir1/dir2/dir3.getSizeOfAllFiles()` = **2 GB** (file4 and file5)
- We would then encounter: `/dir1` in `deletedDirectoryTable`
→ size of `/dir1` would be calculated as:
- `/dir1.sizeOfAllFiles()` → **1 GB** (file1) +
`recursiveSizeOfSubDirs(/dir1)`:
- `/dir1/dir4.sizeOfFiles()` → **2 GB** (file2 and file6) + no
sub-directories.
- `/dir1/dir2.sizeOfFiles()` → **1 GB** (file3) + no sub-directories
(as `/dir1/dir2/dir3` is detached).
- Total size of `/dir1` = 1 GB + 2 GB + 1 GB = **4 GB**.
So the total FSO deleted directory space would be: **2 GB**
(`/dir1/dir2/dir3`) + **4 GB** (`/dir1` with detached child: `/dir1/dir2/dir3`)
= **6 GB**.
--
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]