Repository: bookkeeper Updated Branches: refs/heads/master e2894a9e9 -> d7f7b922f
BOOKKEEPER-1064: ConcurrentModificationException in AuditorLedgerCheckerTest As seen in: https://builds.apache.org/job/bookkeeper-master-git-pullrequest/371/ The test is iterating over a hash map that gets updated by a different thread. The map needs to be concurrent. ``` java.util.ConcurrentModificationException at org.apache.bookkeeper.replication.AuditorLedgerCheckerTest.stopAuditorElectors(AuditorLedgerCheckerTest.java:130) at org.apache.bookkeeper.replication.AuditorLedgerCheckerTest.tearDown(AuditorLedgerCheckerTest.java:114) ``` All subsequent tests in the same class are failing because of the 1st test not cleaning up properly. Author: Matteo Merli <[email protected]> Reviewers: Enrico Olivelli <[email protected]> Closes #151 from merlimat/bk-1064-auditor-ledger-test Project: http://git-wip-us.apache.org/repos/asf/bookkeeper/repo Commit: http://git-wip-us.apache.org/repos/asf/bookkeeper/commit/d7f7b922 Tree: http://git-wip-us.apache.org/repos/asf/bookkeeper/tree/d7f7b922 Diff: http://git-wip-us.apache.org/repos/asf/bookkeeper/diff/d7f7b922 Branch: refs/heads/master Commit: d7f7b922f3ea0471452115c6271fd18ab63d3505 Parents: e2894a9 Author: Matteo Merli <[email protected]> Authored: Fri May 12 15:20:31 2017 +0200 Committer: eolivelli <[email protected]> Committed: Fri May 12 15:20:31 2017 +0200 ---------------------------------------------------------------------- .../apache/bookkeeper/replication/AuditorLedgerCheckerTest.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/bookkeeper/blob/d7f7b922/bookkeeper-server/src/test/java/org/apache/bookkeeper/replication/AuditorLedgerCheckerTest.java ---------------------------------------------------------------------- diff --git a/bookkeeper-server/src/test/java/org/apache/bookkeeper/replication/AuditorLedgerCheckerTest.java b/bookkeeper-server/src/test/java/org/apache/bookkeeper/replication/AuditorLedgerCheckerTest.java index 974761e..8402c04 100644 --- a/bookkeeper-server/src/test/java/org/apache/bookkeeper/replication/AuditorLedgerCheckerTest.java +++ b/bookkeeper-server/src/test/java/org/apache/bookkeeper/replication/AuditorLedgerCheckerTest.java @@ -31,6 +31,7 @@ import java.util.List; import java.util.Map; import java.util.Random; import java.util.Set; +import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; @@ -77,7 +78,7 @@ public class AuditorLedgerCheckerTest extends MultiLedgerManagerTestCase { private final String UNDERREPLICATED_PATH = baseClientConf .getZkLedgersRootPath() + "/underreplication/ledgers"; - private HashMap<String, AuditorElector> auditorElectors = new HashMap<String, AuditorElector>(); + private Map<String, AuditorElector> auditorElectors = new ConcurrentHashMap<>(); private ZkLedgerUnderreplicationManager urLedgerMgr; private Set<Long> urLedgerList; private String electionPath; @@ -316,7 +317,7 @@ public class AuditorLedgerCheckerTest extends MultiLedgerManagerTestCase { /* * Sample data format present in the under replicated ledger path - * + * * {4=replica: "10.18.89.153:5002"} */ assertTrue("Ledger is not marked as underreplicated:" + ledgerId, urLedgerList.contains(ledgerId));
