SOLR-3815: preserve shard properties

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1387747 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Yonik Seeley 2012-09-19 20:42:04 +00:00
parent 0dfdd97579
commit 9be371a198
4 changed files with 10 additions and 13 deletions

View File

@ -300,6 +300,10 @@ Other Changes
* SOLR-3845: Rename numReplicas to replicationFactor in Collections API.
(yonik, Mark Miller)
* SOLR-3815: SolrCloud - Add properties such as "range" to shards, which changes
the clusterstate.json and puts the shard replicas under "replicas". (yonik)
================== 4.0.0-BETA ===================

View File

@ -377,7 +377,7 @@ public class Overseer {
}
return new ClusterState(state.getLiveNodes(), newStates);
}
/*
* Remove core from cloudstate
*/
@ -393,13 +393,10 @@ public class Overseer {
LinkedHashMap<String, Slice> newSlices = new LinkedHashMap<String, Slice>();
for(Slice slice: slices.values()) {
if(slice.getReplicasMap().containsKey(coreNodeName)) {
LinkedHashMap<String, Replica> newShards = new LinkedHashMap<String, Replica>();
newShards.putAll(slice.getReplicasMap());
newShards.remove(coreNodeName);
Slice newSlice = new Slice(slice.getName(), newShards);
Map<String, Replica> newReplicas = slice.getReplicasCopy();
newReplicas.remove(coreNodeName);
Slice newSlice = new Slice(slice.getName(), newReplicas, slice.getProperties());
newSlices.put(slice.getName(), newSlice);
} else {
newSlices.put(slice.getName(), slice);
}

View File

@ -45,9 +45,9 @@ public class ClusterStateTest extends SolrTestCaseJ4 {
props.put("prop2", "value2");
Replica replica = new Replica("node1", props);
sliceToProps.put("node1", replica);
Slice slice = new Slice("shard1", sliceToProps);
Slice slice = new Slice("shard1", sliceToProps, null);
slices.put("shard1", slice);
Slice slice2 = new Slice("shard2", sliceToProps);
Slice slice2 = new Slice("shard2", sliceToProps, null);
slices.put("shard2", slice2);
collectionStates.put("collection1", slices);
collectionStates.put("collection2", slices);

View File

@ -39,10 +39,6 @@ public class Slice extends ZkNodeProps {
private final Map<String,Replica> replicas;
private final Replica leader;
public Slice(String name, Map<String,Replica> replicas) {
this(name, replicas, null);
}
/**
* @param name The name of the slice
* @param replicas The replicas of the slice. This is used directly and a copy is not made. If null, replicas will be constructed from props.