hbase-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gaojinchao <gaojinc...@huawei.com>
Subject Is there a little bug in HBASE-3545?
Date Fri, 18 Mar 2011 07:52:35 GMT
It will throw NullPointerException while the masterAddress is null.


private HServerAddress getMaster() {

    HServerAddress masterAddress = null;
    HMasterRegionInterface master = null;

    while (!stopped && master == null) {

      masterAddress = getMasterAddress();    // it may be null in some scenarios stopping
region server

      LOG.info("Attempting connect to Master server at " + masterAddress);
      try {
        // Do initial RPC setup. The final argument indicates that the RPC
        // should retry indefinitely.
        master = (HMasterRegionInterface) HBaseRPC.waitForProxy(
            HMasterRegionInterface.class, HBaseRPCProtocolVersion.versionID,
           masterAddress.getInetSocketAddress(), this.conf, -1,
            this.rpcTimeout, this.rpcTimeout);
      } catch (IOException e) {
        e = e instanceof RemoteException ?
            ((RemoteException)e).unwrapRemoteException() : e;
        if (e instanceof ServerNotRunningException) {
          LOG.info("Master isn't available yet, retrying");
        } else {
          LOG.warn("Unable to connect to master. Retrying. Error was:", e);
        }
        sleeper.sleep();
      }
    }
    LOG.info("Connected to master at " + masterAddress);
    this.hbaseMaster = master;
    return masterAddress;
  }

  /**
   *
   * @return hmaster address
   */
  private HServerAddress getMasterAddress() {
      HServerAddress masterAddress = null;
        while ((masterAddress = masterAddressManager.getMasterAddress()) == null) {
          if (stopped) {
            return null;
          }
          LOG.debug("No master found, will retry");
          sleeper.sleep();
        }
      return masterAddress;
  }

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message