From: <tho...@us...> - 2013-12-09 15:11:05
|
Revision: 7618 http://bigdata.svn.sourceforge.net/bigdata/?rev=7618&view=rev Author: thompsonbry Date: 2013-12-09 15:10:58 +0000 (Mon, 09 Dec 2013) Log Message: ----------- sync to martyn. Modified Paths: -------------- branches/MGC_1_3_0/bigdata/src/java/com/bigdata/quorum/AbstractQuorum.java branches/MGC_1_3_0/bigdata/src/java/com/bigdata/quorum/QuorumActor.java branches/MGC_1_3_0/bigdata/src/test/com/bigdata/quorum/TestHA3QuorumSemantics.java branches/MGC_1_3_0/bigdata-jini/src/test/com/bigdata/quorum/zk/TestZkHA3QuorumSemantics.java Modified: branches/MGC_1_3_0/bigdata/src/java/com/bigdata/quorum/AbstractQuorum.java =================================================================== --- branches/MGC_1_3_0/bigdata/src/java/com/bigdata/quorum/AbstractQuorum.java 2013-12-09 14:57:04 UTC (rev 7617) +++ branches/MGC_1_3_0/bigdata/src/java/com/bigdata/quorum/AbstractQuorum.java 2013-12-09 15:10:58 UTC (rev 7618) @@ -2311,12 +2311,55 @@ abstract protected void doPipelineRemove(UUID serviceId); + abstract protected void doServiceJoin(); + + final protected void doServiceLeave() { + doServiceLeave(serviceId); + } + + abstract protected void doServiceLeave(UUID serviceId); + + abstract protected void doSetToken(long newToken); + +// abstract protected void doSetLastValidToken(long newToken); +// +// abstract protected void doSetToken(); + + abstract protected void doClearToken(); + + + /** + * {@inheritDoc} + * <p> + * Note: This implements an unconditional remove of the specified + * service. It is intended to force a different service out of the + * pipeline. This code deliberately takes this action unconditionally + * and does NOT await the requested state change. + * <p> + * Note: This code could potentially cause the remote service to + * deadlock in one of the conditionalXXX() methods if it is concurrently + * attempting to execute quorum action on itself. If this problem is + * observed, we should add a timeout to the conditionalXXX() methods + * that will force them to fail rather than block forever. This will + * then force the service into an error state if its QuorumActor can not + * carry out the requested action within a specified timeout. + * + * @throws InterruptedException + */ @Override - public void forceRemoveService(final UUID psid) { - doMemberRemove(psid); - doWithdrawVote(psid); - doPipelineRemove(psid); - doServiceLeave(psid); + final public void forceRemoveService(final UUID psid) + throws InterruptedException { + lock.lockInterruptibly(); + try { + log.warn("Forcing remove of service" + ": thisService=" + + serviceId + ", otherServiceId=" + psid); + doMemberRemove(psid); + doWithdrawVote(psid); + doPipelineRemove(psid); + doServiceLeave(psid); + } finally { + lock.unlock(); + } } /** @@ -2414,22 +2457,6 @@ return modified; } - abstract protected void doServiceJoin(); - - final protected void doServiceLeave() { - doServiceLeave(serviceId); - } - - abstract protected void doServiceLeave(UUID serviceId); - - abstract protected void doSetToken(long newToken); - -// abstract protected void doSetLastValidToken(long newToken); -// -// abstract protected void doSetToken(); - - abstract protected void doClearToken(); - } /** Modified: branches/MGC_1_3_0/bigdata/src/java/com/bigdata/quorum/QuorumActor.java =================================================================== --- branches/MGC_1_3_0/bigdata/src/java/com/bigdata/quorum/QuorumActor.java 2013-12-09 14:57:04 UTC (rev 7617) +++ branches/MGC_1_3_0/bigdata/src/java/com/bigdata/quorum/QuorumActor.java 2013-12-09 15:10:58 UTC (rev 7618) @@ -219,7 +219,8 @@ * * @param serviceId * The UUID of the service to be removed. + * @throws InterruptedException */ - public void forceRemoveService(UUID serviceId); + public void forceRemoveService(UUID serviceId) throws InterruptedException; } Modified: branches/MGC_1_3_0/bigdata/src/test/com/bigdata/quorum/TestHA3QuorumSemantics.java =================================================================== --- branches/MGC_1_3_0/bigdata/src/test/com/bigdata/quorum/TestHA3QuorumSemantics.java 2013-12-09 14:57:04 UTC (rev 7617) +++ branches/MGC_1_3_0/bigdata/src/test/com/bigdata/quorum/TestHA3QuorumSemantics.java 2013-12-09 15:10:58 UTC (rev 7618) @@ -1340,6 +1340,7 @@ * Rejoin the service. */ actor1.memberAdd(); + fixture.awaitDeque(); actor1.pipelineAdd(); fixture.awaitDeque(); actor1.castVote(lastCommitTime); @@ -1680,6 +1681,7 @@ } } + /** * Unit tests for pipeline reorganization when the leader is elected. This * tests the automatic reorganization of the pipeline order where the Modified: branches/MGC_1_3_0/bigdata-jini/src/test/com/bigdata/quorum/zk/TestZkHA3QuorumSemantics.java =================================================================== --- branches/MGC_1_3_0/bigdata-jini/src/test/com/bigdata/quorum/zk/TestZkHA3QuorumSemantics.java 2013-12-09 14:57:04 UTC (rev 7617) +++ branches/MGC_1_3_0/bigdata-jini/src/test/com/bigdata/quorum/zk/TestZkHA3QuorumSemantics.java 2013-12-09 15:10:58 UTC (rev 7618) @@ -1073,6 +1073,9 @@ } + /** + * Unit test of {@link QuorumActor#forceRemoveService(UUID)}. + */ public void test_serviceJoin3_simpleForceRemove() throws InterruptedException { final Quorum<?, ?> quorum0 = quorums[0]; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |