You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by no...@apache.org on 2019/05/14 19:37:56 UTC
[lucene-solr] branch jira/SOLR-13468 updated: SOLR-13468:
autoscaling/suggestions should be able to give suggestions from payload
This is an automated email from the ASF dual-hosted git repository.
noble pushed a commit to branch jira/SOLR-13468
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git
The following commit(s) were added to refs/heads/jira/SOLR-13468 by this push:
new 41bd74d SOLR-13468: autoscaling/suggestions should be able to give suggestions from payload
41bd74d is described below
commit 41bd74d610a90814425c4c635573d802272dc4ee
Author: Noble Paul <no...@apache.org>
AuthorDate: Wed May 15 05:37:30 2019 +1000
SOLR-13468: autoscaling/suggestions should be able to give suggestions from payload
---
.../apache/solr/cloud/autoscaling/AutoScalingHandler.java | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/solr/core/src/java/org/apache/solr/cloud/autoscaling/AutoScalingHandler.java b/solr/core/src/java/org/apache/solr/cloud/autoscaling/AutoScalingHandler.java
index 1ef6c26..d187be1 100644
--- a/solr/core/src/java/org/apache/solr/cloud/autoscaling/AutoScalingHandler.java
+++ b/solr/core/src/java/org/apache/solr/cloud/autoscaling/AutoScalingHandler.java
@@ -45,6 +45,7 @@ import org.apache.solr.client.solrj.cloud.autoscaling.PolicyHelper;
import org.apache.solr.client.solrj.cloud.autoscaling.Preference;
import org.apache.solr.client.solrj.cloud.autoscaling.TriggerEventProcessorStage;
import org.apache.solr.client.solrj.cloud.autoscaling.TriggerEventType;
+import org.apache.solr.client.solrj.cloud.autoscaling.VersionedData;
import org.apache.solr.common.MapWriter;
import org.apache.solr.common.SolrException;
import org.apache.solr.common.params.AutoScalingParams;
@@ -71,6 +72,7 @@ import static java.util.stream.Collectors.toSet;
import static org.apache.solr.common.cloud.ZkStateReader.SOLR_AUTOSCALING_CONF_PATH;
import static org.apache.solr.common.params.AutoScalingParams.*;
import static org.apache.solr.common.params.CommonParams.JSON;
+import static org.apache.solr.common.util.Utils.fromJSON;
/**
* Handler for /cluster/autoscaling
@@ -120,7 +122,7 @@ public class AutoScalingHandler extends RequestHandlerBase implements Permission
}
AutoScalingConfig autoScalingConf = cloudManager.getDistribStateManager().getAutoScalingConfig();
- if (parts.size() == 2) {
+ if (parts.size() == 2) {
autoScalingConf.writeMap(new MapWriter.EntryWriter() {
@Override
@@ -140,6 +142,17 @@ public class AutoScalingHandler extends RequestHandlerBase implements Permission
if (req.getContentStreams() == null) {
throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, "No commands specified for autoscaling");
}
+ String path = (String) req.getContext().get("path");
+ if (path != null) {
+ List<String> parts = StrUtils.splitSmart(path, '/');
+ if (parts.size() == 3 && SUGGESTIONS.equals(parts.get(2))) {
+ Map map = (Map) Utils.fromJSON(req.getContentStreams().iterator().next().getStream());
+ AutoScalingConfig config = new AutoScalingConfig(map);
+ handleSuggestions(rsp, config);
+ return;
+ }
+ }
+
List<CommandOperation> ops = CommandOperation.readCommands(req.getContentStreams(), rsp.getValues(), singletonCommands);
if (ops == null) {
// errors have already been added to the response so there's nothing left to do