You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by st...@apache.org on 2018/08/04 13:42:34 UTC

hbase git commit: HBASE-20829 Remove the addFront assertion in MasterProcedureScheduler.doAdd

Repository: hbase
Updated Branches:
  refs/heads/branch-2.0 ecabd9c32 -> 9a572eac5


HBASE-20829 Remove the addFront assertion in MasterProcedureScheduler.doAdd


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

Branch: refs/heads/branch-2.0
Commit: 9a572eac5be1c461d1a8d00f30987a962e0b10e0
Parents: ecabd9c
Author: zhangduo <zh...@apache.org>
Authored: Tue Jul 3 08:38:49 2018 +0800
Committer: Michael Stack <st...@apache.org>
Committed: Sat Aug 4 06:42:21 2018 -0700

----------------------------------------------------------------------
 .../master/procedure/MasterProcedureScheduler.java     | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/9a572eac/hbase-server/src/main/java/org/apache/hadoop/hbase/master/procedure/MasterProcedureScheduler.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/procedure/MasterProcedureScheduler.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/procedure/MasterProcedureScheduler.java
index 8ff7fe9..0ac18ba 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/procedure/MasterProcedureScheduler.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/procedure/MasterProcedureScheduler.java
@@ -137,17 +137,24 @@ public class MasterProcedureScheduler extends AbstractProcedureScheduler {
 
   private <T extends Comparable<T>> void doAdd(final FairQueue<T> fairq,
       final Queue<T> queue, final Procedure proc, final boolean addFront) {
-    queue.add(proc, addFront);
-    if (!queue.getLockStatus().hasExclusiveLock() || queue.getLockStatus().isLockOwner(proc.getProcId())) {
+    if (!queue.getLockStatus().hasExclusiveLock() ||
+      queue.getLockStatus().isLockOwner(proc.getProcId())) {
       // if the queue was not remove for an xlock execution
       // or the proc is the lock owner, put the queue back into execution
+      queue.add(proc, addFront);
       addToRunQueue(fairq, queue);
     } else if (queue.getLockStatus().hasParentLock(proc)) {
-      assert addFront : "expected to add a child in the front";
+      // always add it to front as its parent has the xlock
+      // usually the addFront is true if we arrive here as we will call addFront for adding sub
+      // proc, but sometimes we may retry on the proc which means we will arrive here through yield,
+      // so it is possible the addFront here is false.
+      queue.add(proc, true);
       // our (proc) parent has the xlock,
       // so the queue is not in the fairq (run-queue)
       // add it back to let the child run (inherit the lock)
       addToRunQueue(fairq, queue);
+    } else {
+      queue.add(proc, addFront);
     }
   }