You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by "Jackie-Jiang (via GitHub)" <gi...@apache.org> on 2023/02/15 18:36:06 UTC

[GitHub] [pinot] Jackie-Jiang commented on a diff in pull request #10284: Improve the error message for segment replacement

Jackie-Jiang commented on code in PR #10284:
URL: https://github.com/apache/pinot/pull/10284#discussion_r1107547866


##########
pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/PinotHelixResourceManager.java:
##########
@@ -3247,42 +3247,44 @@ public String startReplaceSegments(String tableNameWithType, List<String> segmen
 
     // Check that all the segments from 'segmentsFrom' exist in the table
     Set<String> segmentsForTable = new HashSet<>(getSegmentsFor(tableNameWithType, true));
-    Set<String> unavailableSegmentsInFrom = Sets.difference(new HashSet<>(segmentsFrom), segmentsForTable);
-    Preconditions.checkArgument(unavailableSegmentsInFrom.isEmpty(), String.format(
-        "'%s' from 'segmentsFrom' are unavailable in the table. (tableName = '%s', segmentsFrom = '%s', "
-            + "segmentsTo = '%s')", unavailableSegmentsInFrom, tableNameWithType, segmentsFrom, segmentsTo));
-
-    // Check that all the segments from 'segmentTo' does not exist in the table.
-    Set<String> availableSegmentsInTo = Sets.intersection(new HashSet<>(segmentsTo), segmentsForTable);
-    Preconditions.checkArgument(availableSegmentsInTo.isEmpty(), String.format(
-        "'%s' from 'segmentsTo' should not be available in the table at this point. (tableName = '%s', "
-            + "segmentsFrom = '%s', segmentsTo = '%s')", availableSegmentsInTo, tableNameWithType, segmentsFrom,
-        segmentsTo));
+    for (String segment : segmentsFrom) {
+      Preconditions.checkState(segmentsForTable.contains(segment),

Review Comment:
   It will log it in the end (check the `catch` block)



-- 
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-unsubscribe@pinot.apache.org

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


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