HBASE-11189 Subprocedure should be marked as complete upon failure

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1595357 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Zhihong Yu 2014-05-16 21:29:41 +00:00
parent 3f0f2a2bfe
commit 622d55c1b2
3 changed files with 8 additions and 5 deletions

View File

@ -246,7 +246,8 @@ public class ProcedureMember implements Closeable {
", ignoring it.", ee);
return; // Procedure has already completed
}
LOG.error("Propagating foreign exception to subprocedure " + sub.getName(), ee);
sub.monitor.receive(ee);
String msg = "Propagating foreign exception to subprocedure " + sub.getName();
LOG.error(msg, ee);
sub.cancel(msg, ee);
}
}
}

View File

@ -265,6 +265,7 @@ abstract public class Subprocedure implements Callable<Void> {
*/
public void cancel(String msg, Throwable cause) {
LOG.error(msg, cause);
complete = true;
if (cause instanceof ForeignException) {
monitor.receive((ForeignException) cause);
} else {

View File

@ -231,7 +231,7 @@ public class TestZKProcedure {
final int[] elem = new int[1];
for (int i = 0; i < members.size(); i++) {
ForeignExceptionDispatcher cohortMonitor = new ForeignExceptionDispatcher();
ProcedureMember comms = members.get(i).getFirst();
final ProcedureMember comms = members.get(i).getFirst();
Subprocedure commit = Mockito
.spy(new SubprocedureImpl(comms, opName, cohortMonitor, WAKE_FREQUENCY, TIMEOUT));
// This nasty bit has one of the impls throw a TimeoutException
@ -245,7 +245,8 @@ public class TestZKProcedure {
new TimeoutException("subprocTimeout" , 1, 2, 0));
Subprocedure r = ((Subprocedure) invocation.getMock());
LOG.error("Remote commit failure, not propagating error:" + remoteCause);
r.monitor.receive(remoteCause);
comms.receiveAbortProcedure(r.getName(), remoteCause);
assertEquals(r.isComplete(), true);
// don't complete the error phase until the coordinator has gotten the error
// notification (which ensures that we never progress past prepare)
try {