SOLR-3602: Update ZooKeeper to 3.4.5

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1411527 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Mark Robert Miller 2012-11-20 03:36:14 +00:00
parent e4aa1e392a
commit dad188820e
8 changed files with 49 additions and 28 deletions

View File

@ -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"/>

View File

@ -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. VariableResolver
and each built-in Evaluator are separate concrete classes. DateFormatEvaluator
now 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 ==================

View File

@ -1 +0,0 @@
36825ff1595144d42d2f3a51f810eaefdcf8cb79

View File

@ -0,0 +1 @@
c0f69fb36526552a8f0bc548a6c33c49cf08e562

View File

@ -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"/>

View File

@ -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) {

View File

@ -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 args
zooKeeperServer = 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) {

View File

@ -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);
}