From: <mar...@us...> - 2013-12-09 15:30:43
|
Revision: 7622 http://bigdata.svn.sourceforge.net/bigdata/?rev=7622&view=rev Author: martyncutcher Date: 2013-12-09 15:30:36 +0000 (Mon, 09 Dec 2013) Log Message: ----------- Implement ForceRemoveService task Modified Paths: -------------- branches/MGC_1_3_0/bigdata-jini/src/test/com/bigdata/journal/jini/ha/AbstractHA3JournalServerTestCase.java branches/MGC_1_3_0/bigdata-jini/src/test/com/bigdata/journal/jini/ha/TestHA3JustKills.java Modified: branches/MGC_1_3_0/bigdata-jini/src/test/com/bigdata/journal/jini/ha/AbstractHA3JournalServerTestCase.java =================================================================== --- branches/MGC_1_3_0/bigdata-jini/src/test/com/bigdata/journal/jini/ha/AbstractHA3JournalServerTestCase.java 2013-12-09 15:26:17 UTC (rev 7621) +++ branches/MGC_1_3_0/bigdata-jini/src/test/com/bigdata/journal/jini/ha/AbstractHA3JournalServerTestCase.java 2013-12-09 15:30:36 UTC (rev 7622) @@ -72,6 +72,7 @@ import com.bigdata.ha.HAGlue; import com.bigdata.ha.HAStatusEnum; +import com.bigdata.ha.IndexManagerCallable; import com.bigdata.ha.RunState; import com.bigdata.ha.msg.HARootBlockRequest; import com.bigdata.ha.msg.HASnapshotDigestRequest; @@ -1100,6 +1101,34 @@ } + /** + * Debug class to explicitly ask one service to remove another. + * + * This emulates the behaviour of the service in receiving correct notification + * of a target service failure -for example after a wire pull or sure kill. + * + */ + protected static class ForceRemoveService extends IndexManagerCallable<Void> { + + private static final long serialVersionUID = 1L; + private final UUID service; + + ForceRemoveService(final UUID service) { + this.service = service; + } + + @Override + public Void call() throws Exception { + + final HAJournal ha = (HAJournal) this.getIndexManager(); + + ha.getQuorum().getActor().forceRemoveService(service); + + return null; + } + + } + private void safeShutdown(final HAGlue haGlue, final File serviceDir, final ServiceListener serviceListener) { Modified: branches/MGC_1_3_0/bigdata-jini/src/test/com/bigdata/journal/jini/ha/TestHA3JustKills.java =================================================================== --- branches/MGC_1_3_0/bigdata-jini/src/test/com/bigdata/journal/jini/ha/TestHA3JustKills.java 2013-12-09 15:26:17 UTC (rev 7621) +++ branches/MGC_1_3_0/bigdata-jini/src/test/com/bigdata/journal/jini/ha/TestHA3JustKills.java 2013-12-09 15:30:36 UTC (rev 7622) @@ -78,7 +78,7 @@ // FIXME: in the face of no implemented error propagation we can explicitly // tell the leader to remove the killed service! - startup.serverA.submit(new RemoveService(getServiceCId()), true); + startup.serverA.submit(new ForceRemoveService(getServiceCId()), true); awaitPipeline(20, TimeUnit.SECONDS, new HAGlue[] {startup.serverA, startup.serverB}); @@ -99,31 +99,6 @@ } - /** - * Debug class to explicitly ask one service to remove another. - * - * This emulates the behaviour of the service in receiving correct notification - * of a target service failure -for example after a wire pull or sure kill. - * - */ - static class RemoveService extends IndexManagerCallable<Void> { - final UUID m_sid; - RemoveService(final UUID sid) { - m_sid = sid; - } - - @Override - public Void call() throws Exception { - final AbstractJournal journal = (AbstractJournal) getIndexManager(); - final Quorum<HAGlue, QuorumService<HAGlue>> quorum = journal - .getQuorum(); - - quorum.getActor().forceRemoveService(m_sid); - - return null; - } - } - public void testStressABC_LiveLoadRemainsMet_kill_C() throws Exception { for (int i = 0; i < 5; i++) { try { @@ -168,7 +143,7 @@ kill(startup.serverB); // FIXME: temporary call to explicitly remove the service prior to correct protocol - startup.serverA.submit(new RemoveService(getServiceBId()), true); + startup.serverA.submit(new ForceRemoveService(getServiceBId()), true); awaitPipeline(10, TimeUnit.SECONDS, new HAGlue[] {startup.serverA, startup.serverC}); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tho...@us...> - 2013-12-11 16:31:39
|
Revision: 7635 http://bigdata.svn.sourceforge.net/bigdata/?rev=7635&view=rev Author: thompsonbry Date: 2013-12-11 16:31:29 +0000 (Wed, 11 Dec 2013) Log Message: ----------- Added unit tests: - Add test where we kill B after the KB create and then do the large load. - Add test where we kill C after the KB create and then do the large load. See #724. Modified Paths: -------------- branches/MGC_1_3_0/bigdata-jini/src/test/com/bigdata/journal/jini/ha/AbstractHA3JournalServerTestCase.java branches/MGC_1_3_0/bigdata-jini/src/test/com/bigdata/journal/jini/ha/TestHA3JustKills.java Modified: branches/MGC_1_3_0/bigdata-jini/src/test/com/bigdata/journal/jini/ha/AbstractHA3JournalServerTestCase.java =================================================================== --- branches/MGC_1_3_0/bigdata-jini/src/test/com/bigdata/journal/jini/ha/AbstractHA3JournalServerTestCase.java 2013-12-11 16:17:47 UTC (rev 7634) +++ branches/MGC_1_3_0/bigdata-jini/src/test/com/bigdata/journal/jini/ha/AbstractHA3JournalServerTestCase.java 2013-12-11 16:31:29 UTC (rev 7635) @@ -233,7 +233,7 @@ */ private ServiceListener serviceListenerA = null, serviceListenerB = null; - protected ServiceListener serviceListenerC = null; + private ServiceListener serviceListenerC = null; private LookupDiscoveryManager lookupDiscoveryManager = null; @@ -268,6 +268,10 @@ return zookeeper; } + /** + * Return the negotiated zookeeper session timeout in milliseconds (if + * available) and otherwise the requested zookeeper session timeout. + */ protected int getZKSessionTimeout() { final ZooKeeper zookeeper = this.zookeeper; if (zookeeper != null) { Modified: branches/MGC_1_3_0/bigdata-jini/src/test/com/bigdata/journal/jini/ha/TestHA3JustKills.java =================================================================== --- branches/MGC_1_3_0/bigdata-jini/src/test/com/bigdata/journal/jini/ha/TestHA3JustKills.java 2013-12-11 16:17:47 UTC (rev 7634) +++ branches/MGC_1_3_0/bigdata-jini/src/test/com/bigdata/journal/jini/ha/TestHA3JustKills.java 2013-12-11 16:31:29 UTC (rev 7635) @@ -419,4 +419,96 @@ } + /** + * Test where we start A+B+C in strict sequence. Once we observe that all + * services have gone through the initial KB create, we do a sudden kill of + * B. We then start the live load. This test explores what happens when A is + * not yet aware that B is dead when the UPDATE operation starts. + * + * @throws Exception + */ + public void testABC_awaitKBCreate_killB_LiveLoadRemainsMet() + throws Exception { + + // enforce join order + final ABC startup = new ABC(true /* sequential */); + + final long token = awaitFullyMetQuorum(); + + // await the initial KB commit on all services. + awaitCommitCounter(1L, new HAGlue[] { startup.serverA, startup.serverB, + startup.serverC }); + + kill(startup.serverB); + + // start concurrent task loads that continue until fully met + final FutureTask<Void> ft = new FutureTask<Void>(new LargeLoadTask( + token)); + + executorService.submit(ft); + + awaitPipeline(getZKSessionTimeout() + 5000, TimeUnit.MILLISECONDS, + new HAGlue[] { startup.serverA, startup.serverC }); + + // also check members and joined + awaitMembers(new HAGlue[] { startup.serverA, startup.serverC }); + awaitJoined(new HAGlue[] { startup.serverA, startup.serverC }); + + // token must remain unchanged to indicate same quorum + assertEquals(token, awaitMetQuorum()); + + // Await LOAD, but with a timeout. + ft.get(longLoadTimeoutMillis, TimeUnit.MILLISECONDS); + + // token must remain unchanged to indicate same quorum + assertEquals(token, awaitMetQuorum()); + + } + + /** + * Test where we start A+B+C in strict sequence. Once we observe that all + * services have gone through the initial KB create, we do a sudden kill of + * C. We then start the live load. This test explores what happens when A + * and B are not yet aware that C is dead when the UPDATE operation starts. + * + * @throws Exception + */ + public void testABC_awaitKBCreate_killC_LiveLoadRemainsMet() + throws Exception { + + // enforce join order + final ABC startup = new ABC(true /* sequential */); + + final long token = awaitFullyMetQuorum(); + + // await the initial KB commit on all services. + awaitCommitCounter(1L, new HAGlue[] { startup.serverA, startup.serverB, + startup.serverC }); + + kill(startup.serverC); + + // start concurrent task loads that continue until fully met + final FutureTask<Void> ft = new FutureTask<Void>(new LargeLoadTask( + token)); + + executorService.submit(ft); + + awaitPipeline(getZKSessionTimeout() + 5000, TimeUnit.MILLISECONDS, + new HAGlue[] { startup.serverA, startup.serverB }); + + // also check members and joined + awaitMembers(new HAGlue[] { startup.serverA, startup.serverB }); + awaitJoined(new HAGlue[] { startup.serverA, startup.serverB }); + + // token must remain unchanged to indicate same quorum + assertEquals(token, awaitMetQuorum()); + + // Await LOAD, but with a timeout. + ft.get(longLoadTimeoutMillis, TimeUnit.MILLISECONDS); + + // token must remain unchanged to indicate same quorum + assertEquals(token, awaitMetQuorum()); + + } + } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |