This is an automated email from the ASF dual-hosted git repository.

sumitagrawal pushed a commit to branch HDDS-13177
in repository https://gitbox.apache.org/repos/asf/ozone.git


The following commit(s) were added to refs/heads/HDDS-13177 by this push:
     new c57b30a83f HDDS-13188. Track total pending deletion size for FSO 
directories in OM via Recon (#8591)
c57b30a83f is described below

commit c57b30a83fd68bf458214f71322938b7db09f159
Author: tanvipenumudy <[email protected]>
AuthorDate: Thu Jul 24 12:03:08 2025 +0530

    HDDS-13188. Track total pending deletion size for FSO directories in OM via 
Recon (#8591)
---
 .../ozone/recon/api/OMDBInsightEndpoint.java       | 45 ++++++++++++++++++++++
 1 file changed, 45 insertions(+)

diff --git 
a/hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/api/OMDBInsightEndpoint.java
 
b/hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/api/OMDBInsightEndpoint.java
index 840c14b12a..16c47bd92c 100644
--- 
a/hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/api/OMDBInsightEndpoint.java
+++ 
b/hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/api/OMDBInsightEndpoint.java
@@ -676,6 +676,29 @@ private void getPendingForDeletionDirInfo(
     }
   }
 
+  private void calculateTotalPendingDeletedDirSizes(Map<String, Long> 
dirSummary) {
+    long totalDataSize = 0L;
+    long totalReplicatedDataSize = 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) {
+          Pair<Long, Long> sizeInfo = 
fetchSizeForDeletedDirectory(omKeyInfo.getObjectID());
+          totalDataSize += sizeInfo.getLeft();
+          totalReplicatedDataSize += sizeInfo.getRight();
+        }
+      }
+    } catch (IOException ex) {
+      throw new WebApplicationException(ex, 
Response.Status.INTERNAL_SERVER_ERROR);
+    }
+
+    dirSummary.put("totalDataSize", totalDataSize);
+    dirSummary.put("totalReplicatedDataSize", totalReplicatedDataSize);
+  }
+
   /**
    * Given an object ID, return total data size as a pair of Total Size, Total 
Replicated Size
    * under this object. Note:- This method is RECURSIVE.
@@ -790,6 +813,28 @@ public Response getDeletedDirectorySummary() {
     return Response.ok(dirSummary).build();
   }
 
+  /**
+   * Retrieves the summary of the total delete pending directory size 
(unreplicated and replicated).
+   *
+   * @return The HTTP response body includes a map with the following entries:
+   * - "totalDataSize": the total replicated size of delete pending 
directories.
+   * - "totalReplicatedDataSize": the total unreplicated size of delete 
pending directories.
+   *
+   * Example response:
+   *   {
+   *    "totalDataSize": 30000,
+   *    "totalReplicatedDataSize": 90000
+   *   }
+   */
+  @GET
+  @Path("/deletePending/dirs/size-summary")
+  public Response getTotalDeletedDirectorySizeSummary() {
+    Map<String, Long> dirSummary = new HashMap<>();
+    // Create a keys summary for deleted directories
+    calculateTotalPendingDeletedDirSizes(dirSummary);
+    return Response.ok(dirSummary).build();
+  }
+
   /**
    * This API will list out limited 'count' number of keys after applying 
below filters in API parameters:
    * Default Values of API param filters:


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

Reply via email to