zpinto commented on code in PR #2772:
URL: https://github.com/apache/helix/pull/2772#discussion_r1526836976
##########
helix-core/src/main/java/org/apache/helix/manager/zk/ZKHelixAdmin.java:
##########
@@ -840,11 +808,31 @@ public boolean completeSwapIfPossible(String clusterName,
String instanceName,
return false;
}
- // Complete the swap by removing the InstanceOperation for the SWAP_IN
node and disabling the SWAP_OUT node.
- setInstanceOperation(clusterName, swapInInstanceConfig.getInstanceName(),
null);
- enableInstance(clusterName, swapOutInstanceConfig.getInstanceName(),
false);
+ BaseDataAccessor<ZNRecord> baseAccessor = new
ZkBaseDataAccessor<>(_zkClient);
+ String swapInInstanceConfigPath =
+ PropertyPathBuilder.instanceConfig(clusterName,
swapInInstanceConfig.getInstanceName());
+ String swapOutInstanceConfigPath =
+ PropertyPathBuilder.instanceConfig(clusterName,
swapOutInstanceConfig.getInstanceName());
+
+ return baseAccessor.multiSet(Map.of(swapInInstanceConfigPath, currentData
-> {
+ if (currentData == null) {
+ throw new HelixException("Cluster: " + clusterName + ", instance: " +
instanceName
+ + ", SWAP_IN instance config is null");
+ }
+
+ InstanceConfig config = new InstanceConfig(currentData);
+ config.setInstanceOperation(InstanceConstants.InstanceOperation.ENABLE);
Review Comment:
This should copy the whole instance config to the new node, expose a flag
for whether to include user fields or not.
Exclude HELIX_HOST.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]