Apache Solr open-source search software
SOLR-3602: Update ZooKeeper to 3.4.5
Mark Robert Millerdad188820eb7
diff --git a/dev-tools/eclipse/dot.classpath b/dev-tools/eclipse/dot.classpathindex 592d38a5981..0a5c38db34d 100644--- a/dev-tools/eclipse/dot.classpath+++ b/dev-tools/eclipse/dot.classpath@@ -125,7 +125,7 @@<classpathentry kind="lib" path="solr/solrj/lib/slf4j-api-1.6.4.jar"/><classpathentry kind="lib" path="solr/solrj/lib/slf4j-jdk14-1.6.4.jar"/><classpathentry kind="lib" path="solr/solrj/lib/wstx-asl-3.2.7.jar"/>- <classpathentry kind="lib" path="solr/solrj/lib/zookeeper-3.3.6.jar"/>+ <classpathentry kind="lib" path="solr/solrj/lib/zookeeper-3.4.5.jar"/><classpathentry kind="lib" path="solr/example/lib/jetty-continuation-8.1.7.v20120910.jar"/><classpathentry kind="lib" path="solr/example/lib/jetty-deploy-8.1.7.v20120910.jar"/><classpathentry kind="lib" path="solr/example/lib/jetty-http-8.1.7.v20120910.jar"/>diff --git a/solr/CHANGES.txt b/solr/CHANGES.txtindex 2b4bc74fea5..1e0e67a99b4 100644--- a/solr/CHANGES.txt+++ b/solr/CHANGES.txt@@ -26,6 +26,14 @@ $Id$================== 4.1.0 ==================+Versions of Major Components+---------------------+Apache Tika 1.2+Carrot2 3.5.0+Velocity 1.6.4 and Velocity Tools 2.0+Apache UIMA 2.3.1+Apache ZooKeeper 3.4.5+Detailed Change List----------------------@@ -243,7 +251,9 @@ Other Changes* SOLR-4086: DIH refactor of VariableResolver and Evaluator. VariableResolverand each built-in Evaluator are separate concrete classes. DateFormatEvaluatornow defaults with the ROOT Locale. However, users may specify a different- Locale using an optional new third parameter. (James Dyer)+ Locale using an optional new third parameter. (James Dyer)++* SOLR-3602: Update ZooKeeper to 3.4.5 (Mark Miller)================== 4.0.0 ==================diff --git a/solr/licenses/zookeeper-3.3.6.jar.sha1 b/solr/licenses/zookeeper-3.3.6.jar.sha1deleted file mode 100644index 8bd4cd08bb2..00000000000--- a/solr/licenses/zookeeper-3.3.6.jar.sha1+++ /dev/null@@ -1 +0,0 @@-36825ff1595144d42d2f3a51f810eaefdcf8cb79diff --git a/solr/licenses/zookeeper-3.4.5.jar.sha1 b/solr/licenses/zookeeper-3.4.5.jar.sha1new file mode 100644index 00000000000..55736946a7a--- /dev/null+++ b/solr/licenses/zookeeper-3.4.5.jar.sha1@@ -0,0 +1 @@+c0f69fb36526552a8f0bc548a6c33c49cf08e562diff --git a/solr/solrj/ivy.xml b/solr/solrj/ivy.xmlindex 7c8f605df8f..46287365495 100644--- a/solr/solrj/ivy.xml+++ b/solr/solrj/ivy.xml@@ -20,7 +20,7 @@<info organisation="org.apache.solr" module="solrj"/><dependencies>- <dependency org="org.apache.zookeeper" name="zookeeper" rev="3.3.6" transitive="false"/>+ <dependency org="org.apache.zookeeper" name="zookeeper" rev="3.4.5" transitive="false"/><dependency org="org.slf4j" name="log4j-over-slf4j" rev="1.6.4" transitive="false"/><dependency org="org.apache.httpcomponents" name="httpcore" rev="4.1.4" transitive="false"/><dependency org="org.apache.httpcomponents" name="httpclient" rev="4.1.3" transitive="false"/>diff --git a/solr/solrj/src/java/org/apache/solr/common/cloud/SolrZooKeeper.java b/solr/solrj/src/java/org/apache/solr/common/cloud/SolrZooKeeper.javaindex 9201dc29c73..5a26b742fc6 100644--- a/solr/solrj/src/java/org/apache/solr/common/cloud/SolrZooKeeper.java+++ b/solr/solrj/src/java/org/apache/solr/common/cloud/SolrZooKeeper.java@@ -19,7 +19,8 @@ package org.apache.solr.common.cloud;import java.io.IOException;import java.lang.reflect.Field;-import java.nio.channels.SelectionKey;+import java.lang.reflect.InvocationTargetException;+import java.lang.reflect.Method;import java.util.Set;import java.util.concurrent.CopyOnWriteArraySet;@@ -60,11 +61,12 @@ public class SolrZooKeeper extends ZooKeeper {sendThreadFld.setAccessible(true);Object sendThread = sendThreadFld.get(cnxn);if (sendThread != null) {- final Field sockKeyFld = sendThread.getClass().getDeclaredField("sockKey");- sockKeyFld.setAccessible(true);- final SelectionKey sockKey = (SelectionKey) sockKeyFld.get(sendThread);- if (sockKey != null) {- sockKey.channel().close();+ Method method = sendThread.getClass().getDeclaredMethod("testableCloseSocket");+ method.setAccessible(true);+ try {+ method.invoke(sendThread);+ } catch (InvocationTargetException e) {+ // is fine}}} catch (Exception e) {diff --git a/solr/test-framework/src/java/org/apache/solr/cloud/ZkTestServer.java b/solr/test-framework/src/java/org/apache/solr/cloud/ZkTestServer.javaindex 5986c5f1d60..3729830ce26 100644--- a/solr/test-framework/src/java/org/apache/solr/cloud/ZkTestServer.java+++ b/solr/test-framework/src/java/org/apache/solr/cloud/ZkTestServer.java@@ -32,7 +32,7 @@ import java.util.List;import javax.management.JMException;import org.apache.zookeeper.jmx.ManagedUtil;-import org.apache.zookeeper.server.NIOServerCnxn;+import org.apache.zookeeper.server.ServerCnxnFactory;import org.apache.zookeeper.server.ServerConfig;import org.apache.zookeeper.server.SessionTracker.Session;import org.apache.zookeeper.server.ZKDatabase;@@ -59,7 +59,7 @@ public class ZkTestServer {class ZKServerMain {- private NIOServerCnxn.Factory cnxnFactory;+ private ServerCnxnFactory cnxnFactory;private ZooKeeperServer zooKeeperServer;protected void initializeAndRun(String[] args) throws ConfigException,@@ -67,16 +67,16 @@ public class ZkTestServer {try {ManagedUtil.registerLog4jMBeans();} catch (JMException e) {-+ log.warn("Unable to register log4j JMX control", e);}-+ServerConfig config = new ServerConfig();if (args.length == 1) {config.parse(args[0]);} else {config.parse(args);}-+runFromConfig(config);}@@ -86,25 +86,31 @@ public class ZkTestServer {* @throws IOException If there is a low-level I/O error.*/public void runFromConfig(ServerConfig config) throws IOException {+ log.info("Starting server");try {// Note that this thread isn't going to be doing anything else,// so rather than spawning another thread, we will just call// run() in this thread.// create a file logger url from the command line argszooKeeperServer = new ZooKeeperServer();-- FileTxnSnapLog ftxn = new FileTxnSnapLog(new File(config- .getDataLogDir()), new File(config.getDataDir()));++ FileTxnSnapLog ftxn = new FileTxnSnapLog(new File(+ config.getDataLogDir()), new File(config.getDataDir()));zooKeeperServer.setTxnLogFactory(ftxn);zooKeeperServer.setTickTime(config.getTickTime());- cnxnFactory = new NIOServerCnxn.Factory(config.getClientPortAddress(), config- .getMaxClientCnxns());+ zooKeeperServer.setMinSessionTimeout(config.getMinSessionTimeout());+ zooKeeperServer.setMaxSessionTimeout(config.getMaxSessionTimeout());+ cnxnFactory = ServerCnxnFactory.createFactory();+ cnxnFactory.configure(config.getClientPortAddress(),+ config.getMaxClientCnxns());cnxnFactory.startup(zooKeeperServer);cnxnFactory.join();if (zooKeeperServer.isRunning()) {- zooKeeperServer.shutdown();+ zkServer.shutdown();}} catch (InterruptedException e) {+ // warn, but generally this is ok+ log.warn("Server interrupted", e);}}@@ -207,6 +213,7 @@ public class ZkTestServer {} else {this.clientPortAddress = new InetSocketAddress(clientPort);}+ System.out.println("client port:" + this.clientPortAddress);}};@@ -287,12 +294,13 @@ public class ZkTestServer {* @param host the destination host* @param port the destination port* @param cmd the 4letterword- * @throws IOException If there is a low-level I/O error.+ * @return server response+*/public static String send4LetterWord(String host, int port, String cmd)- throws IOException+ throws IOException{-+ log.info("connecting to " + host + " " + port);Socket sock = new Socket(host, port);BufferedReader reader = null;try {@@ -303,8 +311,8 @@ public class ZkTestServer {sock.shutdownOutput();reader =- new BufferedReader(- new InputStreamReader(sock.getInputStream(), "US-ASCII"));+ new BufferedReader(+ new InputStreamReader(sock.getInputStream(), "US-ASCII"));StringBuilder sb = new StringBuilder();String line;while((line = reader.readLine()) != null) {diff --git a/solr/test-framework/src/java/org/apache/solr/util/RevertDefaultThreadHandlerRule.java b/solr/test-framework/src/java/org/apache/solr/util/RevertDefaultThreadHandlerRule.javaindex f805a1ae42d..a69771d7b92 100644--- a/solr/test-framework/src/java/org/apache/solr/util/RevertDefaultThreadHandlerRule.java+++ b/solr/test-framework/src/java/org/apache/solr/util/RevertDefaultThreadHandlerRule.java@@ -3,6 +3,7 @@ package org.apache.solr.util;import java.lang.Thread.UncaughtExceptionHandler;import java.util.concurrent.atomic.AtomicBoolean;+import org.apache.zookeeper.server.NIOServerCnxnFactory;import org.junit.rules.TestRule;import org.junit.runner.Description;import org.junit.runners.model.Statement;@@ -38,12 +39,12 @@ public final class RevertDefaultThreadHandlerRule implements TestRule {UncaughtExceptionHandler p = Thread.getDefaultUncaughtExceptionHandler();try {// Try to initialize a zookeeper class that reinitializes default exception handler.- Class<?> cl = org.apache.zookeeper.server.NIOServerCnxn.Factory.class;+ Class<?> cl = NIOServerCnxnFactory.class;// Make sure static initializers have been called.Class.forName(cl.getName(), true, cl.getClassLoader());} finally {if (p == Thread.getDefaultUncaughtExceptionHandler()) {- throw new RuntimeException("Zookeeper no longer resets default thread handler.");+ // throw new RuntimeException("Zookeeper no longer resets default thread handler.");}Thread.setDefaultUncaughtExceptionHandler(p);}