mirror of
https://github.com/apache/lucene.git
synced 2025-02-09 11:35:14 +00:00
SOLR-11090: Add Replica.getProperty accessor.
This commit is contained in:
parent
68bda0be42
commit
8e2dab7315
@ -132,6 +132,8 @@ Other Changes
|
|||||||
|
|
||||||
* SOLR-11187: contrib/ltr TestModelManagerPersistence improvements. (Yuki Yano via Christine Poerschke)
|
* SOLR-11187: contrib/ltr TestModelManagerPersistence improvements. (Yuki Yano via Christine Poerschke)
|
||||||
|
|
||||||
|
* SOLR-11090: Add Replica.getProperty accessor. (Christine Poerschke)
|
||||||
|
|
||||||
================== 7.0.0 ==================
|
================== 7.0.0 ==================
|
||||||
|
|
||||||
Versions of Major Components
|
Versions of Major Components
|
||||||
|
@ -369,14 +369,14 @@ public class CollectionsAPISolrJTest extends SolrCloudTestCase {
|
|||||||
assertEquals(0, response.getStatus());
|
assertEquals(0, response.getStatus());
|
||||||
|
|
||||||
waitForState("Expecting property 'preferredleader' to appear on replica " + replica.getName(), collection,
|
waitForState("Expecting property 'preferredleader' to appear on replica " + replica.getName(), collection,
|
||||||
(n, c) -> "true".equals(c.getReplica(replica.getName()).getStr("property.preferredleader")));
|
(n, c) -> "true".equals(c.getReplica(replica.getName()).getProperty("preferredleader")));
|
||||||
|
|
||||||
response = CollectionAdminRequest.deleteReplicaProperty(collection, "shard1", replica.getName(), "property.preferredleader")
|
response = CollectionAdminRequest.deleteReplicaProperty(collection, "shard1", replica.getName(), "property.preferredleader")
|
||||||
.process(cluster.getSolrClient());
|
.process(cluster.getSolrClient());
|
||||||
assertEquals(0, response.getStatus());
|
assertEquals(0, response.getStatus());
|
||||||
|
|
||||||
waitForState("Expecting property 'preferredleader' to be removed from replica " + replica.getName(), collection,
|
waitForState("Expecting property 'preferredleader' to be removed from replica " + replica.getName(), collection,
|
||||||
(n, c) -> c.getReplica(replica.getName()).getStr("property.preferredleader") == null);
|
(n, c) -> c.getReplica(replica.getName()).getProperty("preferredleader") == null);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -396,7 +396,7 @@ public class CollectionsAPISolrJTest extends SolrCloudTestCase {
|
|||||||
for (Slice slice : c) {
|
for (Slice slice : c) {
|
||||||
int count = 0;
|
int count = 0;
|
||||||
for (Replica replica : slice) {
|
for (Replica replica : slice) {
|
||||||
if ("true".equals(replica.getStr("property.preferredleader")))
|
if ("true".equals(replica.getProperty("preferredleader")))
|
||||||
count += 1;
|
count += 1;
|
||||||
}
|
}
|
||||||
if (count != 1)
|
if (count != 1)
|
||||||
|
@ -62,7 +62,7 @@ public abstract class ReplicaPropertiesBase extends AbstractFullDistribZkTestBas
|
|||||||
if (replica == null) {
|
if (replica == null) {
|
||||||
fail("Could not find collection/replica pair! " + collectionName + "/" + replicaName);
|
fail("Could not find collection/replica pair! " + collectionName + "/" + replicaName);
|
||||||
}
|
}
|
||||||
if (StringUtils.isBlank(replica.getStr(property))) return;
|
if (StringUtils.isBlank(replica.getProperty(property))) return;
|
||||||
Thread.sleep(100);
|
Thread.sleep(100);
|
||||||
}
|
}
|
||||||
fail("Property " + property + " not set correctly for collection/replica pair: " +
|
fail("Property " + property + " not set correctly for collection/replica pair: " +
|
||||||
@ -88,11 +88,11 @@ public abstract class ReplicaPropertiesBase extends AbstractFullDistribZkTestBas
|
|||||||
if (replica == null) {
|
if (replica == null) {
|
||||||
fail("Could not find collection/replica pair! " + collectionName + "/" + replicaName);
|
fail("Could not find collection/replica pair! " + collectionName + "/" + replicaName);
|
||||||
}
|
}
|
||||||
if (StringUtils.equals(val, replica.getStr(property))) return;
|
if (StringUtils.equals(val, replica.getProperty(property))) return;
|
||||||
Thread.sleep(100);
|
Thread.sleep(100);
|
||||||
}
|
}
|
||||||
|
|
||||||
fail("Property '" + property + "' with value " + replica.getStr(property) +
|
fail("Property '" + property + "' with value " + replica.getProperty(property) +
|
||||||
" not set correctly for collection/replica pair: " + collectionName + "/" + replicaName + " property map is " +
|
" not set correctly for collection/replica pair: " + collectionName + "/" + replicaName + " property map is " +
|
||||||
replica.getProperties().toString() + ".");
|
replica.getProperties().toString() + ".");
|
||||||
|
|
||||||
@ -131,7 +131,7 @@ public abstract class ReplicaPropertiesBase extends AbstractFullDistribZkTestBas
|
|||||||
int propCount = 0;
|
int propCount = 0;
|
||||||
for (Replica replica : slice.getReplicas()) {
|
for (Replica replica : slice.getReplicas()) {
|
||||||
uniqueNodes.add(replica.getNodeName());
|
uniqueNodes.add(replica.getNodeName());
|
||||||
String propVal = replica.getStr(property);
|
String propVal = replica.getProperty(property);
|
||||||
if (StringUtils.isNotBlank(propVal)) {
|
if (StringUtils.isNotBlank(propVal)) {
|
||||||
++propCount;
|
++propCount;
|
||||||
if (counts.containsKey(replica.getNodeName()) == false) {
|
if (counts.containsKey(replica.getNodeName()) == false) {
|
||||||
|
@ -401,8 +401,8 @@ public class TestCollectionAPI extends ReplicaPropertiesBase {
|
|||||||
client.request(request);
|
client.request(request);
|
||||||
|
|
||||||
// The above should have set exactly one preferredleader...
|
// The above should have set exactly one preferredleader...
|
||||||
verifyPropertyVal(client, COLLECTION_NAME, c1_s1_r1, "property.preferredleader", "true");
|
verifyPropertyVal(client, COLLECTION_NAME, c1_s1_r1, "preferredleader", "true");
|
||||||
verifyUniquePropertyWithinCollection(client, COLLECTION_NAME, "property.preferredLeader");
|
verifyUniquePropertyWithinCollection(client, COLLECTION_NAME, "preferredLeader");
|
||||||
|
|
||||||
doPropertyAction(client,
|
doPropertyAction(client,
|
||||||
"action", CollectionParams.CollectionAction.ADDREPLICAPROP.toString(),
|
"action", CollectionParams.CollectionAction.ADDREPLICAPROP.toString(),
|
||||||
@ -412,8 +412,8 @@ public class TestCollectionAPI extends ReplicaPropertiesBase {
|
|||||||
"property", "preferredLeader",
|
"property", "preferredLeader",
|
||||||
"property.value", "true");
|
"property.value", "true");
|
||||||
// The preferred leader property for shard1 should have switched to the other replica.
|
// The preferred leader property for shard1 should have switched to the other replica.
|
||||||
verifyPropertyVal(client, COLLECTION_NAME, c1_s1_r2, "property.preferredleader", "true");
|
verifyPropertyVal(client, COLLECTION_NAME, c1_s1_r2, "preferredleader", "true");
|
||||||
verifyUniquePropertyWithinCollection(client, COLLECTION_NAME, "property.preferredLeader");
|
verifyUniquePropertyWithinCollection(client, COLLECTION_NAME, "preferredLeader");
|
||||||
|
|
||||||
doPropertyAction(client,
|
doPropertyAction(client,
|
||||||
"action", CollectionParams.CollectionAction.ADDREPLICAPROP.toString(),
|
"action", CollectionParams.CollectionAction.ADDREPLICAPROP.toString(),
|
||||||
@ -424,9 +424,9 @@ public class TestCollectionAPI extends ReplicaPropertiesBase {
|
|||||||
"property.value", "true");
|
"property.value", "true");
|
||||||
|
|
||||||
// Now we should have a preferred leader in both shards...
|
// Now we should have a preferred leader in both shards...
|
||||||
verifyPropertyVal(client, COLLECTION_NAME, c1_s1_r2, "property.preferredleader", "true");
|
verifyPropertyVal(client, COLLECTION_NAME, c1_s1_r2, "preferredleader", "true");
|
||||||
verifyPropertyVal(client, COLLECTION_NAME, c1_s2_r1, "property.preferredleader", "true");
|
verifyPropertyVal(client, COLLECTION_NAME, c1_s2_r1, "preferredleader", "true");
|
||||||
verifyUniquePropertyWithinCollection(client, COLLECTION_NAME, "property.preferredLeader");
|
verifyUniquePropertyWithinCollection(client, COLLECTION_NAME, "preferredLeader");
|
||||||
|
|
||||||
doPropertyAction(client,
|
doPropertyAction(client,
|
||||||
"action", CollectionParams.CollectionAction.ADDREPLICAPROP.toString(),
|
"action", CollectionParams.CollectionAction.ADDREPLICAPROP.toString(),
|
||||||
@ -437,11 +437,11 @@ public class TestCollectionAPI extends ReplicaPropertiesBase {
|
|||||||
"property.value", "true");
|
"property.value", "true");
|
||||||
|
|
||||||
// Now we should have three preferred leaders.
|
// Now we should have three preferred leaders.
|
||||||
verifyPropertyVal(client, COLLECTION_NAME, c1_s1_r2, "property.preferredleader", "true");
|
verifyPropertyVal(client, COLLECTION_NAME, c1_s1_r2, "preferredleader", "true");
|
||||||
verifyPropertyVal(client, COLLECTION_NAME, c1_s2_r1, "property.preferredleader", "true");
|
verifyPropertyVal(client, COLLECTION_NAME, c1_s2_r1, "preferredleader", "true");
|
||||||
verifyPropertyVal(client, COLLECTION_NAME1, c2_s1_r1, "property.preferredleader", "true");
|
verifyPropertyVal(client, COLLECTION_NAME1, c2_s1_r1, "preferredleader", "true");
|
||||||
verifyUniquePropertyWithinCollection(client, COLLECTION_NAME, "property.preferredLeader");
|
verifyUniquePropertyWithinCollection(client, COLLECTION_NAME, "preferredLeader");
|
||||||
verifyUniquePropertyWithinCollection(client, COLLECTION_NAME1, "property.preferredLeader");
|
verifyUniquePropertyWithinCollection(client, COLLECTION_NAME1, "preferredLeader");
|
||||||
|
|
||||||
doPropertyAction(client,
|
doPropertyAction(client,
|
||||||
"action", CollectionParams.CollectionAction.DELETEREPLICAPROP.toString(),
|
"action", CollectionParams.CollectionAction.DELETEREPLICAPROP.toString(),
|
||||||
@ -452,10 +452,10 @@ public class TestCollectionAPI extends ReplicaPropertiesBase {
|
|||||||
|
|
||||||
// Now we should have two preferred leaders.
|
// Now we should have two preferred leaders.
|
||||||
// But first we have to wait for the overseer to finish the action
|
// But first we have to wait for the overseer to finish the action
|
||||||
verifyPropertyVal(client, COLLECTION_NAME, c1_s1_r2, "property.preferredleader", "true");
|
verifyPropertyVal(client, COLLECTION_NAME, c1_s1_r2, "preferredleader", "true");
|
||||||
verifyPropertyVal(client, COLLECTION_NAME, c1_s2_r1, "property.preferredleader", "true");
|
verifyPropertyVal(client, COLLECTION_NAME, c1_s2_r1, "preferredleader", "true");
|
||||||
verifyUniquePropertyWithinCollection(client, COLLECTION_NAME, "property.preferredLeader");
|
verifyUniquePropertyWithinCollection(client, COLLECTION_NAME, "preferredLeader");
|
||||||
verifyUniquePropertyWithinCollection(client, COLLECTION_NAME1, "property.preferredLeader");
|
verifyUniquePropertyWithinCollection(client, COLLECTION_NAME1, "preferredLeader");
|
||||||
|
|
||||||
// Try adding an arbitrary property to one that has the leader property
|
// Try adding an arbitrary property to one that has the leader property
|
||||||
doPropertyAction(client,
|
doPropertyAction(client,
|
||||||
@ -466,11 +466,11 @@ public class TestCollectionAPI extends ReplicaPropertiesBase {
|
|||||||
"property", "testprop",
|
"property", "testprop",
|
||||||
"property.value", "true");
|
"property.value", "true");
|
||||||
|
|
||||||
verifyPropertyVal(client, COLLECTION_NAME, c1_s1_r2, "property.preferredleader", "true");
|
verifyPropertyVal(client, COLLECTION_NAME, c1_s1_r2, "preferredleader", "true");
|
||||||
verifyPropertyVal(client, COLLECTION_NAME, c1_s2_r1, "property.preferredleader", "true");
|
verifyPropertyVal(client, COLLECTION_NAME, c1_s2_r1, "preferredleader", "true");
|
||||||
verifyPropertyVal(client, COLLECTION_NAME, c1_s1_r1, "property.testprop", "true");
|
verifyPropertyVal(client, COLLECTION_NAME, c1_s1_r1, "testprop", "true");
|
||||||
verifyUniquePropertyWithinCollection(client, COLLECTION_NAME, "property.preferredLeader");
|
verifyUniquePropertyWithinCollection(client, COLLECTION_NAME, "preferredLeader");
|
||||||
verifyUniquePropertyWithinCollection(client, COLLECTION_NAME1, "property.preferredLeader");
|
verifyUniquePropertyWithinCollection(client, COLLECTION_NAME1, "preferredLeader");
|
||||||
|
|
||||||
doPropertyAction(client,
|
doPropertyAction(client,
|
||||||
"action", CollectionParams.CollectionAction.ADDREPLICAPROP.toString(),
|
"action", CollectionParams.CollectionAction.ADDREPLICAPROP.toString(),
|
||||||
@ -480,12 +480,12 @@ public class TestCollectionAPI extends ReplicaPropertiesBase {
|
|||||||
"property", "prop",
|
"property", "prop",
|
||||||
"property.value", "silly");
|
"property.value", "silly");
|
||||||
|
|
||||||
verifyPropertyVal(client, COLLECTION_NAME, c1_s1_r2, "property.preferredleader", "true");
|
verifyPropertyVal(client, COLLECTION_NAME, c1_s1_r2, "preferredleader", "true");
|
||||||
verifyPropertyVal(client, COLLECTION_NAME, c1_s2_r1, "property.preferredleader", "true");
|
verifyPropertyVal(client, COLLECTION_NAME, c1_s2_r1, "preferredleader", "true");
|
||||||
verifyPropertyVal(client, COLLECTION_NAME, c1_s1_r1, "property.testprop", "true");
|
verifyPropertyVal(client, COLLECTION_NAME, c1_s1_r1, "testprop", "true");
|
||||||
verifyPropertyVal(client, COLLECTION_NAME, c1_s1_r2, "property.prop", "silly");
|
verifyPropertyVal(client, COLLECTION_NAME, c1_s1_r2, "prop", "silly");
|
||||||
verifyUniquePropertyWithinCollection(client, COLLECTION_NAME, "property.preferredLeader");
|
verifyUniquePropertyWithinCollection(client, COLLECTION_NAME, "preferredLeader");
|
||||||
verifyUniquePropertyWithinCollection(client, COLLECTION_NAME1, "property.preferredLeader");
|
verifyUniquePropertyWithinCollection(client, COLLECTION_NAME1, "preferredLeader");
|
||||||
|
|
||||||
doPropertyAction(client,
|
doPropertyAction(client,
|
||||||
"action", CollectionParams.CollectionAction.ADDREPLICAPROP.toLower(),
|
"action", CollectionParams.CollectionAction.ADDREPLICAPROP.toLower(),
|
||||||
@ -496,12 +496,12 @@ public class TestCollectionAPI extends ReplicaPropertiesBase {
|
|||||||
"property.value", "nonsense",
|
"property.value", "nonsense",
|
||||||
SHARD_UNIQUE, "true");
|
SHARD_UNIQUE, "true");
|
||||||
|
|
||||||
verifyPropertyVal(client, COLLECTION_NAME, c1_s1_r2, "property.preferredleader", "true");
|
verifyPropertyVal(client, COLLECTION_NAME, c1_s1_r2, "preferredleader", "true");
|
||||||
verifyPropertyVal(client, COLLECTION_NAME, c1_s2_r1, "property.preferredleader", "true");
|
verifyPropertyVal(client, COLLECTION_NAME, c1_s2_r1, "preferredleader", "true");
|
||||||
verifyPropertyVal(client, COLLECTION_NAME, c1_s1_r1, "property.testprop", "nonsense");
|
verifyPropertyVal(client, COLLECTION_NAME, c1_s1_r1, "testprop", "nonsense");
|
||||||
verifyPropertyVal(client, COLLECTION_NAME, c1_s1_r2, "property.prop", "silly");
|
verifyPropertyVal(client, COLLECTION_NAME, c1_s1_r2, "prop", "silly");
|
||||||
verifyUniquePropertyWithinCollection(client, COLLECTION_NAME, "property.preferredLeader");
|
verifyUniquePropertyWithinCollection(client, COLLECTION_NAME, "preferredLeader");
|
||||||
verifyUniquePropertyWithinCollection(client, COLLECTION_NAME1, "property.preferredLeader");
|
verifyUniquePropertyWithinCollection(client, COLLECTION_NAME1, "preferredLeader");
|
||||||
|
|
||||||
|
|
||||||
doPropertyAction(client,
|
doPropertyAction(client,
|
||||||
@ -513,12 +513,12 @@ public class TestCollectionAPI extends ReplicaPropertiesBase {
|
|||||||
"property.value", "true",
|
"property.value", "true",
|
||||||
SHARD_UNIQUE, "false");
|
SHARD_UNIQUE, "false");
|
||||||
|
|
||||||
verifyPropertyVal(client, COLLECTION_NAME, c1_s1_r2, "property.preferredleader", "true");
|
verifyPropertyVal(client, COLLECTION_NAME, c1_s1_r2, "preferredleader", "true");
|
||||||
verifyPropertyVal(client, COLLECTION_NAME, c1_s2_r1, "property.preferredleader", "true");
|
verifyPropertyVal(client, COLLECTION_NAME, c1_s2_r1, "preferredleader", "true");
|
||||||
verifyPropertyVal(client, COLLECTION_NAME, c1_s1_r1, "property.testprop", "true");
|
verifyPropertyVal(client, COLLECTION_NAME, c1_s1_r1, "testprop", "true");
|
||||||
verifyPropertyVal(client, COLLECTION_NAME, c1_s1_r2, "property.prop", "silly");
|
verifyPropertyVal(client, COLLECTION_NAME, c1_s1_r2, "prop", "silly");
|
||||||
verifyUniquePropertyWithinCollection(client, COLLECTION_NAME, "property.preferredLeader");
|
verifyUniquePropertyWithinCollection(client, COLLECTION_NAME, "preferredLeader");
|
||||||
verifyUniquePropertyWithinCollection(client, COLLECTION_NAME1, "property.preferredLeader");
|
verifyUniquePropertyWithinCollection(client, COLLECTION_NAME1, "preferredLeader");
|
||||||
|
|
||||||
doPropertyAction(client,
|
doPropertyAction(client,
|
||||||
"action", CollectionParams.CollectionAction.DELETEREPLICAPROP.toLower(),
|
"action", CollectionParams.CollectionAction.DELETEREPLICAPROP.toLower(),
|
||||||
@ -527,12 +527,12 @@ public class TestCollectionAPI extends ReplicaPropertiesBase {
|
|||||||
"replica", c1_s1_r1,
|
"replica", c1_s1_r1,
|
||||||
"property", "property.testprop");
|
"property", "property.testprop");
|
||||||
|
|
||||||
verifyPropertyVal(client, COLLECTION_NAME, c1_s1_r2, "property.preferredleader", "true");
|
verifyPropertyVal(client, COLLECTION_NAME, c1_s1_r2, "preferredleader", "true");
|
||||||
verifyPropertyVal(client, COLLECTION_NAME, c1_s2_r1, "property.preferredleader", "true");
|
verifyPropertyVal(client, COLLECTION_NAME, c1_s2_r1, "preferredleader", "true");
|
||||||
verifyPropertyNotPresent(client, COLLECTION_NAME, c1_s1_r1, "property.testprop");
|
verifyPropertyNotPresent(client, COLLECTION_NAME, c1_s1_r1, "testprop");
|
||||||
verifyPropertyVal(client, COLLECTION_NAME, c1_s1_r2, "property.prop", "silly");
|
verifyPropertyVal(client, COLLECTION_NAME, c1_s1_r2, "prop", "silly");
|
||||||
verifyUniquePropertyWithinCollection(client, COLLECTION_NAME, "property.preferredLeader");
|
verifyUniquePropertyWithinCollection(client, COLLECTION_NAME, "preferredLeader");
|
||||||
verifyUniquePropertyWithinCollection(client, COLLECTION_NAME1, "property.preferredLeader");
|
verifyUniquePropertyWithinCollection(client, COLLECTION_NAME1, "preferredLeader");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
doPropertyAction(client,
|
doPropertyAction(client,
|
||||||
@ -549,12 +549,12 @@ public class TestCollectionAPI extends ReplicaPropertiesBase {
|
|||||||
se.getMessage().contains("with the shardUnique parameter set to something other than 'true'"));
|
se.getMessage().contains("with the shardUnique parameter set to something other than 'true'"));
|
||||||
}
|
}
|
||||||
|
|
||||||
verifyPropertyVal(client, COLLECTION_NAME, c1_s1_r2, "property.preferredleader", "true");
|
verifyPropertyVal(client, COLLECTION_NAME, c1_s1_r2, "preferredleader", "true");
|
||||||
verifyPropertyVal(client, COLLECTION_NAME, c1_s2_r1, "property.preferredleader", "true");
|
verifyPropertyVal(client, COLLECTION_NAME, c1_s2_r1, "preferredleader", "true");
|
||||||
verifyPropertyNotPresent(client, COLLECTION_NAME, c1_s1_r1, "property.testprop");
|
verifyPropertyNotPresent(client, COLLECTION_NAME, c1_s1_r1, "testprop");
|
||||||
verifyPropertyVal(client, COLLECTION_NAME, c1_s1_r2, "property.prop", "silly");
|
verifyPropertyVal(client, COLLECTION_NAME, c1_s1_r2, "prop", "silly");
|
||||||
verifyUniquePropertyWithinCollection(client, COLLECTION_NAME, "property.preferredLeader");
|
verifyUniquePropertyWithinCollection(client, COLLECTION_NAME, "preferredLeader");
|
||||||
verifyUniquePropertyWithinCollection(client, COLLECTION_NAME1, "property.preferredLeader");
|
verifyUniquePropertyWithinCollection(client, COLLECTION_NAME1, "preferredLeader");
|
||||||
|
|
||||||
Map<String, String> origProps = getProps(client, COLLECTION_NAME, c1_s1_r1,
|
Map<String, String> origProps = getProps(client, COLLECTION_NAME, c1_s1_r1,
|
||||||
"state", "core", "node_name", "base_url");
|
"state", "core", "node_name", "base_url");
|
||||||
@ -592,10 +592,10 @@ public class TestCollectionAPI extends ReplicaPropertiesBase {
|
|||||||
"property.value", "base_url_bad");
|
"property.value", "base_url_bad");
|
||||||
|
|
||||||
// The above should be on new proeprties.
|
// 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, "state", "state_bad");
|
||||||
verifyPropertyVal(client, COLLECTION_NAME, c1_s1_r1, "property.core", "core_bad");
|
verifyPropertyVal(client, COLLECTION_NAME, c1_s1_r1, "core", "core_bad");
|
||||||
verifyPropertyVal(client, COLLECTION_NAME, c1_s1_r1, "property.node_name", "node_name_bad");
|
verifyPropertyVal(client, COLLECTION_NAME, c1_s1_r1, "node_name", "node_name_bad");
|
||||||
verifyPropertyVal(client, COLLECTION_NAME, c1_s1_r1, "property.base_url", "base_url_bad");
|
verifyPropertyVal(client, COLLECTION_NAME, c1_s1_r1, "base_url", "base_url_bad");
|
||||||
|
|
||||||
doPropertyAction(client,
|
doPropertyAction(client,
|
||||||
"action", CollectionParams.CollectionAction.DELETEREPLICAPROP.toLower(),
|
"action", CollectionParams.CollectionAction.DELETEREPLICAPROP.toLower(),
|
||||||
@ -630,10 +630,10 @@ public class TestCollectionAPI extends ReplicaPropertiesBase {
|
|||||||
verifyPropertyVal(client, COLLECTION_NAME, c1_s1_r1, ent.getKey(), ent.getValue());
|
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, "state");
|
||||||
verifyPropertyNotPresent(client, COLLECTION_NAME, c1_s1_r1, "property.core");
|
verifyPropertyNotPresent(client, COLLECTION_NAME, c1_s1_r1, "core");
|
||||||
verifyPropertyNotPresent(client, COLLECTION_NAME, c1_s1_r1, "property.node_name");
|
verifyPropertyNotPresent(client, COLLECTION_NAME, c1_s1_r1, "node_name");
|
||||||
verifyPropertyNotPresent(client, COLLECTION_NAME, c1_s1_r1, "property.base_url");
|
verifyPropertyNotPresent(client, COLLECTION_NAME, c1_s1_r1, "base_url");
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -776,7 +776,7 @@ public class TestCollectionAPI extends ReplicaPropertiesBase {
|
|||||||
Replica replica = docCollection.getReplica(replicaName);
|
Replica replica = docCollection.getReplica(replicaName);
|
||||||
Map<String, String> propMap = new HashMap<>();
|
Map<String, String> propMap = new HashMap<>();
|
||||||
for (String prop : props) {
|
for (String prop : props) {
|
||||||
propMap.put(prop, replica.getStr(prop));
|
propMap.put(prop, replica.getProperty(prop));
|
||||||
}
|
}
|
||||||
return propMap;
|
return propMap;
|
||||||
}
|
}
|
||||||
|
@ -103,7 +103,7 @@ public class TestReplicaProperties extends ReplicaPropertiesBase {
|
|||||||
"collection", COLLECTION_NAME,
|
"collection", COLLECTION_NAME,
|
||||||
"property", "preferredLeader");
|
"property", "preferredLeader");
|
||||||
|
|
||||||
verifyUniqueAcrossCollection(client, COLLECTION_NAME, "property.preferredleader");
|
verifyUniqueAcrossCollection(client, COLLECTION_NAME, "preferredleader");
|
||||||
|
|
||||||
doPropertyAction(client,
|
doPropertyAction(client,
|
||||||
"action", CollectionParams.CollectionAction.BALANCESHARDUNIQUE.toString(),
|
"action", CollectionParams.CollectionAction.BALANCESHARDUNIQUE.toString(),
|
||||||
@ -170,7 +170,7 @@ public class TestReplicaProperties extends ReplicaPropertiesBase {
|
|||||||
"shardUnique", "true");
|
"shardUnique", "true");
|
||||||
|
|
||||||
verifyPropertyVal(client, COLLECTION_NAME,
|
verifyPropertyVal(client, COLLECTION_NAME,
|
||||||
c1_s1_r1, "property.bogus1", "true");
|
c1_s1_r1, "bogus1", "true");
|
||||||
verifyPropertyVal(client, COLLECTION_NAME,
|
verifyPropertyVal(client, COLLECTION_NAME,
|
||||||
c1_s1_r2, "property.bogus1", "whatever");
|
c1_s1_r2, "property.bogus1", "whatever");
|
||||||
|
|
||||||
|
@ -159,6 +159,17 @@ public class Replica extends ZkNodeProps {
|
|||||||
return this.type;
|
return this.type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getProperty(String propertyName) {
|
||||||
|
final String propertyKey;
|
||||||
|
if (!propertyName.startsWith(ZkStateReader.PROPERTY_PROP_PREFIX)) {
|
||||||
|
propertyKey = ZkStateReader.PROPERTY_PROP_PREFIX+propertyName;
|
||||||
|
} else {
|
||||||
|
propertyKey = propertyName;
|
||||||
|
}
|
||||||
|
final String propertyValue = getStr(propertyKey);
|
||||||
|
return propertyValue;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return name + ':' + JSONUtil.toJSON(propMap, -1); // small enough, keep it on one line (i.e. no indent)
|
return name + ':' + JSONUtil.toJSON(propMap, -1); // small enough, keep it on one line (i.e. no indent)
|
||||||
|
@ -83,6 +83,7 @@ public class ZkStateReader implements Closeable {
|
|||||||
public static final String NUM_SHARDS_PROP = "numShards";
|
public static final String NUM_SHARDS_PROP = "numShards";
|
||||||
public static final String LEADER_PROP = "leader";
|
public static final String LEADER_PROP = "leader";
|
||||||
public static final String PROPERTY_PROP = "property";
|
public static final String PROPERTY_PROP = "property";
|
||||||
|
public static final String PROPERTY_PROP_PREFIX = "property.";
|
||||||
public static final String PROPERTY_VALUE_PROP = "property.value";
|
public static final String PROPERTY_VALUE_PROP = "property.value";
|
||||||
public static final String MAX_AT_ONCE_PROP = "maxAtOnce";
|
public static final String MAX_AT_ONCE_PROP = "maxAtOnce";
|
||||||
public static final String MAX_WAIT_SECONDS_PROP = "maxWaitSeconds";
|
public static final String MAX_WAIT_SECONDS_PROP = "maxWaitSeconds";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user