qqu0127 commented on code in PR #2319:
URL: https://github.com/apache/helix/pull/2319#discussion_r1047740099
##########
helix-core/src/main/java/org/apache/helix/controller/rebalancer/waged/ReadOnlyWagedRebalancer.java:
##########
@@ -67,26 +67,29 @@ private static class ReadOnlyAssignmentMetadataStore
extends AssignmentMetadataS
}
@Override
- public boolean persistBaseline(Map<String, ResourceAssignment>
globalBaseline) {
- // If baseline hasn't changed, skip updating the metadata store
- if (compareAssignments(_globalBaseline, globalBaseline)) {
- return false;
- }
+ public void persistBaseline(Map<String, ResourceAssignment>
globalBaseline) {
// Update the in-memory reference only
_globalBaseline = globalBaseline;
- return true;
}
@Override
- public boolean persistBestPossibleAssignment(
+ public void persistBestPossibleAssignment(
Map<String, ResourceAssignment> bestPossibleAssignment) {
- // If bestPossibleAssignment hasn't changed, skip updating the metadata
store
- if (compareAssignments(_bestPossibleAssignment, bestPossibleAssignment))
{
- return false;
- }
// Update the in-memory reference only
_bestPossibleAssignment = bestPossibleAssignment;
- return true;
+ _bestPossibleVersion++;
+ }
+ @Override
Review Comment:
nit: empty line between methods
##########
helix-core/src/main/java/org/apache/helix/controller/rebalancer/waged/AssignmentMetadataStore.java:
##########
@@ -50,6 +50,7 @@ public class AssignmentMetadataStore {
private String _bestPossiblePath;
protected Map<String, ResourceAssignment> _globalBaseline;
protected Map<String, ResourceAssignment> _bestPossibleAssignment;
+ protected int _bestPossibleVersion = 0;
Review Comment:
One potential improvement is to mark this volatile? So that all reads are
guaranteed to get the latest value.
--
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]