From commits-return-111624-archive-asf-public=cust-asf.ponee.io@lucene.apache.org Thu Dec 5 17:28:12 2019 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [207.244.88.153]) by mx-eu-01.ponee.io (Postfix) with SMTP id E7F64180643 for ; Thu, 5 Dec 2019 18:28:11 +0100 (CET) Received: (qmail 54828 invoked by uid 500); 5 Dec 2019 17:28:11 -0000 Mailing-List: contact commits-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@lucene.apache.org Delivered-To: mailing list commits@lucene.apache.org Received: (qmail 54795 invoked by uid 99); 5 Dec 2019 17:28:10 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 05 Dec 2019 17:28:10 +0000 Received: by gitbox.apache.org (ASF Mail Server at gitbox.apache.org, from userid 33) id 886B58D809; Thu, 5 Dec 2019 17:28:10 +0000 (UTC) Date: Thu, 05 Dec 2019 17:28:10 +0000 To: "commits@lucene.apache.org" Subject: [lucene-solr] branch master updated: SOLR-13831: Context property _loop_iter_ should be a string in order to support variable expansion. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Message-ID: <157556689026.6992.7081296971993188044@gitbox.apache.org> From: ab@apache.org X-Git-Host: gitbox.apache.org X-Git-Repo: lucene-solr X-Git-Refname: refs/heads/master X-Git-Reftype: branch X-Git-Oldrev: 2387bb9d60ae44eeeb4fbcb2f2877f46be5303a0 X-Git-Newrev: d2b01ef28f918e2f3575081c206203be49889501 X-Git-Rev: d2b01ef28f918e2f3575081c206203be49889501 X-Git-NotificationType: ref_changed_plus_diff X-Git-Multimail-Version: 1.5.dev Auto-Submitted: auto-generated This is an automated email from the ASF dual-hosted git repository. ab pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/lucene-solr.git The following commit(s) were added to refs/heads/master by this push: new d2b01ef SOLR-13831: Context property _loop_iter_ should be a string in order to support variable expansion. d2b01ef is described below commit d2b01ef28f918e2f3575081c206203be49889501 Author: Andrzej Bialecki AuthorDate: Thu Dec 5 18:25:49 2019 +0100 SOLR-13831: Context property _loop_iter_ should be a string in order to support variable expansion. --- .../java/org/apache/solr/cloud/autoscaling/sim/SimScenario.java | 2 +- .../org/apache/solr/cloud/autoscaling/sim/TestSimScenario.java | 7 +++++-- .../src/solrcloud-autoscaling-policy-preferences.adoc | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/solr/core/src/java/org/apache/solr/cloud/autoscaling/sim/SimScenario.java b/solr/core/src/java/org/apache/solr/cloud/autoscaling/sim/SimScenario.java index 7914df7..187c66a 100644 --- a/solr/core/src/java/org/apache/solr/cloud/autoscaling/sim/SimScenario.java +++ b/solr/core/src/java/org/apache/solr/cloud/autoscaling/sim/SimScenario.java @@ -301,7 +301,7 @@ public class SimScenario implements AutoCloseable { log.info(" -- abortLoop requested, aborting after " + i + " iterations."); return; } - scenario.context.put(LOOP_ITER_PROP, i); + scenario.context.put(LOOP_ITER_PROP, String.valueOf(i)); log.info(" * iter " + (i + 1) + ":"); for (SimOp op : ops) { op.prepareCurrentParams(scenario); diff --git a/solr/core/src/test/org/apache/solr/cloud/autoscaling/sim/TestSimScenario.java b/solr/core/src/test/org/apache/solr/cloud/autoscaling/sim/TestSimScenario.java index 24f7b86..6f00151 100644 --- a/solr/core/src/test/org/apache/solr/cloud/autoscaling/sim/TestSimScenario.java +++ b/solr/core/src/test/org/apache/solr/cloud/autoscaling/sim/TestSimScenario.java @@ -77,12 +77,15 @@ public class TestSimScenario extends SimSolrCloudTestCase { "loop_end\n" + "loop_start iterations=${justCalc}\n" + " calculate_suggestions\n" + + " save_snapshot path=${snapshotPath}/${_loop_iter_}\n" + "loop_end\n" + "dump redact=true"; @Test public void testSuggestions() throws Exception { + String snapshotPath = createTempDir() + "/snapshot"; try (SimScenario scenario = SimScenario.load(testSuggestionsScenario)) { + scenario.context.put("snapshotPath", snapshotPath); ByteArrayOutputStream baos = new ByteArrayOutputStream(); PrintStream ps = new PrintStream(baos, true, Charset.forName("UTF-8")); scenario.console = ps; @@ -101,14 +104,14 @@ public class TestSimScenario extends SimSolrCloudTestCase { List> snapSuggestions = (List>)autoscalingState.get("suggestions"); assertEquals(snapSuggestions.toString(), 1, snapSuggestions.size()); // _loop_iter_ should be present and 0 (first iteration) - assertEquals(0, scenario.context.get(SimScenario.LOOP_ITER_PROP)); + assertEquals("0", scenario.context.get(SimScenario.LOOP_ITER_PROP)); } // try looping more times try (SimScenario scenario = SimScenario.load(testSuggestionsScenario)) { scenario.context.put("iterative", "10"); scenario.context.put("justCalc", "0"); scenario.run(); - assertEquals(9, scenario.context.get(SimScenario.LOOP_ITER_PROP)); + assertEquals("9", scenario.context.get(SimScenario.LOOP_ITER_PROP)); } } diff --git a/solr/solr-ref-guide/src/solrcloud-autoscaling-policy-preferences.adoc b/solr/solr-ref-guide/src/solrcloud-autoscaling-policy-preferences.adoc index cc3373c..d776092 100644 --- a/solr/solr-ref-guide/src/solrcloud-autoscaling-policy-preferences.adoc +++ b/solr/solr-ref-guide/src/solrcloud-autoscaling-policy-preferences.adoc @@ -530,7 +530,7 @@ updated to contain the current values for the following properties: * `_collections_` - a list of existing collections, or absent if there are no collections (or no live nodes) * `_suggestions_` - a list of autoscaling suggestions generated using CREATE_SUGGESTIONS command. * `_responses_` - a list of SolrResponse-s resulting from SOLR_REQUEST commands. -* `_loop_iter_` - current loop iteration, or absent outside of loop. +* `_loop_iter_` - current loop iteration (as a string), or absent outside of loop. * `_trigger_event_` - last trigger event captured by WAIT_EVENT Command parameters support variable expansion using string values from the current context (non-string values, including numeric, are ignored)