HBASE-17863-addendum: Reverted the order of updateStoreOnExec() and store.isRunning() in execProcedure()

Change-Id: I1c9d5ee264f4f593a6b2a09011853ab63693f677
This commit is contained in:
Umesh Agashe 2017-04-07 14:01:37 -07:00 committed by Apekshit Sharma
parent 18c5ecf6ed
commit 59e8b8e2ba
3 changed files with 10 additions and 6 deletions

View File

@ -1373,12 +1373,17 @@ public class ProcedureExecutor<TEnvironment> {
return; return;
} }
// if the store is not running we are aborting // TODO: The code here doesn't check if store is running before persisting to the store as
if (!store.isRunning()) return; // it relies on the method call below to throw RuntimeException to wind up the stack and
// executor thread to stop. The statement following the method call below seems to check if
// store is not running, to prevent scheduling children procedures, re-execution or yield
// of this procedure. This may need more scrutiny and subsequent cleanup in future
// Commit the transaction // Commit the transaction
updateStoreOnExec(procStack, procedure, subprocs); updateStoreOnExec(procStack, procedure, subprocs);
// if the store is not running we are aborting
if (!store.isRunning()) return;
// if the procedure is kind enough to pass the slot to someone else, yield // if the procedure is kind enough to pass the slot to someone else, yield
if (procedure.isRunnable() && !suspended && if (procedure.isRunnable() && !suspended &&
procedure.isYieldAfterExecutionStep(getEnvironment())) { procedure.isYieldAfterExecutionStep(getEnvironment())) {

View File

@ -408,7 +408,7 @@ public class ProcedureTestingUtility {
addStackIndex(index); addStackIndex(index);
} }
public void setFinishedState() { public void setSuccessState() {
setState(ProcedureState.SUCCESS); setState(ProcedureState.SUCCESS);
} }

View File

@ -26,7 +26,6 @@ import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Comparator; import java.util.Comparator;
import java.util.HashSet; import java.util.HashSet;
import java.util.List;
import java.util.Set; import java.util.Set;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
@ -785,7 +784,7 @@ public class TestWALProcedureStore {
// back to A // back to A
a.addStackId(5); a.addStackId(5);
a.setFinishedState(); a.setSuccessState();
procStore.delete(a, new long[] { b.getProcId(), c.getProcId() }); procStore.delete(a, new long[] { b.getProcId(), c.getProcId() });
restartAndAssert(3, 0, 1, 0); restartAndAssert(3, 0, 1, 0);
} }