[ 
https://issues.apache.org/jira/browse/HADOOP-7001?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12921584#action_12921584
 ] 

Patrick Kling commented on HADOOP-7001:
---------------------------------------

I have uploaded a patch with the changes proposed in this JIRA. The included 
base class can be used to easily implement the interface by overriding the 
method changeProperty, which modifies a single configuration property:

{code}
/**
 * Change a property or throw an exception.
 *
 * Subclasses should overrride this.
 * If newVal is null, change the property to its default value.
 */
protected boolean changeProperty(String property, String newVal) 
  throws ConfigurationChangeException {
  throw new ConfigurationChangeException(property, newVal,
                                         getConf().get(property));
  
}
{code}

This should enable us to include whatever code is necessary to make a 
configuration change. The overridden version of this method should also serve 
as a good documentation of what changes are supported by a particular class.

Below is a version of the Reconfigurable interface with more detailed comments. 
Unfortunately, I cannot edit my previous comments, so I apologize if this is 
somewhat redundant:

{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.
   *
   * Detailed semantics:
   * * If a property is set in the current configuration and in newConf, then 
   *   the configuration must be updated to reflect the value in newConf.
   * * If a property is not set in the current configuration but is set in
   *   newConf, then the configuration must be set to the value in newConf.
   * * If a property is set in the current configuration but is not set in 
   *   newConf, then the configuration must revert to the default value for
   *   this property.
   * * If the change required by these rules is not possible, a
   *   ConfigurationChangeException must be thrown. 
   */
  void changeConf(Configuration newConf) throws ConfigurationChangeException;
}
{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
>            Assignee: Patrick Kling
>         Attachments: reconfigurable.patch
>
>
> 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.

Reply via email to