From 5490c558bce907c46ce544710846966ed1c9eb0e Mon Sep 17 00:00:00 2001 From: Sean Busbey Date: Fri, 28 Jul 2017 16:04:45 -0500 Subject: [PATCH] HBASE-18475 ensure only non-null procedures are sent to requireTableExclusiveLock Signed-off-by: Umesh Agashe Signed-off-by: Michael Stack --- .../master/procedure/MasterProcedureScheduler.java | 10 ++++++++++ 1 file changed, 10 insertions(+) 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 10e6aa06d88..564b86d6bf5 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 @@ -212,6 +212,9 @@ public class MasterProcedureScheduler extends AbstractProcedureScheduler { } final Procedure pollResult = rq.peek(); + if (pollResult == null) { + return null; + } final boolean xlockReq = rq.requireExclusiveLock(pollResult); if (xlockReq && rq.getLockStatus().isLocked() && !rq.getLockStatus().hasLockAccess(pollResult)) { // someone is already holding the lock (e.g. shared lock). avoid a yield @@ -586,6 +589,9 @@ public class MasterProcedureScheduler extends AbstractProcedureScheduler { // ============================================================================ // Table Locking Helpers // ============================================================================ + /** + * @param proc must not be null + */ private static boolean requireTableExclusiveLock(TableProcedureInterface proc) { switch (proc.getTableOperationType()) { case CREATE: @@ -1007,6 +1013,10 @@ public class MasterProcedureScheduler extends AbstractProcedureScheduler { // ============================================================================ private static abstract class Queue> extends AvlLinkedNode> { + + /** + * @param proc must not be null + */ abstract boolean requireExclusiveLock(Procedure proc); private final TKey key;