ChenSammi commented on code in PR #9252:
URL: https://github.com/apache/ozone/pull/9252#discussion_r2502293108


##########
hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/api/OMDBInsightEndpoint.java:
##########
@@ -744,6 +767,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")

Review Comment:
   It's a summary API, so I guess limit doesn't apply.  Ideally, we should add 
the new function in "/deletePending/dirs/summary" too, as the pending deletion 
key does, so all the APIs' behavior is consistent. 
   
   ```
      * Example response:
      *   {
      *    "totalDeletedKeys": 8,
      *    "totalReplicatedDataSize": 90000,
      *    "totalUnreplicatedDataSize": 30000
      *   }
      */
     @GET
     @Path("/deletePending/summary")
     public Response getDeletedKeySummary() {
   ```
   
   The difference is  for directory, it iterate the 
omMetadataManager.getDeletedDirTable() table to calculate all the sizes,  for 
key, it does this 
   
       ```
    // Fetch the necessary metrics for deleted keys
         Long replicatedSizeDeleted = 
getValueFromId(reconGlobalStatsManager.getGlobalStatsValue(
             OmTableInsightTask.getReplicatedSizeKeyFromTable(DELETED_TABLE)));
         Long unreplicatedSizeDeleted = 
getValueFromId(reconGlobalStatsManager.getGlobalStatsValue(
             
OmTableInsightTask.getUnReplicatedSizeKeyFromTable(DELETED_TABLE)));
         Long deletedKeyCount = 
getValueFromId(reconGlobalStatsManager.getGlobalStatsValue(
             OmTableInsightTask.getTableCountKeyFromTable(DELETED_TABLE)));
   ```
   I'm not very familiar with Recon code. So does above code just read the data 
some somewhere doesn't require any further calculation? 
   
   My concern regarding how we use "/deletePending/summary" and 
"/deletePending/dirs/summary" in Recon UI, if pending deletion directory size 
calculation is expensive, and in Recon UI, where only totalDeletedDirectories 
is required, if we calculate the size in each API call, the data is not used 
and wasted, in meanwhile also add the latency to this API call.  I'm fine to 
merge the two API into one if that's not a problem. 



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