zookeeper-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From si...@apache.org
Subject svn commit: r1496706 - in /zookeeper/bookkeeper/trunk: ./ bookkeeper-server/src/main/java/org/apache/bookkeeper/client/ bookkeeper-server/src/test/java/org/apache/bookkeeper/client/
Date Wed, 26 Jun 2013 01:35:18 GMT
Author: sijie
Date: Wed Jun 26 01:35:18 2013
New Revision: 1496706

URL: http://svn.apache.org/r1496706
Log:
BOOKKEEPER-633: ConcurrentModificationException in RackawareEnsemblePlacementPolicy when a
bookie is removed from available list (vinay via sijie)

Modified:
    zookeeper/bookkeeper/trunk/CHANGES.txt
    zookeeper/bookkeeper/trunk/bookkeeper-server/src/main/java/org/apache/bookkeeper/client/RackawareEnsemblePlacementPolicy.java
    zookeeper/bookkeeper/trunk/bookkeeper-server/src/test/java/org/apache/bookkeeper/client/TestRackawareEnsemblePlacementPolicy.java

Modified: zookeeper/bookkeeper/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/zookeeper/bookkeeper/trunk/CHANGES.txt?rev=1496706&r1=1496705&r2=1496706&view=diff
==============================================================================
--- zookeeper/bookkeeper/trunk/CHANGES.txt (original)
+++ zookeeper/bookkeeper/trunk/CHANGES.txt Wed Jun 26 01:35:18 2013
@@ -60,6 +60,8 @@ Trunk (unreleased changes)
 
         BOOKKEEPER-623: LedgerChecker should avoid segments of closed ledger with higher
start entryId than closed entry. (vinay via sijie)
 
+        BOOKKEEPER-633: ConcurrentModificationException in RackawareEnsemblePlacementPolicy
when a bookie is removed from available list (vinay via sijie)
+
       hedwig-client:
 
         BOOKKEEPER-598: Fails to compile - RESUBSCRIBE_EXCEPTION conflict (Matthew Farrellee
via sijie)

Modified: zookeeper/bookkeeper/trunk/bookkeeper-server/src/main/java/org/apache/bookkeeper/client/RackawareEnsemblePlacementPolicy.java
URL: http://svn.apache.org/viewvc/zookeeper/bookkeeper/trunk/bookkeeper-server/src/main/java/org/apache/bookkeeper/client/RackawareEnsemblePlacementPolicy.java?rev=1496706&r1=1496705&r2=1496706&view=diff
==============================================================================
--- zookeeper/bookkeeper/trunk/bookkeeper-server/src/main/java/org/apache/bookkeeper/client/RackawareEnsemblePlacementPolicy.java
(original)
+++ zookeeper/bookkeeper/trunk/bookkeeper-server/src/main/java/org/apache/bookkeeper/client/RackawareEnsemblePlacementPolicy.java
Wed Jun 26 01:35:18 2013
@@ -43,6 +43,7 @@ import org.apache.commons.configuration.
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import com.google.common.collect.ImmutableSet;
 import com.google.common.collect.Sets;
 
 /**
@@ -362,14 +363,14 @@ public class RackawareEnsemblePlacementP
             Set<InetSocketAddress> readOnlyBookies) {
         rwLock.writeLock().lock();
         try {
-            Set<InetSocketAddress> joinedBookies, leftBookies, deadBookies;
+            ImmutableSet<InetSocketAddress> joinedBookies, leftBookies, deadBookies;
             Set<InetSocketAddress> oldBookieSet = knownBookies.keySet();
             // left bookies : bookies in known bookies, but not in new writable bookie cluster.
-            leftBookies = Sets.difference(oldBookieSet, writableBookies);
+            leftBookies = Sets.difference(oldBookieSet, writableBookies).immutableCopy();
             // joined bookies : bookies in new writable bookie cluster, but not in known
bookies
-            joinedBookies = Sets.difference(writableBookies, oldBookieSet);
+            joinedBookies = Sets.difference(writableBookies, oldBookieSet).immutableCopy();
             // dead bookies.
-            deadBookies = Sets.difference(leftBookies, readOnlyBookies);
+            deadBookies = Sets.difference(leftBookies, readOnlyBookies).immutableCopy();
             if (LOG.isDebugEnabled()) {
                 LOG.debug(
                         "Cluster changed : left bookies are {}, joined bookies are {}, while
dead bookies are {}.",

Modified: zookeeper/bookkeeper/trunk/bookkeeper-server/src/test/java/org/apache/bookkeeper/client/TestRackawareEnsemblePlacementPolicy.java
URL: http://svn.apache.org/viewvc/zookeeper/bookkeeper/trunk/bookkeeper-server/src/test/java/org/apache/bookkeeper/client/TestRackawareEnsemblePlacementPolicy.java?rev=1496706&r1=1496705&r2=1496706&view=diff
==============================================================================
--- zookeeper/bookkeeper/trunk/bookkeeper-server/src/test/java/org/apache/bookkeeper/client/TestRackawareEnsemblePlacementPolicy.java
(original)
+++ zookeeper/bookkeeper/trunk/bookkeeper-server/src/test/java/org/apache/bookkeeper/client/TestRackawareEnsemblePlacementPolicy.java
Wed Jun 26 01:35:18 2013
@@ -236,6 +236,31 @@ public class TestRackawareEnsemblePlacem
         }
     }
 
+    /**
+     * Test for BOOKKEEPER-633
+     */
+    @Test
+    public void testRemoveBookieFromCluster() {
+        InetSocketAddress addr1 = new InetSocketAddress("127.0.0.1", 3181);
+        InetSocketAddress addr2 = new InetSocketAddress("127.0.0.2", 3181);
+        InetSocketAddress addr3 = new InetSocketAddress("127.0.0.3", 3181);
+        InetSocketAddress addr4 = new InetSocketAddress("127.0.0.4", 3181);
+        // update dns mapping
+        StaticDNSResolver.addNodeToRack(addr1.getAddress().getHostAddress(), NetworkTopology.DEFAULT_RACK);
+        StaticDNSResolver.addNodeToRack(addr2.getAddress().getHostAddress(), "/r2");
+        StaticDNSResolver.addNodeToRack(addr3.getAddress().getHostAddress(), "/r2");
+        StaticDNSResolver.addNodeToRack(addr4.getAddress().getHostAddress(), "/r3");
+        // Update cluster
+        Set<InetSocketAddress> addrs = new HashSet<InetSocketAddress>();
+        addrs.add(addr1);
+        addrs.add(addr2);
+        addrs.add(addr3);
+        addrs.add(addr4);
+        repp.onClusterChanged(addrs, new HashSet<InetSocketAddress>());
+        addrs.remove(addr1);
+        repp.onClusterChanged(addrs, new HashSet<InetSocketAddress>());
+    }
+
     private int getNumCoveredWriteQuorums(ArrayList<InetSocketAddress> ensemble, int
writeQuorumSize)
             throws Exception {
         int ensembleSize = ensemble.size();



Mime
View raw message