ashishkumar50 commented on code in PR #7981:
URL: https://github.com/apache/ozone/pull/7981#discussion_r1986391625


##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/replication/SendContainerRequestHandler.java:
##########
@@ -85,6 +90,22 @@ public void onNext(SendContainerRequest req) {
       if (containerId == -1) {
         containerId = req.getContainerID();
         volume = importer.chooseNextVolume();
+        // Increment committed bytes and verify if it doesn't cross the space 
left.
+        volume.incCommittedBytes(importer.getDefaultContainerSize() * 2);
+        // Already committed bytes increased above, so required space is not 
required here in AvailableSpaceFilter
+        AvailableSpaceFilter filter = new AvailableSpaceFilter(0);
+        List<HddsVolume> hddsVolumeList = new ArrayList<>();
+        hddsVolumeList.add(volume);
+        List<HddsVolume> volumeWithEnoughSpace = hddsVolumeList.stream()
+            .filter(filter)
+            .collect(Collectors.toList());
+        if (volumeWithEnoughSpace.isEmpty()) {

Review Comment:
   Problem here is when there are two or multiple imports calls 
chooseNextVolume and for both same volume is returned but volume has space only 
for one container. 
   So to avoid this corner case I am trying here to reserve space and then 
verify again to see if space doesn't cross the volume total space.



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