tflobbe commented on a change in pull request #677: SOLR-13257: support for
stable replica routing preferences
URL: https://github.com/apache/lucene-solr/pull/677#discussion_r302281692
##########
File path:
solr/core/src/java/org/apache/solr/handler/component/HttpShardHandlerFactory.java
##########
@@ -197,6 +200,60 @@ private static boolean getDisableShardsWhitelist() {
return Boolean.getBoolean(INIT_SOLR_DISABLE_SHARDS_WHITELIST);
}
+ private static NamedList<?> getNamedList(Object val) {
+ if (val instanceof NamedList) {
+ return (NamedList<?>)val;
+ } else {
+ throw new IllegalArgumentException("Invalid config for replicaRouting: "
+ val);
+ }
+ }
+
+ private static String checkDefaultReplicaListTransformer(NamedList<?> c,
String setTo, String extantDefaultRouting) {
+ if (!Boolean.TRUE.equals(c.getBooleanArg("default"))) {
+ return null;
+ } else {
+ if (extantDefaultRouting == null) {
+ return ShardParams.REPLICA_STABLE;
+ } else {
+ throw new IllegalArgumentException("more than one routing scheme
marked as default");
+ }
+ }
+ }
+
+ private void initReplicaListTransformers(NamedList args) {
+ String defaultRouting = null;
+ if (args != null) {
+ NamedList routingConfig = (NamedList)args.get("replicaRouting");
Review comment:
You could also use your `getNamedList` method here for a better error
message at the top level of the config (after a null check)
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]