You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by ns...@apache.org on 2011/10/11 04:01:29 UTC

svn commit: r1181355 - /hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/master/BaseScanner.java

Author: nspiegelberg
Date: Tue Oct 11 02:01:29 2011
New Revision: 1181355

URL: http://svn.apache.org/viewvc?rev=1181355&view=rev
Log:
HBASE-2927: BaseScanner gets stale HRegionInfo in some race cases

Summary:
This issue is a branch of HBASE-2812, as it is a specific fix for disabling
tables in some situations. The issue is that the BaseScanner can get a stale HRI
by the time it checks if the region is OFFLINE, and even in trunk where we do a
double checkAssigned there is no way for us to tell if the region was offlined
in the mean time.

Reviewed and committed to public-trunk

Test Plan:
It was committed to public-trunk by jdcryans

DiffCamp Revision: 147520
Reviewed By: jgray
CC: jgray, hbase@lists
Revert Plan:
OK

Modified:
    hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/master/BaseScanner.java

Modified: hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/master/BaseScanner.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/master/BaseScanner.java?rev=1181355&r1=1181354&r2=1181355&view=diff
==============================================================================
--- hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/master/BaseScanner.java (original)
+++ hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/master/BaseScanner.java Tue Oct 11 02:01:29 2011
@@ -537,7 +537,7 @@ abstract class BaseScanner extends Chore
    * @throws IOException
    */
   protected void checkAssigned(final HRegionInterface regionServer,
-    final MetaRegion meta, final HRegionInfo info,
+    final MetaRegion meta, HRegionInfo info,
     final String hostnameAndPort, final long startCode, boolean checkTwice)
   throws IOException {
     boolean tryAgain = false;
@@ -554,6 +554,7 @@ abstract class BaseScanner extends Chore
       if (r != null && !r.isEmpty()) {
         sa = getServerAddress(r);
         sc = getStartCode(r);
+        info = master.getHRegionInfo(r.getRow(), r);
       }
     }
     if (sa != null && sa.length() > 0) {
@@ -565,7 +566,7 @@ abstract class BaseScanner extends Chore
        * a dead server. Regions that were on a dead server will get reassigned
        * by ProcessServerShutdown
        */
-      if (info.isOffline() ||
+      if (info == null || info.isOffline() ||
         this.master.getRegionManager().regionIsInTransition(info.getRegionNameAsString()) ||
           (serverName != null && this.master.getServerManager().isDead(serverName))) {
         return;