You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@helix.apache.org by GitBox <gi...@apache.org> on 2019/11/29 07:53:44 UTC

[GitHub] [helix] narendly commented on a change in pull request #635: Fix a potential issue in the ResourceChangeSnapshot.

narendly commented on a change in pull request #635: Fix a potential issue in the ResourceChangeSnapshot.
URL: https://github.com/apache/helix/pull/635#discussion_r352012821
 
 

 ##########
 File path: helix-core/src/test/java/org/apache/helix/controller/changedetector/TestResourceChangeDetector.java
 ##########
 @@ -359,22 +359,21 @@ public void testIgnoreControllerGeneratedFields() {
         .addResource(CLUSTER_NAME, resourceName, NUM_PARTITIONS, STATE_MODEL);
     IdealState idealState = _dataAccessor.getProperty(_keyBuilder.idealStates(resourceName));
     idealState.setRebalanceMode(IdealState.RebalanceMode.FULL_AUTO);
+    idealState.getRecord().getMapFields().put("Partition1", new HashMap<>());
     _dataAccessor.updateProperty(_keyBuilder.idealStates(resourceName), idealState);
-
     _dataProvider.notifyDataChange(ChangeType.CLUSTER_CONFIG);
     _dataProvider.notifyDataChange(ChangeType.IDEAL_STATE);
     _dataProvider.refresh(_dataAccessor);
 
+    // Test with ignore option to be true
     ResourceChangeDetector changeDetector = new ResourceChangeDetector(true);
     changeDetector.updateSnapshots(_dataProvider);
-
-    // Now, modify the field that is modifying by Helix logic
-    idealState.getRecord().getMapFields().put("Extra_Change", new HashMap<>());
-    _dataAccessor.updateProperty(_keyBuilder.idealStates(NEW_RESOURCE_NAME), idealState);
+    // Now, modify the field
+    idealState.getRecord().getMapFields().put("Partition1", Collections.singletonMap("foo", "bar"));
+    _dataAccessor.updateProperty(_keyBuilder.idealStates(resourceName), idealState);
     _dataProvider.notifyDataChange(ChangeType.IDEAL_STATE);
     _dataProvider.refresh(_dataAccessor);
     changeDetector.updateSnapshots(_dataProvider);
-
     Assert.assertEquals(changeDetector.getChangeTypes(),
         Collections.singleton(ChangeType.IDEAL_STATE));
 
 Review comment:
   Question: Shouldn't this be empty? Since we want to ignore the change in the mapField of the IdealState?

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@helix.apache.org
For additional commands, e-mail: reviews-help@helix.apache.org