Return-Path: X-Original-To: apmail-bookkeeper-commits-archive@www.apache.org Delivered-To: apmail-bookkeeper-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id B9F77179F0 for ; Tue, 21 Apr 2015 08:14:35 +0000 (UTC) Received: (qmail 93268 invoked by uid 500); 21 Apr 2015 08:14:35 -0000 Delivered-To: apmail-bookkeeper-commits-archive@bookkeeper.apache.org Received: (qmail 93240 invoked by uid 500); 21 Apr 2015 08:14:35 -0000 Mailing-List: contact commits-help@bookkeeper.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: bookkeeper-dev@bookkeeper.apache.org Delivered-To: mailing list commits@bookkeeper.apache.org Received: (qmail 93230 invoked by uid 99); 21 Apr 2015 08:14:35 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 21 Apr 2015 08:14:35 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 86B10E04BE; Tue, 21 Apr 2015 08:14:35 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: sijie@apache.org To: commits@bookkeeper.apache.org Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: bookkeeper git commit: BOOKKEEPER-846: TestLedgerChecker times out (rakeshr via sijie) Date: Tue, 21 Apr 2015 08:14:35 +0000 (UTC) Repository: bookkeeper Updated Branches: refs/heads/branch-4.3 49395cf59 -> 49261795f BOOKKEEPER-846: TestLedgerChecker times out (rakeshr via sijie) Project: http://git-wip-us.apache.org/repos/asf/bookkeeper/repo Commit: http://git-wip-us.apache.org/repos/asf/bookkeeper/commit/49261795 Tree: http://git-wip-us.apache.org/repos/asf/bookkeeper/tree/49261795 Diff: http://git-wip-us.apache.org/repos/asf/bookkeeper/diff/49261795 Branch: refs/heads/branch-4.3 Commit: 49261795f1a7b1b690b4fd81b5e01df8cf1ff1a6 Parents: 49395cf Author: Sijie Guo Authored: Tue Apr 21 01:14:25 2015 -0700 Committer: Sijie Guo Committed: Tue Apr 21 01:14:25 2015 -0700 ---------------------------------------------------------------------- CHANGES.txt | 2 ++ .../bookkeeper/client/TestLedgerChecker.java | 35 ++++++++++++++------ 2 files changed, 26 insertions(+), 11 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/bookkeeper/blob/49261795/CHANGES.txt ---------------------------------------------------------------------- diff --git a/CHANGES.txt b/CHANGES.txt index ecaf17c..9edfa96 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -26,6 +26,8 @@ Release 4.3.1 - unreleased BOOKKEEPER-834: test case error in test class TestDiskChecker (zhaijia via sijie) + BOOKKEEPER-846: TestLedgerChecker times out (rakeshr via sijie) + IMPROVEMENTS: BOOKKEEPER-800: Expose whether a ledger is closed or not (ivank) http://git-wip-us.apache.org/repos/asf/bookkeeper/blob/49261795/bookkeeper-server/src/test/java/org/apache/bookkeeper/client/TestLedgerChecker.java ---------------------------------------------------------------------- diff --git a/bookkeeper-server/src/test/java/org/apache/bookkeeper/client/TestLedgerChecker.java b/bookkeeper-server/src/test/java/org/apache/bookkeeper/client/TestLedgerChecker.java index eb61c21..0316b37 100644 --- a/bookkeeper-server/src/test/java/org/apache/bookkeeper/client/TestLedgerChecker.java +++ b/bookkeeper-server/src/test/java/org/apache/bookkeeper/client/TestLedgerChecker.java @@ -120,7 +120,7 @@ public class TestLedgerChecker extends BookKeeperClusterTestCase { // /we don't have any missed entries. Quorum satisfied// // /So, there should not be any missing replicas./////// // ///////////////////////////////////////////////////// - @Test(timeout = 3000) + @Test(timeout = 60000) public void testShouldNotGetTheFragmentIfThereIsNoMissedEntry() throws Exception { @@ -164,7 +164,7 @@ public class TestLedgerChecker extends BookKeeperClusterTestCase { * Tests that LedgerChecker should give two fragments when 2 bookies failed * in same ensemble when ensemble = 3, quorum = 2 */ - @Test(timeout = 3000) + @Test(timeout = 60000) public void testShouldGetTwoFrgamentsIfTwoBookiesFailedInSameEnsemble() throws Exception { @@ -198,7 +198,7 @@ public class TestLedgerChecker extends BookKeeperClusterTestCase { * Tests that LedgerChecker should not get any underReplicated fragments, if * corresponding ledger does not exists. */ - @Test(timeout = 3000) + @Test(timeout = 60000) public void testShouldNotGetAnyFragmentIfNoLedgerPresent() throws Exception { @@ -212,7 +212,20 @@ public class TestLedgerChecker extends BookKeeperClusterTestCase { startNewBookie(); lh.addEntry(TEST_LEDGER_ENTRY_DATA); bkc.deleteLedger(lh.getId()); - + LOG.info("Waiting to see ledger id {} deletion", lh.getId()); + int retries = 40; + boolean noSuchLedger = false; + while (retries > 0) { + try { + lh.readEntries(0, 0); + } catch (BKException.BKNoSuchLedgerExistsException bkn) { + noSuchLedger = true; + break; + } + retries--; + Thread.sleep(500); + } + assertEquals("Ledger exists", true, noSuchLedger); Set result = getUnderReplicatedFragments(lh); assertNotNull("Result shouldn't be null", result); @@ -224,7 +237,7 @@ public class TestLedgerChecker extends BookKeeperClusterTestCase { * Tests that LedgerChecker should get failed ensemble number of fragments * if ensemble bookie failures on next entry */ - @Test(timeout = 3000) + @Test(timeout = 60000) public void testShouldGetFailedEnsembleNumberOfFgmntsIfEnsembleBookiesFailedOnNextWrite() throws Exception { @@ -258,7 +271,7 @@ public class TestLedgerChecker extends BookKeeperClusterTestCase { * Tests that LedgerChecker should not get any fragments as underReplicated * if Ledger itself is empty */ - @Test(timeout = 3000) + @Test(timeout = 60000) public void testShouldNotGetAnyFragmentWithEmptyLedger() throws Exception { LedgerHandle lh = bkc.createLedger(3, 2, BookKeeper.DigestType.CRC32, TEST_LEDGER_PASSWORD); @@ -275,7 +288,7 @@ public class TestLedgerChecker extends BookKeeperClusterTestCase { * In this case, there'll only be two fragments, as quorum is 2 and we only * suspect that the first entry of the ledger could exist. */ - @Test(timeout = 3000) + @Test(timeout = 60000) public void testShouldGet2FragmentsWithEmptyLedgerButBookiesDead() throws Exception { LedgerHandle lh = bkc.createLedger(3, 2, BookKeeper.DigestType.CRC32, TEST_LEDGER_PASSWORD); @@ -291,7 +304,7 @@ public class TestLedgerChecker extends BookKeeperClusterTestCase { * Tests that LedgerChecker should one fragment as underReplicated * if there is an open ledger with single entry written. */ - @Test(timeout = 3000) + @Test(timeout = 60000) public void testShouldGetOneFragmentWithSingleEntryOpenedLedger() throws Exception { LedgerHandle lh = bkc.createLedger(3, 3, BookKeeper.DigestType.CRC32, TEST_LEDGER_PASSWORD); @@ -321,7 +334,7 @@ public class TestLedgerChecker extends BookKeeperClusterTestCase { * This is important, as the last add confirmed may be less than the * first entry id of the final segment. */ - @Test(timeout = 3000) + @Test(timeout = 60000) public void testSingleEntryAfterEnsembleChange() throws Exception { LedgerHandle lh = bkc.createLedger(3, 3, BookKeeper.DigestType.CRC32, TEST_LEDGER_PASSWORD); @@ -359,7 +372,7 @@ public class TestLedgerChecker extends BookKeeperClusterTestCase { * Tests that LedgerChecker does not return any fragments * from a closed ledger with 0 entries. */ - @Test(timeout = 3000) + @Test(timeout = 60000) public void testClosedEmptyLedger() throws Exception { LedgerHandle lh = bkc.createLedger(3, 3, BookKeeper.DigestType.CRC32, TEST_LEDGER_PASSWORD); @@ -386,7 +399,7 @@ public class TestLedgerChecker extends BookKeeperClusterTestCase { * Tests that LedgerChecker does not return any fragments * from a closed ledger with 0 entries. */ - @Test(timeout = 3000) + @Test(timeout = 60000) public void testClosedSingleEntryLedger() throws Exception { LedgerHandle lh = bkc.createLedger(3, 2, BookKeeper.DigestType.CRC32, TEST_LEDGER_PASSWORD);