From 605af95132bdafd581112775d1603d8262ede06d Mon Sep 17 00:00:00 2001 From: Stephen Yuan Jiang Date: Wed, 31 Aug 2016 09:25:51 -0700 Subject: [PATCH] HBASE-16528 Procedure-V2: ServerCrashProcedure misses owner information (Stephen Yuan Jiang) --- .../apache/hadoop/hbase/master/ServerManager.java | 12 ++++++++---- .../hbase/master/procedure/ServerCrashProcedure.java | 9 ++++++--- .../apache/hadoop/hbase/master/TestDeadServer.java | 6 ++++-- .../master/procedure/TestMasterProcedureEvents.java | 2 +- .../master/procedure/TestServerCrashProcedure.java | 3 ++- 5 files changed, 21 insertions(+), 11 deletions(-) diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/ServerManager.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/ServerManager.java index d7ba4f35cfe..5d8cb2a6129 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/ServerManager.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/ServerManager.java @@ -52,8 +52,10 @@ import org.apache.hadoop.hbase.client.RetriesExhaustedException; import org.apache.hadoop.hbase.ipc.PayloadCarryingRpcController; import org.apache.hadoop.hbase.ipc.RpcControllerFactory; import org.apache.hadoop.hbase.master.balancer.BaseLoadBalancer; +import org.apache.hadoop.hbase.master.procedure.MasterProcedureEnv; import org.apache.hadoop.hbase.master.procedure.ServerCrashProcedure; import org.apache.hadoop.hbase.monitoring.MonitoredTask; +import org.apache.hadoop.hbase.procedure2.ProcedureExecutor; import org.apache.hadoop.hbase.protobuf.ProtobufUtil; import org.apache.hadoop.hbase.protobuf.RequestConverter; import org.apache.hadoop.hbase.protobuf.ResponseConverter; @@ -620,8 +622,9 @@ public class ServerManager { } boolean carryingMeta = master.getAssignmentManager().isCarryingMeta(serverName); - this.master.getMasterProcedureExecutor(). - submitProcedure(new ServerCrashProcedure(serverName, true, carryingMeta)); + ProcedureExecutor procExec = this.master.getMasterProcedureExecutor(); + procExec.submitProcedure(new ServerCrashProcedure( + procExec.getEnvironment(), serverName, true, carryingMeta)); LOG.debug("Added=" + serverName + " to dead servers, submitted shutdown handler to be executed meta=" + carryingMeta); @@ -664,8 +667,9 @@ public class ServerManager { } this.deadservers.add(serverName); - this.master.getMasterProcedureExecutor(). - submitProcedure(new ServerCrashProcedure(serverName, shouldSplitWal, false)); + ProcedureExecutor procExec = this.master.getMasterProcedureExecutor(); + procExec.submitProcedure(new ServerCrashProcedure( + procExec.getEnvironment(), serverName, shouldSplitWal, false)); } /** diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/procedure/ServerCrashProcedure.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/procedure/ServerCrashProcedure.java index 0c38be7f1e6..d913e737ea0 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/procedure/ServerCrashProcedure.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/procedure/ServerCrashProcedure.java @@ -145,12 +145,15 @@ implements ServerProcedureInterface { * @param shouldSplitWal True if we should split WALs as part of crashed server processing. * @param carryingMeta True if carrying hbase:meta table region. */ - public ServerCrashProcedure(final ServerName serverName, - final boolean shouldSplitWal, final boolean carryingMeta) { + public ServerCrashProcedure( + final MasterProcedureEnv env, + final ServerName serverName, + final boolean shouldSplitWal, + final boolean carryingMeta) { this.serverName = serverName; this.shouldSplitWal = shouldSplitWal; this.carryingMeta = carryingMeta; - // Currently not used. + this.setOwner(env.getRequestUser().getShortName()); } /** diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestDeadServer.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestDeadServer.java index 596612ed410..fd18b6c00ba 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestDeadServer.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestDeadServer.java @@ -19,6 +19,7 @@ package org.apache.hadoop.hbase.master; import org.apache.hadoop.hbase.HBaseTestingUtility; import org.apache.hadoop.hbase.ServerName; +import org.apache.hadoop.hbase.master.procedure.MasterProcedureEnv; import org.apache.hadoop.hbase.master.procedure.ServerCrashProcedure; import org.apache.hadoop.hbase.procedure2.ProcedureExecutor; import org.apache.hadoop.hbase.procedure2.ProcedureTestingUtility; @@ -99,8 +100,9 @@ public class TestDeadServer { @Test(timeout = 15000) public void testCrashProcedureReplay() { HMaster master = TEST_UTIL.getHBaseCluster().getMaster(); - ProcedureExecutor pExecutor = master.getMasterProcedureExecutor(); - ServerCrashProcedure proc = new ServerCrashProcedure(hostname123, false, false); + final ProcedureExecutor pExecutor = master.getMasterProcedureExecutor(); + ServerCrashProcedure proc = new ServerCrashProcedure( + pExecutor.getEnvironment(), hostname123, false, false); ProcedureTestingUtility.submitAndWait(pExecutor, proc); diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/procedure/TestMasterProcedureEvents.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/procedure/TestMasterProcedureEvents.java index f684c49d72e..d6b15d9ecaa 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/procedure/TestMasterProcedureEvents.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/procedure/TestMasterProcedureEvents.java @@ -145,7 +145,7 @@ public class TestMasterProcedureEvents { master.getServerManager().moveFromOnelineToDeadServers(hrs.getServerName()); long procId = procExec.submitProcedure( - new ServerCrashProcedure(hrs.getServerName(), true, carryingMeta)); + new ServerCrashProcedure(procExec.getEnvironment(), hrs.getServerName(), true, carryingMeta)); for (int i = 0; i < 10; ++i) { Thread.sleep(100); diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/procedure/TestServerCrashProcedure.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/procedure/TestServerCrashProcedure.java index 510b017a5ee..8717c6584f9 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/procedure/TestServerCrashProcedure.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/procedure/TestServerCrashProcedure.java @@ -118,7 +118,8 @@ public class TestServerCrashProcedure { ProcedureTestingUtility.waitNoProcedureRunning(procExec); ProcedureTestingUtility.setKillAndToggleBeforeStoreUpdate(procExec, true); long procId = - procExec.submitProcedure(new ServerCrashProcedure(hrs.getServerName(), true, carryingMeta)); + procExec.submitProcedure(new ServerCrashProcedure( + procExec.getEnvironment(), hrs.getServerName(), true, carryingMeta)); // Now run through the procedure twice crashing the executor on each step... MasterProcedureTestingUtility.testRecoveryAndDoubleExecution(procExec, procId); // Assert all data came back.