[
https://issues.apache.org/jira/browse/HELIX-651?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15813421#comment-15813421
]
ASF GitHub Bot commented on HELIX-651:
--------------------------------------
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());
> Add a method in HelixAdmin to set the InstanceConfig of an existing instance
> ----------------------------------------------------------------------------
>
> Key: HELIX-651
> URL: https://issues.apache.org/jira/browse/HELIX-651
> Project: Apache Helix
> Issue Type: Improvement
> Components: helix-core
> Affects Versions: 0.6.x, master
> Reporter: Priyesh
> Labels: newbie
> Fix For: 0.6.x, master
>
> Original Estimate: 24h
> Remaining Estimate: 24h
>
> There is seemingly no way to set the InstanceConfig of an instance via the
> HelixAdmin, after the instance is added to the cluster. It would be useful to
> have a setInstanceConfig() similar to getInstanceConfig().
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)