yashmayya commented on code in PR #16725:
URL: https://github.com/apache/pinot/pull/16725#discussion_r2314406068


##########
pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/realtime/PinotLLCRealtimeSegmentManager.java:
##########
@@ -2364,13 +2364,20 @@ private Set<String> filterSegmentsToCommit(Set<String> 
allConsumingSegments,
     }
 
     if (segmentsToCommitStr != null) {
-      Set<String> segmentsToCommit =
+      Set<String> requestedSegmentsToCommit =
           
Arrays.stream(segmentsToCommitStr.split(",")).map(String::trim).collect(Collectors.toSet());
-      
Preconditions.checkState(allConsumingSegments.containsAll(segmentsToCommit),
-          "Cannot commit segments that are not in CONSUMING state. "
-              + "All consuming segments: %s, provided segments to commit: %s", 
allConsumingSegments,
-          segmentsToCommitStr);
-      return segmentsToCommit;
+      // Intersect with consuming segments; warn if any requested segments are 
not currently consuming
+      Set<String> validSegmentsToCommit = requestedSegmentsToCommit.stream()
+          .filter(allConsumingSegments::contains)
+          .collect(Collectors.toSet());
+      Set<String> invalidSegments = new HashSet<>(requestedSegmentsToCommit);
+      invalidSegments.removeAll(allConsumingSegments);
+      if (!invalidSegments.isEmpty()) {
+        LOGGER.warn("Cannot commit segments that are not in CONSUMING state. 
All consuming segments: {}, "
+            + "provided segments to commit: {}. Ignoring first 10 
non-consuming segments: {}", allConsumingSegments,
+            segmentsToCommitStr, 
invalidSegments.stream().limit(10).collect(Collectors.toSet()));
+      }

Review Comment:
   > I instead changed it to do .partitionBy so we get valid and invalid in 1 
pass
   
   Neat trick!



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