You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hbase.apache.org by Gaojinchao <ga...@huawei.com> on 2011/03/18 08:52:35 UTC
Is there a little bug in HBASE-3545?
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;
}
Re: Is there a little bug in HBASE-3545?
Posted by Jean-Daniel Cryans <jd...@apache.org>.
It seems it's possible to get an NPE when the region server is
stopped, please open a jira.
J-D
On Fri, Mar 18, 2011 at 12:52 AM, Gaojinchao <ga...@huawei.com> wrote:
> 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;
> }
>