qqu0127 commented on code in PR #2189:
URL: https://github.com/apache/helix/pull/2189#discussion_r1034962781
##########
helix-core/src/main/java/org/apache/helix/controller/rebalancer/waged/AssignmentMetadataStore.java:
##########
@@ -206,10 +226,18 @@ private Map<String, ResourceAssignment>
splitAssignments(HelixProperty property)
* @param newAssignment
* @return true if they are the same. False otherwise or oldAssignment is
null
*/
- protected boolean compareAssignments(Map<String, ResourceAssignment>
oldAssignment,
+ private boolean compareAssignments(Map<String, ResourceAssignment>
oldAssignment,
Map<String, ResourceAssignment> newAssignment) {
// If oldAssignment is null, that means that we haven't read from/written
to
// the metadata store yet. In that case, we return false so that we write
to metadata store.
return oldAssignment != null && oldAssignment.equals(newAssignment);
}
+
+ protected boolean isBaselineChanged(Map<String, ResourceAssignment>
newBaseline) {
+ return compareAssignments(getBaseline(), newBaseline);
+ }
+
+ protected boolean isBestPossibleChanged(Map<String, ResourceAssignment>
newBaseline) {
+ return compareAssignments(getBestPossibleAssignment(), newBaseline);
+ }
Review Comment:
compareAssignments `@return true if they are the same`, so actually we
should do a negation here and in its downstream?
also the method `compareAssignments` is very shallow, we could probably just
remove it and use `Objects.equals(a, b)` instead.
--
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]