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

Branch: refs/heads/branch-1.3
Commit: fd31507048b1d0151297989db155d680cac5ed71
Parents: 600d10a
Author: chenheng <chenheng@apache.org>
Authored: Tue May 3 12:45:18 2016 +1000
Committer: Enis Soztutar <enis@apache.org>
Committed: Tue Jun 7 20:39:14 2016 -0700

----------------------------------------------------------------------
  .../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/fd315070/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 cd0cbca..3de8838 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
@@ -3114,7 +3114,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);
@@ -3467,9 +3467,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 {
@@ -3577,9 +3577,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 {
@@ -5214,6 +5214,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);

@@ -7046,7 +7050,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());
@@ -7283,7 +7287,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());
@@ -7573,7 +7577,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 {
@@ -7669,7 +7673,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/fd315070/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 {

Search Discussions

Discussion Posts

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 1 of 4 | next ›
Discussion Overview
groupcommits @
categorieshbase, hadoop
postedJun 8, '16 at 3:42a
activeJun 8, '16 at 3:42a
posts4
users1
websitehbase.apache.org

1 user in discussion

Enis: 4 posts

People

Translate

site design / logo © 2019 Grokbase