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


##########
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:
   The logic here is actually the same as in the previous commit, just 
refactored a bit to make it clearer. It’s already quite straightforward, so I’d 
suggest keeping it as-is unless there’s a specific case we want to simplify 
further.



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