hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chenh...@apache.org
Subject hbase git commit: HBASE-15714 We are calling checkRow() twice in doMiniBatchMutation()
Date Tue, 03 May 2016 02:23:43 GMT
Repository: hbase
Updated Branches:
  refs/heads/master 58c4c3d17 -> d77972ff1


HBASE-15714 We are calling checkRow() twice in doMiniBatchMutation()


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

Branch: refs/heads/master
Commit: d77972ff16ef884b6cc5651a0000789597ae68bb
Parents: 58c4c3d
Author: chenheng <chenheng@apache.org>
Authored: Tue May 3 09:42:41 2016 +1000
Committer: chenheng <chenheng@apache.org>
Committed: Tue May 3 09:42:41 2016 +1000

----------------------------------------------------------------------
 .../org/apache/hadoop/hbase/regionserver/HRegion.java | 14 +++++++++-----
 .../hbase/regionserver/TestAtomicOperation.java       |  4 ++--
 2 files changed, 11 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/d77972ff/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 428541f..5676e15 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
@@ -3019,7 +3019,7 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver,
Regi
         // If we haven't got any rows in our batch, we should block to get the next one.
         RowLock rowLock = null;
         try {
-          rowLock = getRowLock(mutation.getRow(), true);
+          rowLock = getRowLockInternal(mutation.getRow(), true);
         } catch (IOException ioe) {
           LOG.warn("Failed getting lock, row=" + Bytes.toStringBinary(mutation.getRow()),
ioe);
         }
@@ -3423,7 +3423,8 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver,
Regi
       checkFamily(family);
       get.addColumn(family, qualifier);
       // Lock row - note that doBatchMutate will relock this row if called
-      RowLock rowLock = getRowLock(get.getRow());
+      checkRow(row, "doCheckAndRowMutate");
+      RowLock rowLock = getRowLockInternal(get.getRow(), false);
       try {
         if (mutation != null && this.getCoprocessorHost() != null) {
           // Call coprocessor.
@@ -5107,8 +5108,11 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver,
Regi
    */
   @Override
   public RowLock getRowLock(byte[] row, boolean readLock) throws IOException {
-    // Make sure the row is inside of this region before getting the lock for it.
     checkRow(row, "row lock");
+    return getRowLockInternal(row, readLock);
+  }
+
+  protected RowLock getRowLockInternal(byte[] row, boolean readLock) throws IOException {
     // create an object to use a a key in the row lock map
     HashedBytes rowKey = new HashedBytes(row);
 
@@ -6827,7 +6831,7 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver,
Regi
       for (byte[] row : rowsToLock) {
         // Attempt to lock all involved rows, throw if any lock times out
         // use a writer lock for mixed reads and writes
-        acquiredRowLocks.add(getRowLock(row));
+        acquiredRowLocks.add(getRowLockInternal(row, false));
       }
       // STEP 3. Region lock
       lock(this.updatesLock.readLock(), acquiredRowLocks.size() == 0 ? 1 : acquiredRowLocks.size());
@@ -7007,7 +7011,7 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver,
Regi
     startRegionOperation(op);
     long accumulatedResultSize = 0;
     List<Cell> results = returnResults? new ArrayList<Cell>(mutation.size()):
null;
-    RowLock rowLock = getRowLock(mutation.getRow());
+    RowLock rowLock = getRowLockInternal(mutation.getRow(), false);
     try {
       lock(this.updatesLock.readLock());
       try {

http://git-wip-us.apache.org/repos/asf/hbase/blob/d77972ff/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestAtomicOperation.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestAtomicOperation.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestAtomicOperation.java
index 0626dce..11bd280 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestAtomicOperation.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestAtomicOperation.java
@@ -666,11 +666,11 @@ public class TestAtomicOperation {
     }
 
     @Override
-    public RowLock getRowLock(final byte[] row, boolean readLock) throws IOException {
+    public RowLock getRowLockInternal(final byte[] row, boolean readLock) throws IOException
{
       if (testStep == TestStep.CHECKANDPUT_STARTED) {
         latch.countDown();
       }
-      return new WrappedRowLock(super.getRowLock(row, readLock));
+      return new WrappedRowLock(super.getRowLockInternal(row, readLock));
     }
     
     public class WrappedRowLock implements RowLock {


Mime
View raw message