zhoushulin created HADOOP-15701:
-----------------------------------

             Summary: The constant used in "getProxy()" in HAAdmin.java should 
be configurable
                 Key: HADOOP-15701
                 URL: https://issues.apache.org/jira/browse/HADOOP-15701
             Project: Hadoop Common
          Issue Type: Bug
          Components: conf, ha
            Reporter: zhoushulin


The constant value used in getProxy() in HAAdmin.java should be configurable

In HAAdmin.java, the "HAServiceTarget.getProxy()" is used 6 times. In 3 times 
of usage in method "getAllServiceState()", "getServiceState()" and 
"checkHealth()", the timeout as the second parameter is configurable (with 
configuration option "ha.failover-controller.cli-check.rpc-timeout.ms").
{code:java}
  ...
  rpcTimeoutForChecks = conf.getInt(
          CommonConfigurationKeys.HA_FC_CLI_CHECK_TIMEOUT_KEY,
          CommonConfigurationKeys.HA_FC_CLI_CHECK_TIMEOUT_DEFAULT);
{code}
{code:java}
  protected int getAllServiceState() {
      ...
      HAServiceProtocol proto = target.getProxy(getConf(),
            rpcTimeoutForChecks);
      ...
  }  
{code}
{code:java}
  private int checkHealth(final CommandLine cmd)
      throws IOException, ServiceFailedException {
    ...
    HAServiceProtocol proto = resolveTarget(argv[0]).getProxy(
        getConf(), rpcTimeoutForChecks);
    ...
  }
{code}
{code:java}
  private int getServiceState(final CommandLine cmd)
      throws IOException, ServiceFailedException {
    ...
    HAServiceProtocol proto = resolveTarget(argv[0]).getProxy(
        getConf(), rpcTimeoutForChecks);
    ...
  }
{code}
However, the other 3 times of usage is not configurable in method 
"transitionToActive()", "isOtherTargetNodeActive()", and 
"transitionToStandby()". The constants used in "HAServiceTarget.getProxy()" in 
these three method are 0, 5000, and 0. 
{code:java}
private int transitionToActive(final CommandLine cmd)
      throws IOException, ServiceFailedException {
    ...
    HAServiceProtocol proto = target.getProxy(
        getConf(), 0);
    ...
}
{code}
{code:java}
private boolean isOtherTargetNodeActive(String targetNodeToActivate, boolean 
forceActive)
      throws IOException  {
    ...
    HAServiceProtocol proto = target.getProxy(getConf(), 5000);
    ...
}
{code}
{code:java}
private int transitionToStandby(final CommandLine cmd)
      throws IOException, ServiceFailedException {
    ...
    HAServiceProtocol proto = target.getProxy(
        getConf(), 0);
    ...
}
{code}
I think this three constant should also be configurable, since there are no 
difference from the former ones.

 

 

 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: common-dev-unsubscr...@hadoop.apache.org
For additional commands, e-mail: common-dev-h...@hadoop.apache.org

Reply via email to