klsince commented on code in PR #11628:
URL: https://github.com/apache/pinot/pull/11628#discussion_r1333513401


##########
pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/assignment/segment/SegmentAssignment.java:
##########
@@ -52,6 +52,22 @@ public interface SegmentAssignment {
   List<String> assignSegment(String segmentName, Map<String, Map<String, 
String>> currentAssignment,
       Map<InstancePartitionsType, InstancePartitions> instancePartitionsMap);
 
+  /**
+   * Assign new segment but check if the assignment calculated with 
instancePartition is consistent with the one set
+   * in the current idealState. If not, use the one from idealState to stay 
consistent with the source of truth.
+   *
+   * @param segmentName Name of the segment to be assigned
+   * @param currentAssignment Current segment assignment of the table (map 
from segment name to instance state map)
+   * @param instancePartitionsMap Map from type (OFFLINE|CONSUMING|COMPLETED) 
to instance partitions
+   * @param instancesAssigned returns the list of instances to assign the 
segment
+   * @return true if consistent or found no existing assignment from 
idealState; false otherwise.
+   */
+  default boolean assignSegment(String segmentName, Map<String, Map<String, 
String>> currentAssignment,

Review Comment:
   I was thinking metrics was a bit heavy dep for SegmentAssignment interface 
(which seems quite functional), but I just saw its init() takes in 
HexliManager, so I'll pass a ControllerMetrics there too. 



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