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 12:33:06 GMT
Repository: hbase
Updated Branches:
  refs/heads/branch-1 330b3b281 -> 0ee3ca2a7


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/0ee3ca2a
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/0ee3ca2a
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/0ee3ca2a

Branch: refs/heads/branch-1
Commit: 0ee3ca2a781f60cdaa9433a0a4f20bf3a146e4e6
Parents: 330b3b2
Author: chenheng <chenheng@apache.org>
Authored: Tue May 3 12:45:18 2016 +1000
Committer: chenheng <chenheng@apache.org>
Committed: Tue May 3 22:34:09 2016 +1000

----------------------------------------------------------------------
 .../hadoop/hbase/regionserver/HRegion.java      | 22 ++++++++++++--------
 .../hbase/regionserver/TestAtomicOperation.java |  4 ++--
 2 files changed, 15 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/0ee3ca2a/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 a9ca483..e578c8c 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
@@ -3104,7 +3104,7 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver,
Regi
         // 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 in batch put, row="
             + Bytes.toStringBinary(mutation.getRow()), ioe);
@@ -3455,9 +3455,9 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver,
Regi
       Get get = new Get(row);
       checkFamily(family);
       get.addColumn(family, qualifier);
-
+      checkRow(row, "checkAndMutate");
       // Lock row - note that doBatchMutate will relock this row if called
-      RowLock rowLock = getRowLock(get.getRow());
+      RowLock rowLock = getRowLockInternal(get.getRow(), false);
       // wait for all previous transactions to complete (with lock held)
       mvcc.await();
       try {
@@ -3565,9 +3565,9 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver,
Regi
       Get get = new Get(row);
       checkFamily(family);
       get.addColumn(family, qualifier);
-
+      checkRow(row, "checkAndRowMutate");
       // Lock row - note that doBatchMutate will relock this row if called
-      RowLock rowLock = getRowLock(get.getRow());
+      RowLock rowLock = getRowLockInternal(get.getRow(), false);
       // wait for all previous transactions to complete (with lock held)
       mvcc.await();
       try {
@@ -5202,6 +5202,10 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver,
Regi
   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);
 
@@ -7022,7 +7026,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));
       }
       // 3. Region lock
       lock(this.updatesLock.readLock(), acquiredRowLocks.size() == 0 ? 1 : acquiredRowLocks.size());
@@ -7259,7 +7263,7 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver,
Regi
     WALKey walKey = null;
     boolean doRollBackMemstore = false;
     try {
-      rowLock = getRowLock(row);
+      rowLock = getRowLockInternal(row, false);
       assert rowLock != null;
       try {
         lock(this.updatesLock.readLock());
@@ -7549,7 +7553,7 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver,
Regi
     // changing it. These latter increments by zero are NOT added to the WAL.
     List<Cell> allKVs = new ArrayList<Cell>(increment.size());
     Durability effectiveDurability = getEffectiveDurability(increment.getDurability());
-    RowLock rowLock = getRowLock(increment.getRow());
+    RowLock rowLock = getRowLockInternal(increment.getRow(), false);
     try {
       lock(this.updatesLock.readLock());
       try {
@@ -7645,7 +7649,7 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver,
Regi
     List<Cell> memstoreCells = new ArrayList<Cell>();
     Durability effectiveDurability = getEffectiveDurability(increment.getDurability());
     try {
-      rowLock = getRowLock(increment.getRow());
+      rowLock = getRowLockInternal(increment.getRow(), false);
       long txid = 0;
       try {
         lock(this.updatesLock.readLock());

http://git-wip-us.apache.org/repos/asf/hbase/blob/0ee3ca2a/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 4763c55..e49c265 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
@@ -685,11 +685,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