You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by er...@apache.org on 2014/10/02 21:36:26 UTC
svn commit: r1629053 - in /lucene/dev/branches/branch_5x: ./ solr/
solr/core/ solr/core/src/java/org/apache/solr/cloud/
solr/core/src/java/org/apache/solr/handler/admin/
solr/core/src/test/org/apache/solr/cloud/
Author: erick
Date: Thu Oct 2 19:36:26 2014
New Revision: 1629053
URL: http://svn.apache.org/r1629053
Log:
SOLR-6577: The ability to add or change arbitrary replica properties must not allow the system properties to be changed
Modified:
lucene/dev/branches/branch_5x/ (props changed)
lucene/dev/branches/branch_5x/solr/ (props changed)
lucene/dev/branches/branch_5x/solr/core/ (props changed)
lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/cloud/Overseer.java
lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/handler/admin/CollectionsHandler.java
lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/cloud/TestCollectionAPI.java
Modified: lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/cloud/Overseer.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/cloud/Overseer.java?rev=1629053&r1=1629052&r2=1629053&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/cloud/Overseer.java (original)
+++ lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/cloud/Overseer.java Thu Oct 2 19:36:26 2014
@@ -123,7 +123,7 @@ public class Overseer implements Closeab
static enum LeaderStatus {DONT_KNOW, NO, YES}
- public static final Set<String> sliceUniqueBooleanProperties = ImmutableSet.of("preferredleader");
+ public static final Set<String> sliceUniqueBooleanProperties = ImmutableSet.of("property.preferredleader");
private long lastUpdatedTime = 0;
@@ -532,6 +532,9 @@ public class Overseer implements Closeab
String sliceName = message.getStr(ZkStateReader.SHARD_ID_PROP);
String replicaName = message.getStr(ZkStateReader.REPLICA_PROP);
String property = message.getStr(ZkStateReader.PROPERTY_PROP).toLowerCase(Locale.ROOT);
+ if (property.startsWith(OverseerCollectionProcessor.COLL_PROP_PREFIX) == false) {
+ property = OverseerCollectionProcessor.COLL_PROP_PREFIX + property;
+ }
String propVal = message.getStr(ZkStateReader.PROPERTY_VALUE_PROP);
String sliceUnique = message.getStr(OverseerCollectionProcessor.SLICE_UNIQUE);
@@ -590,6 +593,9 @@ public class Overseer implements Closeab
String sliceName = message.getStr(ZkStateReader.SHARD_ID_PROP);
String replicaName = message.getStr(ZkStateReader.REPLICA_PROP);
String property = message.getStr(ZkStateReader.PROPERTY_PROP).toLowerCase(Locale.ROOT);
+ if (property.startsWith(OverseerCollectionProcessor.COLL_PROP_PREFIX) == false) {
+ property = OverseerCollectionProcessor.COLL_PROP_PREFIX + property;
+ }
Replica replica = clusterState.getReplica(collectionName, replicaName);
Modified: lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/handler/admin/CollectionsHandler.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/handler/admin/CollectionsHandler.java?rev=1629053&r1=1629052&r2=1629053&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/handler/admin/CollectionsHandler.java (original)
+++ lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/handler/admin/CollectionsHandler.java Thu Oct 2 19:36:26 2014
@@ -264,6 +264,10 @@ public class CollectionsHandler extends
SLICE_UNIQUE, PROPERTY_VALUE_PROP);
String property = (String) map.get(PROPERTY_PROP);
+ if (property.startsWith(OverseerCollectionProcessor.COLL_PROP_PREFIX) == false) {
+ property = OverseerCollectionProcessor.COLL_PROP_PREFIX + property;
+ }
+
boolean uniquePerSlice = Boolean.parseBoolean((String) map.get(SLICE_UNIQUE));
// Check if we're trying to set a property with parameters that allow us to set the property on multiple replicas
Modified: lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/cloud/TestCollectionAPI.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/cloud/TestCollectionAPI.java?rev=1629053&r1=1629052&r2=1629053&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/cloud/TestCollectionAPI.java (original)
+++ lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/cloud/TestCollectionAPI.java Thu Oct 2 19:36:26 2014
@@ -40,6 +40,7 @@ import static org.apache.solr.cloud.Over
import java.io.IOException;
import java.util.ArrayList;
+import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
@@ -336,10 +337,10 @@ public class TestCollectionAPI extends A
client.request(request);
// The above should have set exactly one preferredleader...
- verifyPropertyVal(client, COLLECTION_NAME, c1_s1_r1, "preferredleader", "true");
- verifyPropertyNotPresent(client, COLLECTION_NAME, c1_s1_r2, "preferredLeader");
- verifyPropertyNotPresent(client, COLLECTION_NAME, c1_s2_r1, "preferredLeader");
- verifyPropertyNotPresent(client, COLLECTION_NAME, c1_s2_r2, "preferredLeader");
+ verifyPropertyVal(client, COLLECTION_NAME, c1_s1_r1, "property.preferredleader", "true");
+ verifyPropertyNotPresent(client, COLLECTION_NAME, c1_s1_r2, "property.preferredLeader");
+ verifyPropertyNotPresent(client, COLLECTION_NAME, c1_s2_r1, "property.preferredLeader");
+ verifyPropertyNotPresent(client, COLLECTION_NAME, c1_s2_r2, "property.preferredLeader");
doPropertyAction(client,
"action", CollectionParams.CollectionAction.ADDREPLICAPROP.toString(),
@@ -349,10 +350,10 @@ public class TestCollectionAPI extends A
"property", "preferredLeader",
"property.value", "true");
// The preferred leader property for shard1 should have switched to the other replica.
- verifyPropertyVal(client, COLLECTION_NAME, c1_s1_r2, "preferredleader", "true");
- verifyPropertyNotPresent(client, COLLECTION_NAME, c1_s1_r1, "preferredLeader");
- verifyPropertyNotPresent(client, COLLECTION_NAME, c1_s2_r1, "preferredLeader");
- verifyPropertyNotPresent(client, COLLECTION_NAME, c1_s2_r2, "preferredLeader");
+ verifyPropertyVal(client, COLLECTION_NAME, c1_s1_r2, "property.preferredleader", "true");
+ verifyPropertyNotPresent(client, COLLECTION_NAME, c1_s1_r1, "property.preferredLeader");
+ verifyPropertyNotPresent(client, COLLECTION_NAME, c1_s2_r1, "property.preferredLeader");
+ verifyPropertyNotPresent(client, COLLECTION_NAME, c1_s2_r2, "property.preferredLeader");
doPropertyAction(client,
"action", CollectionParams.CollectionAction.ADDREPLICAPROP.toString(),
@@ -363,10 +364,10 @@ public class TestCollectionAPI extends A
"property.value", "true");
// Now we should have a preferred leader in both shards...
- verifyPropertyVal(client, COLLECTION_NAME, c1_s1_r2, "preferredleader", "true");
- verifyPropertyNotPresent(client, COLLECTION_NAME, c1_s1_r1, "preferredleader");
- verifyPropertyVal(client, COLLECTION_NAME, c1_s2_r1, "preferredleader", "true");
- verifyPropertyNotPresent(client, COLLECTION_NAME, c1_s2_r2, "preferredLeader");
+ verifyPropertyVal(client, COLLECTION_NAME, c1_s1_r2, "property.preferredleader", "true");
+ verifyPropertyNotPresent(client, COLLECTION_NAME, c1_s1_r1, "property.preferredleader");
+ verifyPropertyVal(client, COLLECTION_NAME, c1_s2_r1, "property.preferredleader", "true");
+ verifyPropertyNotPresent(client, COLLECTION_NAME, c1_s2_r2, "property.preferredLeader");
doPropertyAction(client,
"action", CollectionParams.CollectionAction.ADDREPLICAPROP.toString(),
@@ -377,9 +378,9 @@ public class TestCollectionAPI extends A
"property.value", "true");
// Now we should have three preferred leaders.
- verifyPropertyVal(client, COLLECTION_NAME, c1_s1_r2, "preferredleader", "true");
- verifyPropertyVal(client, COLLECTION_NAME, c1_s2_r1, "preferredleader", "true");
- verifyPropertyVal(client, COLLECTION_NAME1, c2_s1_r1, "preferredleader", "true");
+ verifyPropertyVal(client, COLLECTION_NAME, c1_s1_r2, "property.preferredleader", "true");
+ verifyPropertyVal(client, COLLECTION_NAME, c1_s2_r1, "property.preferredleader", "true");
+ verifyPropertyVal(client, COLLECTION_NAME1, c2_s1_r1, "property.preferredleader", "true");
doPropertyAction(client,
"action", CollectionParams.CollectionAction.DELETEREPLICAPROP.toString(),
@@ -390,11 +391,11 @@ public class TestCollectionAPI extends A
// Now we should have two preferred leaders.
// But first we have to wait for the overseer to finish the action
- verifyPropertyVal(client, COLLECTION_NAME, c1_s1_r2, "preferredleader", "true");
- verifyPropertyVal(client, COLLECTION_NAME, c1_s2_r1, "preferredleader", "true");
- verifyPropertyNotPresent(client, COLLECTION_NAME, c1_s1_r1, "preferredleader");
- verifyPropertyNotPresent(client, COLLECTION_NAME, c1_s2_r2, "preferredleader");
- verifyPropertyNotPresent(client, COLLECTION_NAME1, c2_s1_r1, "preferredleader");
+ verifyPropertyVal(client, COLLECTION_NAME, c1_s1_r2, "property.preferredleader", "true");
+ verifyPropertyVal(client, COLLECTION_NAME, c1_s2_r1, "property.preferredleader", "true");
+ verifyPropertyNotPresent(client, COLLECTION_NAME, c1_s1_r1, "property.preferredleader");
+ verifyPropertyNotPresent(client, COLLECTION_NAME, c1_s2_r2, "property.preferredleader");
+ verifyPropertyNotPresent(client, COLLECTION_NAME1, c2_s1_r1, "property.preferredleader");
// Try adding an arbitrary property to one that has the leader property
doPropertyAction(client,
@@ -405,13 +406,13 @@ public class TestCollectionAPI extends A
"property", "testprop",
"property.value", "true");
- verifyPropertyVal(client, COLLECTION_NAME, c1_s1_r2, "preferredleader", "true");
- verifyPropertyVal(client, COLLECTION_NAME, c1_s2_r1, "preferredleader", "true");
- verifyPropertyVal(client, COLLECTION_NAME, c1_s1_r1, "testprop", "true");
- verifyPropertyNotPresent(client, COLLECTION_NAME, c1_s1_r1, "preferredleader");
- verifyPropertyNotPresent(client, COLLECTION_NAME, c1_s2_r2, "preferredleader");
- verifyPropertyNotPresent(client, COLLECTION_NAME1, c2_s1_r1, "preferredleader");
- verifyPropertyNotPresent(client, COLLECTION_NAME1, c2_s1_r1, "preferredleader");
+ verifyPropertyVal(client, COLLECTION_NAME, c1_s1_r2, "property.preferredleader", "true");
+ verifyPropertyVal(client, COLLECTION_NAME, c1_s2_r1, "property.preferredleader", "true");
+ verifyPropertyVal(client, COLLECTION_NAME, c1_s1_r1, "property.testprop", "true");
+ verifyPropertyNotPresent(client, COLLECTION_NAME, c1_s1_r1, "property.preferredleader");
+ verifyPropertyNotPresent(client, COLLECTION_NAME, c1_s2_r2, "property.preferredleader");
+ verifyPropertyNotPresent(client, COLLECTION_NAME1, c2_s1_r1, "property.preferredleader");
+ verifyPropertyNotPresent(client, COLLECTION_NAME1, c2_s1_r1, "property.preferredleader");
doPropertyAction(client,
"action", CollectionParams.CollectionAction.ADDREPLICAPROP.toString(),
@@ -421,14 +422,14 @@ public class TestCollectionAPI extends A
"property", "prop",
"property.value", "silly");
- verifyPropertyVal(client, COLLECTION_NAME, c1_s1_r2, "preferredleader", "true");
- verifyPropertyVal(client, COLLECTION_NAME, c1_s2_r1, "preferredleader", "true");
- verifyPropertyVal(client, COLLECTION_NAME, c1_s1_r1, "testprop", "true");
- verifyPropertyVal(client, COLLECTION_NAME, c1_s1_r2, "prop", "silly");
- verifyPropertyNotPresent(client, COLLECTION_NAME, c1_s1_r1, "preferredleader");
- verifyPropertyNotPresent(client, COLLECTION_NAME, c1_s2_r2, "preferredleader");
- verifyPropertyNotPresent(client, COLLECTION_NAME1, c2_s1_r1, "preferredleader");
- verifyPropertyNotPresent(client, COLLECTION_NAME1, c2_s1_r1, "preferredleader");
+ verifyPropertyVal(client, COLLECTION_NAME, c1_s1_r2, "property.preferredleader", "true");
+ verifyPropertyVal(client, COLLECTION_NAME, c1_s2_r1, "property.preferredleader", "true");
+ verifyPropertyVal(client, COLLECTION_NAME, c1_s1_r1, "property.testprop", "true");
+ verifyPropertyVal(client, COLLECTION_NAME, c1_s1_r2, "property.prop", "silly");
+ verifyPropertyNotPresent(client, COLLECTION_NAME, c1_s1_r1, "property.preferredleader");
+ verifyPropertyNotPresent(client, COLLECTION_NAME, c1_s2_r2, "property.preferredleader");
+ verifyPropertyNotPresent(client, COLLECTION_NAME1, c2_s1_r1, "property.preferredleader");
+ verifyPropertyNotPresent(client, COLLECTION_NAME1, c2_s1_r1, "property.preferredleader");
doPropertyAction(client,
"action", CollectionParams.CollectionAction.ADDREPLICAPROP.toLower(),
@@ -439,14 +440,14 @@ public class TestCollectionAPI extends A
"property.value", "nonsense",
SLICE_UNIQUE, "true");
- verifyPropertyVal(client, COLLECTION_NAME, c1_s1_r2, "preferredleader", "true");
- verifyPropertyVal(client, COLLECTION_NAME, c1_s2_r1, "preferredleader", "true");
- verifyPropertyVal(client, COLLECTION_NAME, c1_s1_r1, "testprop", "nonsense");
- verifyPropertyVal(client, COLLECTION_NAME, c1_s1_r2, "prop", "silly");
- verifyPropertyNotPresent(client, COLLECTION_NAME, c1_s1_r1, "preferredleader");
- verifyPropertyNotPresent(client, COLLECTION_NAME, c1_s2_r2, "preferredleader");
- verifyPropertyNotPresent(client, COLLECTION_NAME1, c2_s1_r1, "preferredleader");
- verifyPropertyNotPresent(client, COLLECTION_NAME1, c2_s1_r1, "preferredleader");
+ verifyPropertyVal(client, COLLECTION_NAME, c1_s1_r2, "property.preferredleader", "true");
+ verifyPropertyVal(client, COLLECTION_NAME, c1_s2_r1, "property.preferredleader", "true");
+ verifyPropertyVal(client, COLLECTION_NAME, c1_s1_r1, "property.testprop", "nonsense");
+ verifyPropertyVal(client, COLLECTION_NAME, c1_s1_r2, "property.prop", "silly");
+ verifyPropertyNotPresent(client, COLLECTION_NAME, c1_s1_r1, "property.preferredleader");
+ verifyPropertyNotPresent(client, COLLECTION_NAME, c1_s2_r2, "property.preferredleader");
+ verifyPropertyNotPresent(client, COLLECTION_NAME1, c2_s1_r1, "property.preferredleader");
+ verifyPropertyNotPresent(client, COLLECTION_NAME1, c2_s1_r1, "property.preferredleader");
doPropertyAction(client,
@@ -454,34 +455,34 @@ public class TestCollectionAPI extends A
"collection", COLLECTION_NAME,
"shard", c1_s1,
"replica", c1_s1_r1,
- "property", "testprop",
+ "property", "property.testprop",
"property.value", "true",
SLICE_UNIQUE, "false");
- verifyPropertyVal(client, COLLECTION_NAME, c1_s1_r2, "preferredleader", "true");
- verifyPropertyVal(client, COLLECTION_NAME, c1_s2_r1, "preferredleader", "true");
- verifyPropertyVal(client, COLLECTION_NAME, c1_s1_r1, "testprop", "true");
- verifyPropertyVal(client, COLLECTION_NAME, c1_s1_r2, "prop", "silly");
- verifyPropertyNotPresent(client, COLLECTION_NAME, c1_s1_r1, "preferredleader");
- verifyPropertyNotPresent(client, COLLECTION_NAME, c1_s2_r2, "preferredleader");
- verifyPropertyNotPresent(client, COLLECTION_NAME1, c2_s1_r1, "preferredleader");
- verifyPropertyNotPresent(client, COLLECTION_NAME1, c2_s1_r1, "preferredleader");
+ verifyPropertyVal(client, COLLECTION_NAME, c1_s1_r2, "property.preferredleader", "true");
+ verifyPropertyVal(client, COLLECTION_NAME, c1_s2_r1, "property.preferredleader", "true");
+ verifyPropertyVal(client, COLLECTION_NAME, c1_s1_r1, "property.testprop", "true");
+ verifyPropertyVal(client, COLLECTION_NAME, c1_s1_r2, "property.prop", "silly");
+ verifyPropertyNotPresent(client, COLLECTION_NAME, c1_s1_r1, "property.preferredleader");
+ verifyPropertyNotPresent(client, COLLECTION_NAME, c1_s2_r2, "property.preferredleader");
+ verifyPropertyNotPresent(client, COLLECTION_NAME1, c2_s1_r1, "property.preferredleader");
+ verifyPropertyNotPresent(client, COLLECTION_NAME1, c2_s1_r1, "property.preferredleader");
doPropertyAction(client,
"action", CollectionParams.CollectionAction.DELETEREPLICAPROP.toLower(),
"collection", COLLECTION_NAME,
"shard", c1_s1,
"replica", c1_s1_r1,
- "property", "testprop");
+ "property", "property.testprop");
- verifyPropertyVal(client, COLLECTION_NAME, c1_s1_r2, "preferredleader", "true");
- verifyPropertyVal(client, COLLECTION_NAME, c1_s2_r1, "preferredleader", "true");
- verifyPropertyNotPresent(client, COLLECTION_NAME, c1_s1_r1, "testprop");
- verifyPropertyVal(client, COLLECTION_NAME, c1_s1_r2, "prop", "silly");
- verifyPropertyNotPresent(client, COLLECTION_NAME, c1_s1_r1, "preferredleader");
- verifyPropertyNotPresent(client, COLLECTION_NAME, c1_s2_r2, "preferredleader");
- verifyPropertyNotPresent(client, COLLECTION_NAME1, c2_s1_r1, "preferredleader");
- verifyPropertyNotPresent(client, COLLECTION_NAME1, c2_s1_r1, "preferredleader");
+ verifyPropertyVal(client, COLLECTION_NAME, c1_s1_r2, "property.preferredleader", "true");
+ verifyPropertyVal(client, COLLECTION_NAME, c1_s2_r1, "property.preferredleader", "true");
+ verifyPropertyNotPresent(client, COLLECTION_NAME, c1_s1_r1, "property.testprop");
+ verifyPropertyVal(client, COLLECTION_NAME, c1_s1_r2, "property.prop", "silly");
+ verifyPropertyNotPresent(client, COLLECTION_NAME, c1_s1_r1, "property.preferredleader");
+ verifyPropertyNotPresent(client, COLLECTION_NAME, c1_s2_r2, "property.preferredleader");
+ verifyPropertyNotPresent(client, COLLECTION_NAME1, c2_s1_r1, "property.preferredleader");
+ verifyPropertyNotPresent(client, COLLECTION_NAME1, c2_s1_r1, "property.preferredleader");
try {
doPropertyAction(client,
@@ -498,14 +499,93 @@ public class TestCollectionAPI extends A
se.getMessage().contains("with the sliceUnique parameter set to something other than 'true'"));
}
- verifyPropertyVal(client, COLLECTION_NAME, c1_s1_r2, "preferredleader", "true");
- verifyPropertyVal(client, COLLECTION_NAME, c1_s2_r1, "preferredleader", "true");
- verifyPropertyNotPresent(client, COLLECTION_NAME, c1_s1_r1, "testprop");
- verifyPropertyVal(client, COLLECTION_NAME, c1_s1_r2, "prop", "silly");
- verifyPropertyNotPresent(client, COLLECTION_NAME, c1_s1_r1, "preferredleader");
- verifyPropertyNotPresent(client, COLLECTION_NAME, c1_s2_r2, "preferredleader");
- verifyPropertyNotPresent(client, COLLECTION_NAME1, c2_s1_r1, "preferredleader");
- verifyPropertyNotPresent(client, COLLECTION_NAME1, c2_s1_r1, "preferredleader");
+ verifyPropertyVal(client, COLLECTION_NAME, c1_s1_r2, "property.preferredleader", "true");
+ verifyPropertyVal(client, COLLECTION_NAME, c1_s2_r1, "property.preferredleader", "true");
+ verifyPropertyNotPresent(client, COLLECTION_NAME, c1_s1_r1, "property.testprop");
+ verifyPropertyVal(client, COLLECTION_NAME, c1_s1_r2, "property.prop", "silly");
+ verifyPropertyNotPresent(client, COLLECTION_NAME, c1_s1_r1, "property.preferredleader");
+ verifyPropertyNotPresent(client, COLLECTION_NAME, c1_s2_r2, "property.preferredleader");
+ verifyPropertyNotPresent(client, COLLECTION_NAME1, c2_s1_r1, "property.preferredleader");
+ verifyPropertyNotPresent(client, COLLECTION_NAME1, c2_s1_r1, "property.preferredleader");
+
+ Map<String, String> origProps = getProps(client, COLLECTION_NAME, c1_s1_r1,
+ "state", "core", "node_name", "base_url");
+
+ doPropertyAction(client,
+ "action", CollectionParams.CollectionAction.ADDREPLICAPROP.toLower(),
+ "collection", COLLECTION_NAME,
+ "shard", c1_s1,
+ "replica", c1_s1_r1,
+ "property", "state",
+ "property.value", "state_bad");
+
+ doPropertyAction(client,
+ "action", CollectionParams.CollectionAction.ADDREPLICAPROP.toLower(),
+ "collection", COLLECTION_NAME,
+ "shard", c1_s1,
+ "replica", c1_s1_r1,
+ "property", "core",
+ "property.value", "core_bad");
+
+ doPropertyAction(client,
+ "action", CollectionParams.CollectionAction.ADDREPLICAPROP.toLower(),
+ "collection", COLLECTION_NAME,
+ "shard", c1_s1,
+ "replica", c1_s1_r1,
+ "property", "node_name",
+ "property.value", "node_name_bad");
+
+ doPropertyAction(client,
+ "action", CollectionParams.CollectionAction.ADDREPLICAPROP.toLower(),
+ "collection", COLLECTION_NAME,
+ "shard", c1_s1,
+ "replica", c1_s1_r1,
+ "property", "base_url",
+ "property.value", "base_url_bad");
+
+ // The above should be on new proeprties.
+ verifyPropertyVal(client, COLLECTION_NAME, c1_s1_r1, "property.state", "state_bad");
+ verifyPropertyVal(client, COLLECTION_NAME, c1_s1_r1, "property.core", "core_bad");
+ verifyPropertyVal(client, COLLECTION_NAME, c1_s1_r1, "property.node_name", "node_name_bad");
+ verifyPropertyVal(client, COLLECTION_NAME, c1_s1_r1, "property.base_url", "base_url_bad");
+
+ doPropertyAction(client,
+ "action", CollectionParams.CollectionAction.DELETEREPLICAPROP.toLower(),
+ "collection", COLLECTION_NAME,
+ "shard", c1_s1,
+ "replica", c1_s1_r1,
+ "property", "state");
+
+ doPropertyAction(client,
+ "action", CollectionParams.CollectionAction.DELETEREPLICAPROP.toLower(),
+ "collection", COLLECTION_NAME,
+ "shard", c1_s1,
+ "replica", c1_s1_r1,
+ "property", "core");
+
+ doPropertyAction(client,
+ "action", CollectionParams.CollectionAction.DELETEREPLICAPROP.toLower(),
+ "collection", COLLECTION_NAME,
+ "shard", c1_s1,
+ "replica", c1_s1_r1,
+ "property", "node_name");
+
+ doPropertyAction(client,
+ "action", CollectionParams.CollectionAction.DELETEREPLICAPROP.toLower(),
+ "collection", COLLECTION_NAME,
+ "shard", c1_s1,
+ "replica", c1_s1_r1,
+ "property", "base_url");
+
+ // They better not have been changed!
+ for (Map.Entry<String, String> ent : origProps.entrySet()) {
+ verifyPropertyVal(client, COLLECTION_NAME, c1_s1_r1, ent.getKey(), ent.getValue());
+ }
+
+ verifyPropertyNotPresent(client, COLLECTION_NAME, c1_s1_r1, "property.state");
+ verifyPropertyNotPresent(client, COLLECTION_NAME, c1_s1_r1, "property.core");
+ verifyPropertyNotPresent(client, COLLECTION_NAME, c1_s1_r1, "property.node_name");
+ verifyPropertyNotPresent(client, COLLECTION_NAME, c1_s1_r1, "property.base_url");
} finally {
client.shutdown();
@@ -568,10 +648,24 @@ public class TestCollectionAPI extends A
fail("Property '" + property + "' with value " + replica.getStr(property) +
" not set correctly for collection/replica pair: " + collectionName + "/" + replicaName + " property map is " +
- replica.getProperties().toString() + ".");
+ replica.getProperties().toString() + ".");
}
+ // Expects the map will have keys, but blank values.
+ private Map<String, String> getProps(CloudSolrServer client, String collectionName, String replicaName, String... props) throws KeeperException, InterruptedException {
+ client.getZkStateReader().updateClusterState(true);
+ ClusterState clusterState = client.getZkStateReader().getClusterState();
+ Replica replica = clusterState.getReplica(collectionName, replicaName);
+ if (replica == null) {
+ fail("Could not find collection/replica pair! " + collectionName + "/" + replicaName);
+ }
+ Map<String, String> propMap = new HashMap<>();
+ for (String prop : props) {
+ propMap.put(prop, replica.getStr(prop));
+ }
+ return propMap;
+ }
private void missingParamsError(CloudSolrServer client, ModifiableSolrParams origParams)
throws IOException, SolrServerException {