snleee commented on code in PR #10264:
URL: https://github.com/apache/pinot/pull/10264#discussion_r1102449694


##########
pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/PinotHelixResourceManager.java:
##########
@@ -3246,16 +3247,18 @@ 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));
-    Preconditions.checkArgument(segmentsForTable.containsAll(segmentsFrom), 
String.format(
-        "Not all segments from 'segmentsFrom' are available in the table. 
(tableName = '%s', segmentsFrom = '%s', "
-            + "segmentsTo = '%s', segmentsFromTable = '%s')", 
tableNameWithType, segmentsFrom, segmentsTo,
-        segmentsForTable));
+    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', segmentsFromTable = '%s')", 
unavailableSegmentsInFrom, tableNameWithType,

Review Comment:
   In this case, we can actually remove `segmentsFromTable`? 
   
   In many cases this is not too useful. Also, this list can be very long in 
general (e.g. can be 10k segments)



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