From e9bfa725552b02791bb266a3b4d7c8481a1d79b3 Mon Sep 17 00:00:00 2001 From: Michael Stack Date: Thu, 17 Feb 2011 17:46:58 +0000 Subject: [PATCH] HBASE-3545 Possible liveness issue with MasterServerAddress in HRegionServer getMaster git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1071725 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES.txt | 4 ++++ .../hbase/regionserver/HRegionServer.java | 23 +++++++++++++------ 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index ef87b9f68ad..542f8c9a34d 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -101,6 +101,10 @@ Release 0.90.2 - Unreleased TASK HBASE-3520 Update our bundled hadoop from branch-0.20-append to latest (rpc version 43) + + BUG FIXES + HBASE-3545 Possible liveness issue with MasterServerAddress in + HRegionServer getMaster (Greg Bowyer via Stack) Release 0.90.1 - Unreleased diff --git a/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java b/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java index b3f47d48a9c..22c9b3c20f6 100644 --- a/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java +++ b/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java @@ -1433,15 +1433,12 @@ public class HRegionServer implements HRegionInterface, HBaseRPCErrorHandler, */ private HServerAddress getMaster() { HServerAddress masterAddress = null; - while ((masterAddress = masterAddressManager.getMasterAddress()) == null) { - if (stopped) { - return null; - } - LOG.debug("No master found, will retry"); - sleeper.sleep(); - } HMasterRegionInterface master = null; + while (!stopped && master == null) { + + masterAddress = getMasterAddress(); + LOG.info("Attempting connect to Master server at " + masterAddress); try { // Do initial RPC setup. The final argument indicates that the RPC // should retry indefinitely. @@ -1465,6 +1462,18 @@ public class HRegionServer implements HRegionInterface, HBaseRPCErrorHandler, return masterAddress; } + 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; + } + /** * @return True if successfully invoked {@link #reportForDuty()} * @throws IOException