narendly commented on a change in pull request #632: Asynchronously calculating
the Baseline
URL: https://github.com/apache/helix/pull/632#discussion_r351635700
##########
File path:
helix-core/src/main/java/org/apache/helix/controller/changedetector/ResourceChangeSnapshot.java
##########
@@ -130,18 +132,22 @@ private IdealState trimIdealState(IdealState
originalIdealState) {
// Clone the IdealState to avoid modifying the objects in the Cluster Data
Cache, which might
// be used by the other stages in the pipeline.
IdealState trimmedIdealState = new
IdealState(originalIdealState.getRecord());
+ ZNRecord idealStateRecord = trimmedIdealState.getRecord();
switch (originalIdealState.getRebalanceMode()) {
+ // WARNING: the IdealState copy constructor is not really deep copy. So
we should not modify
+ // the values directly or the cached values will be changed.
case FULL_AUTO:
// For FULL_AUTO resources, both map fields and list fields are not
considered as data input
// for the controller. The controller will write to these two types of
fields for persisting
// the assignment mapping.
- trimmedIdealState.getRecord().setListFields(Collections.emptyMap());
- trimmedIdealState.getRecord().setMapFields(Collections.emptyMap());
- break;
+
idealStateRecord.setListFields(idealStateRecord.getListFields().keySet().stream().collect(
+ Collectors.toMap(partition -> partition, partition ->
Collections.emptyList())));
+ // Continue to clean up map fields.
Review comment:
Rather, say mapFields will be cleaned up in case SEMI_AUTO so the reader
knows where to look.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]