SOLR-9386: Upgrade Zookeeper to 3.4.10

This commit is contained in:
Steve Rowe 2017-04-28 11:24:53 -04:00
parent 929126a489
commit 57f17b1118
7 changed files with 29 additions and 155 deletions

View File

@ -186,7 +186,7 @@ org.apache.uima.version = 2.3.1
/org.apache.velocity/velocity = 1.7 /org.apache.velocity/velocity = 1.7
/org.apache.velocity/velocity-tools = 2.0 /org.apache.velocity/velocity-tools = 2.0
/org.apache.xmlbeans/xmlbeans = 2.6.0 /org.apache.xmlbeans/xmlbeans = 2.6.0
/org.apache.zookeeper/zookeeper = 3.4.6 /org.apache.zookeeper/zookeeper = 3.4.10
/org.aspectj/aspectjrt = 1.8.0 /org.aspectj/aspectjrt = 1.8.0
org.bouncycastle.version = 1.45 org.bouncycastle.version = 1.45

View File

@ -139,7 +139,7 @@ Apache Tika 1.13
Carrot2 3.15.0 Carrot2 3.15.0
Velocity 1.7 and Velocity Tools 2.0 Velocity 1.7 and Velocity Tools 2.0
Apache UIMA 2.3.1 Apache UIMA 2.3.1
Apache ZooKeeper 3.4.6 Apache ZooKeeper 3.4.10
Jetty 9.3.14.v20161028 Jetty 9.3.14.v20161028
Upgrade Notes Upgrade Notes
@ -150,6 +150,7 @@ Upgrade Notes
* JSON Facet API now uses hyper-log-log for numBuckets cardinality calculation and * JSON Facet API now uses hyper-log-log for numBuckets cardinality calculation and
calculates cardinality before filtering buckets by any mincount greater than 1. calculates cardinality before filtering buckets by any mincount greater than 1.
* ZooKeeper dependency has been upgraded from 3.4.6 to 3.4.10.
Detailed Change List Detailed Change List
---------------------- ----------------------
@ -311,6 +312,8 @@ Other Changes
* SOLR-10514: Upgrade Metrics library to 3.2.2. (ab) * SOLR-10514: Upgrade Metrics library to 3.2.2. (ab)
* SOLR-9386: Upgrade Zookeeper to 3.4.10. (Shawn Heisey, Steve Rowe)
================== 6.5.1 ================== ================== 6.5.1 ==================
Bug Fixes Bug Fixes

View File

@ -22,12 +22,9 @@ import org.apache.zookeeper.server.ZooKeeperServerMain;
import org.apache.zookeeper.server.quorum.QuorumPeer; import org.apache.zookeeper.server.quorum.QuorumPeer;
import org.apache.zookeeper.server.quorum.QuorumPeerConfig; import org.apache.zookeeper.server.quorum.QuorumPeerConfig;
import org.apache.zookeeper.server.quorum.QuorumPeerMain; import org.apache.zookeeper.server.quorum.QuorumPeerMain;
import org.apache.zookeeper.server.quorum.flexible.QuorumHierarchical;
import org.apache.zookeeper.server.quorum.flexible.QuorumMaj;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import java.io.BufferedReader;
import java.io.File; import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.IOException; import java.io.IOException;
@ -38,8 +35,8 @@ import java.net.InetSocketAddress;
import java.net.UnknownHostException; import java.net.UnknownHostException;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.util.Map; import java.util.Map;
import java.util.Map.Entry;
import java.util.Properties; import java.util.Properties;
import java.util.regex.Pattern;
public class SolrZkServer { public class SolrZkServer {
@ -154,6 +151,7 @@ public class SolrZkServer {
// zoo.cfg (which validates that there is a dataDir) // zoo.cfg (which validates that there is a dataDir)
class SolrZkServerProps extends QuorumPeerConfig { class SolrZkServerProps extends QuorumPeerConfig {
private static final Logger LOG = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); private static final Logger LOG = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
private static final Pattern MISSING_MYID_FILE_PATTERN = Pattern.compile(".*myid file is missing$");
String solrPort; // port that Solr is listening on String solrPort; // port that Solr is listening on
String zkRun; String zkRun;
@ -312,8 +310,6 @@ class SolrZkServerProps extends QuorumPeerConfig {
} }
} }
// NOTE: copied from ZooKeeper 3.2
/** /**
* Parse config from a Properties. * Parse config from a Properties.
* @param zkProp Properties to parse from. * @param zkProp Properties to parse from.
@ -321,157 +317,18 @@ class SolrZkServerProps extends QuorumPeerConfig {
@Override @Override
public void parseProperties(Properties zkProp) public void parseProperties(Properties zkProp)
throws IOException, ConfigException { throws IOException, ConfigException {
for (Entry<Object, Object> entry : zkProp.entrySet()) { try {
String key = entry.getKey().toString().trim(); super.parseProperties(zkProp);
String value = entry.getValue().toString().trim(); } catch (IllegalArgumentException e) {
if (key.equals("dataDir")) { if (MISSING_MYID_FILE_PATTERN.matcher(e.getMessage()).matches()) {
dataDir = value;
} else if (key.equals("dataLogDir")) {
dataLogDir = value;
} else if (key.equals("clientPort")) {
setClientPort(Integer.parseInt(value));
} else if (key.equals("tickTime")) {
tickTime = Integer.parseInt(value);
} else if (key.equals("initLimit")) {
initLimit = Integer.parseInt(value);
} else if (key.equals("syncLimit")) {
syncLimit = Integer.parseInt(value);
} else if (key.equals("electionAlg")) {
electionAlg = Integer.parseInt(value);
} else if (key.equals("maxClientCnxns")) {
maxClientCnxns = Integer.parseInt(value);
} else if (key.startsWith("server.")) {
int dot = key.indexOf('.');
long sid = Long.parseLong(key.substring(dot + 1));
String parts[] = value.split(":");
if ((parts.length != 2) && (parts.length != 3)) {
LOG.error(value
+ " does not have the form host:port or host:port:port");
}
InetSocketAddress addr = new InetSocketAddress(parts[0],
Integer.parseInt(parts[1]));
if (parts.length == 2) {
servers.put(Long.valueOf(sid), new QuorumPeer.QuorumServer(sid, addr));
} else if (parts.length == 3) {
InetSocketAddress electionAddr = new InetSocketAddress(
parts[0], Integer.parseInt(parts[2]));
servers.put(Long.valueOf(sid), new QuorumPeer.QuorumServer(sid, addr,
electionAddr));
}
} else if (key.startsWith("group")) {
int dot = key.indexOf('.');
long gid = Long.parseLong(key.substring(dot + 1));
numGroups++;
String parts[] = value.split(":");
for(String s : parts){
long sid = Long.parseLong(s);
if(serverGroup.containsKey(sid))
throw new ConfigException("Server " + sid + "is in multiple groups");
else
serverGroup.put(sid, gid);
}
} else if(key.startsWith("weight")) {
int dot = key.indexOf('.');
long sid = Long.parseLong(key.substring(dot + 1));
serverWeight.put(sid, Long.parseLong(value));
} else {
System.setProperty("zookeeper." + key, value);
}
}
if (dataDir == null) {
throw new IllegalArgumentException("dataDir is not set");
}
if (dataLogDir == null) {
dataLogDir = dataDir;
} else {
if (!new File(dataLogDir).isDirectory()) {
throw new IllegalArgumentException("dataLogDir " + dataLogDir
+ " is missing.");
}
}
if (tickTime == 0) {
throw new IllegalArgumentException("tickTime is not set");
}
if (servers.size() > 1) {
if (initLimit == 0) {
throw new IllegalArgumentException("initLimit is not set");
}
if (syncLimit == 0) {
throw new IllegalArgumentException("syncLimit is not set");
}
/*
* If using FLE, then every server requires a separate election
* port.
*/
if (electionAlg != 0) {
for (QuorumPeer.QuorumServer s : servers.values()) {
if (s.electionAddr == null)
throw new IllegalArgumentException(
"Missing election port for server: " + s.id);
}
}
/*
* Default of quorum config is majority
*/
if(serverGroup.size() > 0){
if(servers.size() != serverGroup.size())
throw new ConfigException("Every server must be in exactly one group");
/*
* The deafult weight of a server is 1
*/
for(QuorumPeer.QuorumServer s : servers.values()){
if(!serverWeight.containsKey(s.id))
serverWeight.put(s.id, (long) 1);
}
/*
* Set the quorumVerifier to be QuorumHierarchical
*/
quorumVerifier = new QuorumHierarchical(numGroups,
serverWeight, serverGroup);
} else {
/*
* The default QuorumVerifier is QuorumMaj
*/
LOG.info("Defaulting to majority quorums");
quorumVerifier = new QuorumMaj(servers.size());
}
File myIdFile = new File(dataDir, "myid");
if (!myIdFile.exists()) {
///////////////// ADDED FOR SOLR //////
Long myid = getMyServerId(); Long myid = getMyServerId();
if (myid != null) { if (myid != null) {
serverId = myid; serverId = myid;
return; return;
} }
if (zkRun == null) return; if (zkRun == null) return;
//////////////// END ADDED FOR SOLR //////
throw new IllegalArgumentException(myIdFile.toString()
+ " file is missing");
} }
throw e;
BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(myIdFile), StandardCharsets.UTF_8));
String myIdString;
try {
myIdString = br.readLine();
} finally {
br.close();
}
try {
serverId = Long.parseLong(myIdString);
} catch (NumberFormatException e) {
throw new IllegalArgumentException("serverid " + myIdString
+ " is not a number");
} }
} }
}
} }

View File

@ -290,8 +290,8 @@ public class TestConfigSetsAPIZkFailure extends SolrTestCaseJ4 {
} }
@Override @Override
public List<ACL> convertLong(Long aclL) { public List<ACL> aclForNode(DataNode n) {
return zkdb.convertLong(aclL); return zkdb.aclForNode(n);
} }
@Override @Override

View File

@ -0,0 +1 @@
08eebdbb7a9df83e02eaa42d0e5da0b57bf2e4da

View File

@ -1 +0,0 @@
01b2502e29da1ebaade2357cd1de35a855fa3755

View File

@ -15,3 +15,17 @@ syncLimit=5
# clientPort=2181 # clientPort=2181
# NOTE: Solr sets this based on zkRun / zkHost params # NOTE: Solr sets this based on zkRun / zkHost params
# the maximum number of client connections.
# increase this if you need to handle more clients
#maxClientCnxns=60
#
# Be sure to read the maintenance section of the
# administrator guide before turning on autopurge.
#
# http://zookeeper.apache.org/doc/current/zookeeperAdmin.html#sc_maintenance
#
# The number of snapshots to retain in dataDir
#autopurge.snapRetainCount=3
# Purge task interval in hours
# Set to "0" to disable auto purge feature
#autopurge.purgeInterval=1