hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ecl...@apache.org
Subject hbase git commit: HBASE-13471 Fix a possible infinite loop in doMiniBatchMutation
Date Tue, 21 Apr 2015 22:28:58 GMT
Repository: hbase
Updated Branches:
  refs/heads/branch-1 ddc4a4ab5 -> ba8d98500


HBASE-13471 Fix a possible infinite loop in doMiniBatchMutation

Summary: in doMiniBatchMutation it is possible to get into an infinite loop when a query has
a row that is not in the region. If the batch had an invalid row, the row lock further down
the function would fail to acquire because it was an invalid row. However we'd catch the exception
and improperly treat it as if we had not acquired the lock and then try acquiring the lock
again. Thus once we got into this state we'd be stuck in an infinite loop. Worse yet, this
infiite loop would occur with the readLock held. So any other opertaions such as doClose()
would be locked out and stuck. The patch is to check whether the row is valid and short circuit
the failure when it doesn't work.

Test Plan: IntegrationTestReplication would consistently fail when trying to disable large
tables before the fix. After the test the tests pass consistently.

Reviewers: eclark

Subscribers: asameet

Differential Revision: https://reviews.facebook.net/D37437

Signed-off-by: Elliott Clark <eclark@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/ba8d9850
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/ba8d9850
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/ba8d9850

Branch: refs/heads/branch-1
Commit: ba8d985000c6f387aed893c3adc167ac9ec7928e
Parents: ddc4a4a
Author: Rajesh Nishtala <rajeshn@fb.com>
Authored: Mon Apr 20 17:34:25 2015 -0700
Committer: Elliott Clark <eclark@apache.org>
Committed: Tue Apr 21 15:25:01 2015 -0700

----------------------------------------------------------------------
 .../java/org/apache/hadoop/hbase/regionserver/HRegion.java   | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/ba8d9850/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
index 1f5997d..d7626c3 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
@@ -2875,6 +2875,7 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver,
Regi
           } else {
             prepareDelete((Delete) mutation);
           }
+          checkRow(mutation.getRow(), "doMiniBatchMutation");
         } catch (NoSuchColumnFamilyException nscf) {
           LOG.warn("No such column family in batch mutation", nscf);
           batchOp.retCodeDetails[lastIndexExclusive] = new OperationStatus(
@@ -2887,6 +2888,12 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver,
Regi
               OperationStatusCode.SANITY_CHECK_FAILURE, fsce.getMessage());
           lastIndexExclusive++;
           continue;
+        } catch (WrongRegionException we) {
+          LOG.warn("Batch mutation had a row that does not belong to this region", we);
+          batchOp.retCodeDetails[lastIndexExclusive] = new OperationStatus(
+              OperationStatusCode.SANITY_CHECK_FAILURE, we.getMessage());
+          lastIndexExclusive++;
+          continue;
         }
 
         // If we haven't got any rows in our batch, we should block to
@@ -4938,7 +4945,6 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver,
Regi
    * started (the calling thread has already acquired the region-close-guard lock).
    */
   protected RowLock getRowLockInternal(byte[] row, boolean waitForLock) throws IOException
{
-    checkRow(row, "row lock");
     HashedBytes rowKey = new HashedBytes(row);
     RowLockContext rowLockContext = new RowLockContext(rowKey);
 


Mime
View raw message