mirror of https://github.com/apache/lucene.git
SOLR-4055: Fix a thread safety issue with the Collections API that could cause actions to be targeted at the wrong SolrCores.
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1408125 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
3c4c55aad1
commit
99c4749d1a
|
@ -159,6 +159,10 @@ Bug Fixes
|
|||
after shutdown has already occurred, leaving an IndexWriter that is not closed.
|
||||
(Mark Miller)
|
||||
|
||||
* SOLR-4055: Fix a thread safety issue with the Collections API that could
|
||||
cause actions to be targeted at the wrong SolrCores.
|
||||
(Raintung Li via Mark Miller)
|
||||
|
||||
Other Changes
|
||||
----------------------
|
||||
|
||||
|
|
|
@ -262,21 +262,24 @@ public class OverseerCollectionProcessor implements Runnable {
|
|||
for (Map.Entry<String,Replica> shardEntry : shardEntries) {
|
||||
final ZkNodeProps node = shardEntry.getValue();
|
||||
if (clusterState.liveNodesContain(node.getStr(ZkStateReader.NODE_NAME_PROP))) {
|
||||
params.set(CoreAdminParams.CORE, node.getStr(ZkStateReader.CORE_NAME_PROP));
|
||||
|
||||
String replica = node.getStr(ZkStateReader.BASE_URL_PROP);
|
||||
ShardRequest sreq = new ShardRequest();
|
||||
// yes, they must use same admin handler path everywhere...
|
||||
params.set("qt", adminPath);
|
||||
|
||||
sreq.purpose = 1;
|
||||
// TODO: this sucks
|
||||
if (replica.startsWith("http://")) replica = replica.substring(7);
|
||||
sreq.shards = new String[] {replica};
|
||||
sreq.actualShards = sreq.shards;
|
||||
sreq.params = params;
|
||||
log.info("Collection Admin sending CoreAdmin cmd to " + replica);
|
||||
shardHandler.submit(sreq, replica, sreq.params);
|
||||
//For thread safety, only simple clone the ModifiableSolrParams
|
||||
ModifiableSolrParams cloneParams = new ModifiableSolrParams();
|
||||
cloneParams.add(params);
|
||||
cloneParams.set(CoreAdminParams.CORE, node.getStr(ZkStateReader.CORE_NAME_PROP));
|
||||
|
||||
String replica = node.getStr(ZkStateReader.BASE_URL_PROP);
|
||||
ShardRequest sreq = new ShardRequest();
|
||||
|
||||
// yes, they must use same admin handler path everywhere...
|
||||
cloneParams.set("qt", adminPath);
|
||||
sreq.purpose = 1;
|
||||
// TODO: this sucks
|
||||
if (replica.startsWith("http://")) replica = replica.substring(7);
|
||||
sreq.shards = new String[] {replica};
|
||||
sreq.actualShards = sreq.shards;
|
||||
sreq.params = cloneParams;
|
||||
log.info("Collection Admin sending CoreAdmin cmd to " + replica + " params:" + sreq.params);
|
||||
shardHandler.submit(sreq, replica, sreq.params);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue