[ https://issues.apache.org/jira/browse/HADOOP-7001?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12921552#action_12921552 ]
Patrick Kling commented on HADOOP-7001: --------------------------------------- I absolutely agree that there will likely be many configuration options that cannot be changed at run time and implementing Reconfigurable does not require that we can make arbitrary changes. For the configuration changes that are possible at run time (such as the existing examples mentioned by Philip), it would be nice to have a consistent mechanism. The interface could also make it easier to propagate configuration changes (by calling changeConf on objects to which the current configuration was propagated). This should be a bit easier to read than the JavaDoc I posted before: {code} package org.apache.hadoop.conf; /** * Something whose {...@link Configuration} can be changed at run time. */ public interface Reconfigurable extends Configurable { /** * Change the configuration of this object. * * Change the configuration of this object to the configuration * passed as conf. * If it is not possible to change a configuration option, * a {...@link ConfigurationChangeException} is thrown * and no changes are made to the current configuration */ void changeConf(Configuration conf) throws ConfigurationChangeException; } {code} {code} package org.apache.hadoop.conf; /** * Exception indicating that configuration property cannot be changed * at run time. */ public class ConfigurationChangeException extends Exception { private String property; private String newVal; private String oldVal; /** * Construct the exception message. */ private static String constructMessage(String property, String newVal, String oldVal) { String message = "Could not change property " + property; if (oldVal != null) { message += " from " + oldVal; } if (newVal != null) { message += " to " + newVal; } return message; } /** * Create a new instance of {...@link ConfigurationChangeException}. */ public ConfigurationChangeException(String property, String newVal, String oldVal) { super(constructMessage(property, newVal, oldVal)); this.property = property; this.newVal = newVal; this.oldVal = oldVal; } /** * Create a new instance of {...@link ConfigurationChangeException}. */ public ConfigurationChangeException(String property, String newVal, String oldVal, Throwable cause) { super(constructMessage(property, newVal, oldVal), cause); this.property = property; this.newVal = newVal; this.oldVal = oldVal; } /** * Get property that cannot be changed. */ public String getProperty() { return property; } /** * Get value to which property was supposed to be changed. */ public String getNewValue() { return newVal; } /** * Get old value of property that cannot be changed. */ public String getOldValue() { return oldVal; } {code} > Allow configuration changes without restarting configured nodes > --------------------------------------------------------------- > > Key: HADOOP-7001 > URL: https://issues.apache.org/jira/browse/HADOOP-7001 > Project: Hadoop Common > Issue Type: Task > Reporter: Patrick Kling > > Currently, changing the configuration on a node (e.g., the name node) > requires that we restart the node. We propose a change that would allow us to > make configuration changes without restarting. Nodes that support > configuration changes at run time should implement the following interface: > interface ChangeableConfigured extends Configured { > void changeConfiguration(Configuration newConf) throws > ConfigurationChangeException; > } > The contract of changeConfiguration is as follows: > The node will compare newConf to the existing configuration. For each > configuration property that is set to a different value than in the current > configuration, the node will either adjust its behaviour to conform to the > new configuration or throw a ConfigurationChangeException if this change is > not possible at run time. If a configuration property is set in the current > configuration but is unset in newConf, the node should use its default value > for this property. After a successful invocation of changeConfiguration, the > behaviour of the configured node should be indistinguishable from the > behaviour of a node that was configured with newConf at creation. > It should be easy to change existing nodes to implement this interface. We > can start by throwing the exception for all changes and then gradually start > supporting more and more changes at run time. (We might even consider > replacing Configured with ChangeableConfigured entirely, but I think the > proposal above afford greater flexibility). -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.