swaminathanmanish commented on code in PR #14742:
URL: https://github.com/apache/pinot/pull/14742#discussion_r1904289854


##########
pinot-plugins/pinot-minion-tasks/pinot-minion-builtin-tasks/src/main/java/org/apache/pinot/plugin/minion/tasks/upsertcompactmerge/UpsertCompactMergeTaskGenerator.java:
##########
@@ -296,18 +317,22 @@ public static SegmentSelectionResult 
processValidDocIdsMetadata(Map<String, Stri
       // variables to maintain current group sum
       long currentValidDocsSum = 0;
       long currentTotalDocsSum = 0;
+      double currentOutputSegmentSizeInBytes = 0.0;
 
       for (SegmentMergerMetadata segment : segments) {
         long validDocs = segment.getValidDocIds();
         long invalidDocs = segment.getInvalidDocIds();
+        double expectedSegmentSizeInBytes = segment.getSegmentSizeInBytes();
 
         // Check if adding this segment would keep the validDocs sum within 
the threshold
         if (currentValidDocsSum + validDocs <= validDocsThreshold && 
currentGroup.size() < maxNumSegments
-            && currentTotalDocsSum + validDocs + invalidDocs < 
maxRecordsPerTask) {
+            && currentTotalDocsSum + validDocs + invalidDocs < 
maxRecordsPerTask
+            && currentOutputSegmentSizeInBytes + expectedSegmentSizeInBytes < 
outputSegmentMaxSizeInBytes) {
           // Add the segment to the current group
           currentGroup.add(segment);
           currentValidDocsSum += validDocs;
           currentTotalDocsSum += validDocs + invalidDocs;
+          currentOutputSegmentSizeInBytes += expectedSegmentSizeInBytes;

Review Comment:
   Does this ensure that we are packing enough segments (based on 
outputSegmentMaxSizeInBytes) per task. If so, this still does not ensure that a 
segment is of expectedSegmentSize?  
   
   && currentTotalDocsSum + validDocs + invalidDocs < maxRecordsPerTask
               && currentOutputSegmentSizeInBytes + expectedSegmentSizeInBytes 
< outputSegmentMaxSizeInBytes) {



-- 
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: commits-unsubscr...@pinot.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org
For additional commands, e-mail: commits-h...@pinot.apache.org

Reply via email to