swamirishi commented on code in PR #9270:
URL: https://github.com/apache/ozone/pull/9270#discussion_r2510647465


##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/service/DirectoryDeletingService.java:
##########
@@ -460,9 +471,51 @@ private OzoneManagerProtocolProtos.PurgePathRequest 
wrapPurgeRequest(
     return purgePathsRequest.build();
   }
 
-  private OzoneManagerProtocolProtos.OMResponse 
submitPurgePaths(List<PurgePathRequest> requests,
+  private List<OzoneManagerProtocolProtos.OMResponse> 
submitPurgePaths(List<PurgePathRequest> requests,

Review Comment:
   Maybe rename this function something which reflects that it is going to 
batch all the requests



##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/service/DirectoryDeletingService.java:
##########
@@ -460,9 +471,51 @@ private OzoneManagerProtocolProtos.PurgePathRequest 
wrapPurgeRequest(
     return purgePathsRequest.build();
   }
 
-  private OzoneManagerProtocolProtos.OMResponse 
submitPurgePaths(List<PurgePathRequest> requests,
+  private List<OzoneManagerProtocolProtos.OMResponse> 
submitPurgePaths(List<PurgePathRequest> requests,
       String snapTableKey, UUID expectedPreviousSnapshotId, 
Map<VolumeBucketId, BucketNameInfo> bucketNameInfoMap)
       throws InterruptedException {
+
+    List<OzoneManagerProtocolProtos.OMResponse> responses = new ArrayList<>();
+    List<PurgePathRequest> purgePathRequestBatch = new ArrayList<>();
+    int batchBytes = 0;
+
+    for (PurgePathRequest req : requests) {
+      int reqSize = req.getSerializedSize();
+
+      // If adding this request would exceed the limit, flush the current 
batch first
+      if (batchBytes + reqSize > ratisByteLimit && 
!purgePathRequestBatch.isEmpty()) {

Review Comment:
   We need not be worried about one single request adding another condition is 
unnecessary we can keep the logic simple here and do it as per the suggestion 
where we don't have to do this math and just submit if the batchBytes >= 
ratisByteLimit



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