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 2022/04/20 21:22:17 UTC
[GitHub] [helix] qqu0127 commented on a diff in pull request #2055: support common input for operational input on Maintenance Management API
qqu0127 commented on code in PR #2055:
URL: https://github.com/apache/helix/pull/2055#discussion_r854564770
##########
helix-rest/src/main/java/org/apache/helix/rest/clusterMaintenanceService/MaintenanceManagementService.java:
##########
@@ -361,13 +364,20 @@ private MaintenanceManagementInstanceInfo takeFreeSingleInstanceHelper(String cl
PerInstanceAccessor.PerInstanceProperties.continueOnFailures.name();
Map<String, Map<String, String>> operationConfigSet = new HashMap<>();
+ Map<String, String> commonOperationConfig =
+ (operationConfig == null || !operationConfig.containsKey(OPERATION_CONFIG_SHARED_INPUT))
+ ? Collections.emptyMap()
+ : getMapFromJsonPayload(operationConfig.get(OPERATION_CONFIG_SHARED_INPUT));
+
// perform operation check
for (OperationInterface operationClass : operationAbstractClassList) {
String operationClassName = operationClass.getClass().getName();
Map<String, String> singleOperationConfig =
(operationConfig == null || !operationConfig.containsKey(operationClassName))
? Collections.emptyMap()
: getMapFromJsonPayload(operationConfig.get(operationClassName));
+ commonOperationConfig
+ .forEach((key, value) -> singleOperationConfig.merge(key, value, (v1, v2) -> v1));
Review Comment:
It seems we always keep the value in `singleOperationConfig`?
If so, could we use `commonOperationConfig.forEach(singleOperationConfig::putIfAbsent)`? Let's also add a comment here to clarify the combining logic.
--
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: reviews-unsubscribe@helix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@helix.apache.org
For additional commands, e-mail: reviews-help@helix.apache.org