You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ab...@apache.org on 2018/02/26 09:56:29 UTC

lucene-solr:master: SOLR-11911: Add more details to failure logs, modify the test to create a single event that contains all affected nodes.

Repository: lucene-solr
Updated Branches:
  refs/heads/master 616464388 -> 86be87391


SOLR-11911: Add more details to failure logs, modify the test to create a single event
that contains all affected nodes.


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/86be8739
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/86be8739
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/86be8739

Branch: refs/heads/master
Commit: 86be87391511b3636ea952d40343305762d4f63c
Parents: 6164643
Author: Andrzej Bialecki <ab...@apache.org>
Authored: Mon Feb 26 10:55:11 2018 +0100
Committer: Andrzej Bialecki <ab...@apache.org>
Committed: Mon Feb 26 10:56:22 2018 +0100

----------------------------------------------------------------------
 .../cloud/autoscaling/sim/TestLargeCluster.java | 39 +++++++++++---------
 .../client/solrj/cloud/autoscaling/Policy.java  |  7 +++-
 2 files changed, 27 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/86be8739/solr/core/src/test/org/apache/solr/cloud/autoscaling/sim/TestLargeCluster.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/cloud/autoscaling/sim/TestLargeCluster.java b/solr/core/src/test/org/apache/solr/cloud/autoscaling/sim/TestLargeCluster.java
index 523076a..9c9d3bb 100644
--- a/solr/core/src/test/org/apache/solr/cloud/autoscaling/sim/TestLargeCluster.java
+++ b/solr/core/src/test/org/apache/solr/cloud/autoscaling/sim/TestLargeCluster.java
@@ -496,6 +496,26 @@ public class TestLargeCluster extends SimSolrCloudTestCase {
   //@AwaitsFix(bugUrl = "https://issues.apache.org/jira/browse/SOLR-11714")
   public void testSearchRate() throws Exception {
     SolrClient solrClient = cluster.simGetSolrClient();
+    String collectionName = "testSearchRate";
+    CollectionAdminRequest.Create create = CollectionAdminRequest.createCollection(collectionName,
+        "conf", 2, 10);
+    create.process(solrClient);
+
+    log.info("Ready after " + waitForState(collectionName, 300, TimeUnit.SECONDS, clusterShape(2, 10)) + " ms");
+
+    // collect the node names for shard1
+    Set<String> nodes = new HashSet<>();
+    cluster.getSimClusterStateProvider().getClusterState().getCollection(collectionName)
+        .getSlice("shard1")
+        .getReplicas()
+        .forEach(r -> nodes.add(r.getNodeName()));
+
+    String metricName = "QUERY./select.requestTimes:1minRate";
+    // simulate search traffic
+    cluster.getSimClusterStateProvider().simSetShardValue(collectionName, "shard1", metricName, 40, true);
+
+    // now define the trigger. doing it earlier may cause partial events to be generated (where only some
+    // nodes / replicas exceeded the threshold).
     String setTriggerCommand = "{" +
         "'set-trigger' : {" +
         "'name' : 'search_rate_trigger'," +
@@ -525,25 +545,8 @@ public class TestLargeCluster extends SimSolrCloudTestCase {
     response = solrClient.request(req);
     assertEquals(response.get("result").toString(), "success");
 
-    String collectionName = "testSearchRate";
-    CollectionAdminRequest.Create create = CollectionAdminRequest.createCollection(collectionName,
-        "conf", 2, 10);
-    create.process(solrClient);
-
-    log.info("Ready after " + waitForState(collectionName, 300, TimeUnit.SECONDS, clusterShape(2, 10)) + " ms");
-
-    // collect the node names for shard1
-    Set<String> nodes = new HashSet<>();
-    cluster.getSimClusterStateProvider().getClusterState().getCollection(collectionName)
-        .getSlice("shard1")
-        .getReplicas()
-        .forEach(r -> nodes.add(r.getNodeName()));
-
-    String metricName = "QUERY./select.requestTimes:1minRate";
-    // simulate search traffic
-    cluster.getSimClusterStateProvider().simSetShardValue(collectionName, "shard1", metricName, 40, true);
 
-    boolean await = triggerFiredLatch.await(20000 / SPEED, TimeUnit.MILLISECONDS);
+    boolean await = triggerFiredLatch.await(40000 / SPEED, TimeUnit.MILLISECONDS);
     assertTrue("The trigger did not fire at all", await);
     // wait for listener to capture the SUCCEEDED stage
     cluster.getTimeSource().sleep(2000);

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/86be8739/solr/solrj/src/java/org/apache/solr/client/solrj/cloud/autoscaling/Policy.java
----------------------------------------------------------------------
diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/cloud/autoscaling/Policy.java b/solr/solrj/src/java/org/apache/solr/client/solrj/cloud/autoscaling/Policy.java
index 91932ea..f2e1016 100644
--- a/solr/solrj/src/java/org/apache/solr/client/solrj/cloud/autoscaling/Policy.java
+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/cloud/autoscaling/Policy.java
@@ -343,7 +343,12 @@ public class Policy implements MapWriter {
       //this is to set the approximate value according to the precision
       ArrayList<Row> tmpMatrix = new ArrayList<>(matrix);
       for (Preference p : clusterPreferences) {
-        Collections.sort(tmpMatrix, (r1, r2) -> p.compare(r1, r2, false));
+        try {
+          Collections.sort(tmpMatrix, (r1, r2) -> p.compare(r1, r2, false));
+        } catch (Exception e) {
+          LOG.error("Exception! prefs = {}, matrix = {}", clusterPreferences, matrix);
+          throw e;
+        }
         p.setApproxVal(tmpMatrix);
       }
       //approximate values are set now. Let's do recursive sorting