mirror of https://github.com/apache/lucene.git
SOLR-5215: Fix possibility of deadlock in ZooKeeper ConnectionManager.
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1521236 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
9cedad9cd1
commit
19f9181c74
|
@ -101,13 +101,21 @@ New Features
|
||||||
the "ie" (input encoding) parameter, e.g. "select?q=m%FCller&ie=ISO-8859-1".
|
the "ie" (input encoding) parameter, e.g. "select?q=m%FCller&ie=ISO-8859-1".
|
||||||
The default is UTF-8. To change the encoding of POSTed content, use the
|
The default is UTF-8. To change the encoding of POSTed content, use the
|
||||||
"Content-Type" HTTP header. (Uwe Schindler, David Smiley)
|
"Content-Type" HTTP header. (Uwe Schindler, David Smiley)
|
||||||
|
|
||||||
* SOLR-4221: Custom sharding (Noble Paul)
|
* SOLR-4221: Custom sharding (Noble Paul)
|
||||||
* SOLR-4808: Persist and use router,replicationFactor and maxShardsPerNode at Collection and Shard level (Noble Paul, Shalin Mangar)
|
|
||||||
|
* SOLR-4808: Persist and use router,replicationFactor and maxShardsPerNode at Collection
|
||||||
|
and Shard level (Noble Paul, Shalin Mangar)
|
||||||
|
|
||||||
* SOLR-5006: CREATESHARD command for 'implicit' shards (Noble Paul)
|
* SOLR-5006: CREATESHARD command for 'implicit' shards (Noble Paul)
|
||||||
|
|
||||||
* SOLR-5017: Allow sharding based on the value of a field (Noble Paul)
|
* SOLR-5017: Allow sharding based on the value of a field (Noble Paul)
|
||||||
|
|
||||||
* SOLR-4222: create custom sharded collection via collections API (Noble Paul)
|
* SOLR-4222: create custom sharded collection via collections API (Noble Paul)
|
||||||
* SOLR-4718: Allow solr.xml to be stored in ZooKeeper
|
|
||||||
* SOLR-5156: Enhance ZkCLI to allow uploading of arbitrary files to ZK.
|
* SOLR-4718: Allow solr.xml to be stored in ZooKeeper. (Mark Miller, Erick Erickson)
|
||||||
|
|
||||||
|
* SOLR-5156: Enhance ZkCLI to allow uploading of arbitrary files to ZK. (Erick Erickson)
|
||||||
|
|
||||||
* SOLR-5165: Single-valued docValues fields no longer require a default value.
|
* SOLR-5165: Single-valued docValues fields no longer require a default value.
|
||||||
Additionally they work with sortMissingFirst, sortMissingLast, facet.missing,
|
Additionally they work with sortMissingFirst, sortMissingLast, facet.missing,
|
||||||
|
@ -187,6 +195,9 @@ Bug Fixes
|
||||||
* SOLR-5206: Fixed OpenExchangeRatesOrgProvider to use refreshInterval correctly
|
* SOLR-5206: Fixed OpenExchangeRatesOrgProvider to use refreshInterval correctly
|
||||||
(Catalin, hossman)
|
(Catalin, hossman)
|
||||||
|
|
||||||
|
* SOLR-5215: Fix possibility of deadlock in ZooKeeper ConnectionManager.
|
||||||
|
(Mark Miller, Ricardo Merizalde)
|
||||||
|
|
||||||
Optimizations
|
Optimizations
|
||||||
----------------------
|
----------------------
|
||||||
|
|
||||||
|
|
|
@ -38,15 +38,13 @@ class ConnectionManager implements Watcher {
|
||||||
|
|
||||||
private final ZkClientConnectionStrategy connectionStrategy;
|
private final ZkClientConnectionStrategy connectionStrategy;
|
||||||
|
|
||||||
private Object connectionUpdateLock = new Object();
|
private final String zkServerAddress;
|
||||||
|
|
||||||
private String zkServerAddress;
|
private final int zkClientTimeout;
|
||||||
|
|
||||||
private int zkClientTimeout;
|
private final SolrZkClient client;
|
||||||
|
|
||||||
private SolrZkClient client;
|
private final OnReconnect onReconnect;
|
||||||
|
|
||||||
private OnReconnect onReconnect;
|
|
||||||
|
|
||||||
private volatile boolean isClosed = false;
|
private volatile boolean isClosed = false;
|
||||||
|
|
||||||
|
@ -92,37 +90,35 @@ class ConnectionManager implements Watcher {
|
||||||
new ZkClientConnectionStrategy.ZkUpdate() {
|
new ZkClientConnectionStrategy.ZkUpdate() {
|
||||||
@Override
|
@Override
|
||||||
public void update(SolrZooKeeper keeper) {
|
public void update(SolrZooKeeper keeper) {
|
||||||
// if keeper does not replace oldKeeper we must be sure to close it
|
try {
|
||||||
synchronized (connectionUpdateLock) {
|
waitForConnected(Long.MAX_VALUE);
|
||||||
try {
|
} catch (Exception e1) {
|
||||||
waitForConnected(Long.MAX_VALUE);
|
closeKeeper(keeper);
|
||||||
} catch (Exception e1) {
|
throw new RuntimeException(e1);
|
||||||
closeKeeper(keeper);
|
}
|
||||||
throw new RuntimeException(e1);
|
|
||||||
}
|
|
||||||
log.info("Connection with ZooKeeper reestablished.");
|
|
||||||
try {
|
|
||||||
client.updateKeeper(keeper);
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
closeKeeper(keeper);
|
|
||||||
Thread.currentThread().interrupt();
|
|
||||||
// we must have been asked to stop
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
} catch(Throwable t) {
|
|
||||||
closeKeeper(keeper);
|
|
||||||
throw new RuntimeException(t);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (onReconnect != null) {
|
log.info("Connection with ZooKeeper reestablished.");
|
||||||
onReconnect.command();
|
try {
|
||||||
}
|
client.updateKeeper(keeper);
|
||||||
synchronized (ConnectionManager.this) {
|
} catch (InterruptedException e) {
|
||||||
ConnectionManager.this.connected = true;
|
closeKeeper(keeper);
|
||||||
}
|
Thread.currentThread().interrupt();
|
||||||
|
// we must have been asked to stop
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
} catch (Throwable t) {
|
||||||
|
closeKeeper(keeper);
|
||||||
|
throw new RuntimeException(t);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (onReconnect != null) {
|
||||||
|
onReconnect.command();
|
||||||
|
}
|
||||||
|
|
||||||
|
synchronized (ConnectionManager.this) {
|
||||||
|
ConnectionManager.this.connected = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
SolrException.log(log, "", e);
|
SolrException.log(log, "", e);
|
||||||
|
|
Loading…
Reference in New Issue