HBASE-21377 Add debug log for catching the root cause

This commit is contained in:
Duo Zhang 2018-10-24 15:41:56 +08:00
parent b2fcf765ae
commit 3fe8649b2c
3 changed files with 30 additions and 17 deletions

View File

@ -24,6 +24,8 @@ import java.util.List;
import java.util.Set; import java.util.Set;
import org.apache.yetus.audience.InterfaceAudience; import org.apache.yetus.audience.InterfaceAudience;
import org.apache.yetus.audience.InterfaceStability; import org.apache.yetus.audience.InterfaceStability;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.hadoop.hbase.shaded.protobuf.generated.ProcedureProtos.ProcedureState; import org.apache.hadoop.hbase.shaded.protobuf.generated.ProcedureProtos.ProcedureState;
@ -42,6 +44,8 @@ import org.apache.hadoop.hbase.shaded.protobuf.generated.ProcedureProtos.Procedu
@InterfaceStability.Evolving @InterfaceStability.Evolving
class RootProcedureState<TEnvironment> { class RootProcedureState<TEnvironment> {
private static final Logger LOG = LoggerFactory.getLogger(RootProcedureState.class);
private enum State { private enum State {
RUNNING, // The Procedure is running or ready to run RUNNING, // The Procedure is running or ready to run
FAILED, // The Procedure failed, waiting for the rollback executing FAILED, // The Procedure failed, waiting for the rollback executing
@ -146,6 +150,7 @@ class RootProcedureState<TEnvironment> {
subprocStack = new ArrayList<>(); subprocStack = new ArrayList<>();
} }
proc.addStackIndex(subprocStack.size()); proc.addStackIndex(subprocStack.size());
LOG.debug("Add procedure {} as the {}th rollback step", proc, subprocStack.size());
subprocStack.add(proc); subprocStack.add(proc);
} }

View File

@ -145,6 +145,9 @@ public final class WALProcedureTree {
private void collectStackId(Entry entry, Map<Integer, List<Entry>> stackId2Proc, private void collectStackId(Entry entry, Map<Integer, List<Entry>> stackId2Proc,
MutableInt maxStackId) { MutableInt maxStackId) {
if (LOG.isDebugEnabled()) {
LOG.debug("Procedure {} stack ids={}", entry, entry.proc.getStackIdList());
}
for (int i = 0, n = entry.proc.getStackIdCount(); i < n; i++) { for (int i = 0, n = entry.proc.getStackIdCount(); i < n; i++) {
int stackId = entry.proc.getStackId(i); int stackId = entry.proc.getStackId(i);
if (stackId > maxStackId.intValue()) { if (stackId > maxStackId.intValue()) {

View File

@ -275,6 +275,7 @@ public class TestMergeTableRegionsProcedure {
@Test @Test
public void testMergeWithoutPONR() throws Exception { public void testMergeWithoutPONR() throws Exception {
try {
final TableName tableName = TableName.valueOf("testMergeWithoutPONR"); final TableName tableName = TableName.valueOf("testMergeWithoutPONR");
final ProcedureExecutor<MasterProcedureEnv> procExec = getMasterProcedureExecutor(); final ProcedureExecutor<MasterProcedureEnv> procExec = getMasterProcedureExecutor();
@ -300,6 +301,10 @@ public class TestMergeTableRegionsProcedure {
ProcedureTestingUtility.waitProcedure(procExec, procId); ProcedureTestingUtility.waitProcedure(procExec, procId);
assertRegionCount(tableName, initialRegionCount - 1); assertRegionCount(tableName, initialRegionCount - 1);
} catch (Throwable t) {
LOG.error("error!", t);
throw t;
}
} }
private List<RegionInfo> createTable(final TableName tableName) throws Exception { private List<RegionInfo> createTable(final TableName tableName) throws Exception {