[
https://issues.apache.org/jira/browse/HELIX-651?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15813448#comment-15813448
]
ASF GitHub Bot commented on HELIX-651:
--------------------------------------
Github user pnarayanan commented on a diff in the pull request:
https://github.com/apache/helix/pull/65#discussion_r95283285
--- 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 --
`updateInstanceConfig()` is what I initially had, but merging wasn't what I
wanted. Basically, I was looking for a way to remove elements from a List field
in the config - and merging always appends new elements to the list, never
removes from it. Is there something I am missing?
I agree with your first suggestion. I think we can throw an exception if
those two fields are not the same between the old instanceConfig and the new
one to make the API tight (rather than silently setting it from the old one).
What do you think?
> 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)