jadami10 commented on code in PR #16725:
URL: https://github.com/apache/pinot/pull/16725#discussion_r2314287682
##########
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,
Review Comment:
good catch! definitely confusign
##########
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 think you're referring to the condition where there's invalid segments? So
that we don't compute invalid segments if we don't have to?
I instead changed it to do `.partitionBy` so we get valid and invalid in 1
pass. The old code was already doing a full pass with `.containsAll`. So this
strictly be the same (and better than my original PR) by doing 1 pass and
returning both.
--
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]