Uploaded image for project: 'HBase'
  1. HBase
  2. HBASE-17131

Avoid livelock caused by HRegion#processRowsWithLocks

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 1.4.0, 1.3.1, 1.2.6, 2.0.0
    • 1.4.0, 1.3.2, 2.0.0, 1.2.7
    • regionserver
    • None
    • Reviewed

    Description

      HRegion.java
      try {
            // STEP 2. Acquire the row lock(s)
            acquiredRowLocks = new ArrayList<RowLock>(rowsToLock.size());
            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(getRowLockInternal(row, false));
            }
            // STEP 3. Region lock
            lock(this.updatesLock.readLock(), acquiredRowLocks.size() == 0 ? 1 : acquiredRowLocks.size());
            locked = true;
            boolean success = false;
            long now = EnvironmentEdgeManager.currentTime();
            try {
      

      We should lock all involved rows in the second try-finally. Otherwise, we won’t release the previous locks if any subsequent lock times out.

      Attachments

        1. HBASE-17131.v0.patch
          12 kB
          Chia-Ping Tsai
        2. HBASE-17131.branch-1.v0.patch
          10 kB
          Chia-Ping Tsai
        3. HBASE-17131.branch-1.3.v0.patch
          11 kB
          Chia-Ping Tsai
        4. HBASE-17131.branch-1.2.v0.patch
          10 kB
          Chia-Ping Tsai

        Issue Links

          Activity

            People

              chia7712 Chia-Ping Tsai
              chia7712 Chia-Ping Tsai
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: