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. |