Github user kishoreg commented on a diff in the pull request:
https://github.com/apache/helix/pull/65#discussion_r95282034
--- Diff:
helix-core/src/main/java/org/apache/helix/manager/zk/ZKHelixAdmin.java ---
@@ -162,6 +162,20 @@ public InstanceConfig getInstanceConfig(String
clusterName, String instanceName)
}
@Override
+ public boolean setInstanceConfig(String clusterName, String
instanceName,InstanceConfig instanceConfig) {
+ String instanceConfigPath =
+ PropertyPathConfig.getPath(PropertyType.CONFIGS, clusterName,
ConfigScopeProperty.PARTICIPANT.toString(),
+ instanceName);
+ if (!_zkClient.exists(instanceConfigPath)) {
+ throw new HelixException("instance" + instanceName + " does not
exist in cluster " + clusterName);
+ }
+
+ HelixDataAccessor accessor = new ZKHelixDataAccessor(clusterName, new
ZkBaseDataAccessor<ZNRecord>(_zkClient));
+ Builder keyBuilder = accessor.keyBuilder();
+ return accessor.setProperty(keyBuilder.instanceConfig(instanceName),
instanceConfig);
--- End diff --
this will override the existing configuration. Helix relies on HELIX_HOST
and HELIX_PORT in this instanceConfig. We have two options here
-- Ensure that these two properties are set. If not, copy them from
previous instanceConfig.
-- Change the method name to updateInstanceConfig and merge the old and new
instanceConfigs. We can do this using
oldInstanceConfig.getRecord().merge(newInstanceConfig.getRecord());
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---