narendly commented on a change in pull request #632: Asynchronously calculating 
the Baseline
URL: https://github.com/apache/helix/pull/632#discussion_r351636977
 
 

 ##########
 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(
 
 Review comment:
   This whole change could also be a self-contained PR where you actually 
explain why the change is needed. 
   
   For example, in the PR description for this change, you could explain why 
Collections.emptyMap() doesn't work and you have to explicitly set an emptyList 
for each partition key. Wouldn't you think that would make things a lot easier 
for the reviewer, if you were the one reviewing the code?

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

Reply via email to