jiajunwang commented on a change in pull request #859: Update customize state
using updater
URL: https://github.com/apache/helix/pull/859#discussion_r390023296
##########
File path:
helix-core/src/main/java/org/apache/helix/customizedstate/CustomizedStateProvider.java
##########
@@ -61,29 +61,16 @@ public synchronized void updateCustomizedState(String
customizedStateName, Strin
* Update a specific customized state based on the resource name and
partition name. The
* customized state is input as a map
*/
- public synchronized void updateCustomizedState(String customizedStateName,
String resourceName,
+ public void updateCustomizedState(String customizedStateName, String
resourceName,
String partitionName, Map<String, String> customizedStateMap) {
PropertyKey.Builder keyBuilder = _helixDataAccessor.keyBuilder();
PropertyKey propertyKey =
keyBuilder.customizedState(_instanceName, customizedStateName,
resourceName);
ZNRecord record = new ZNRecord(resourceName);
- Map<String, Map<String, String>> mapFields = new HashMap<>();
- CustomizedState existingState = getCustomizedState(customizedStateName,
resourceName);
- if (existingState != null
- &&
existingState.getRecord().getMapFields().containsKey(partitionName)) {
- Map<String, String> existingMap = new HashMap<>();
Review comment:
It is not clear what the original code tries to do here. It seems trying to
merge the map. But not really doing so. Can you confirm the original logic is
right or not?
The concern is that the default update method is doing deep merge. That is
if you have an existing state map with some stale states, even after merging,
those stale states will be kept in the map. But I assume we should clean those
stale states for updating?
----------------------------------------------------------------
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]