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 2017/10/12 18:58:56 UTC
[1/2] lucene-solr:jira/solr-11285: Ref Guide: fix anchor refs that
failed the build
Repository: lucene-solr
Updated Branches:
refs/heads/jira/solr-11285 2b34fa471 -> ab4748a19
Ref Guide: fix anchor refs that failed the build
Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/2b5567e9
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/2b5567e9
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/2b5567e9
Branch: refs/heads/jira/solr-11285
Commit: 2b5567e9e06430e322e9298052bd5cf64f24fe34
Parents: 2b34fa4
Author: Cassandra Targett <ct...@apache.org>
Authored: Thu Oct 12 06:34:54 2017 -0500
Committer: Andrzej Bialecki <ab...@apache.org>
Committed: Thu Oct 12 20:56:54 2017 +0200
----------------------------------------------------------------------
solr/solr-ref-guide/src/solrcloud-autoscaling-overview.adoc | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/2b5567e9/solr/solr-ref-guide/src/solrcloud-autoscaling-overview.adoc
----------------------------------------------------------------------
diff --git a/solr/solr-ref-guide/src/solrcloud-autoscaling-overview.adoc b/solr/solr-ref-guide/src/solrcloud-autoscaling-overview.adoc
index 6d0dcb9..c14965a 100644
--- a/solr/solr-ref-guide/src/solrcloud-autoscaling-overview.adoc
+++ b/solr/solr-ref-guide/src/solrcloud-autoscaling-overview.adoc
@@ -85,13 +85,13 @@ Now that we have an idea about how cluster management operations use policy and
The `autoAddReplicas` parameter passed to the create collection API in the quickstart section automatically creates a trigger that watches for a node going away. When the trigger fires, it computes and executes a plan to move all replicas hosted by the lost node to new nodes in the cluster. The target nodes are chosen based on the policy and preferences.
-You can learn more about Triggers in the section <<solrcloud-autoscaling-triggers.adoc,AutoScaling Triggers>>.
+You can learn more about Triggers in the section <<solrcloud-autoscaling-triggers.adoc#solrcloud-autoscaling-triggers,AutoScaling Triggers>>.
== Listeners
An AutoScaling *Listener* can be attached to a trigger. Solr calls the listener each time the trigger fires as well as before and after the actions performed by the trigger. Listeners are useful as a call back mechanism to perform tasks such as logging or informing external systems about events. For example, a listener is automatically added by Solr to each Trigger to log details of the trigger fire and actions to the `.system` collection.
-You can learn more about Listeners in the section <<solrcloud-autoscaling-policy-preferences.adoc,AutoScaling Listeners>>.
+You can learn more about Listeners in the section <<solrcloud-autoscaling-policy-preferences.adoc#solrcloud-autoscaling-policy-preferences,AutoScaling Listeners>>.
== Autoscaling APIs
[2/2] lucene-solr:jira/solr-11285: SOLR-11451:
ComputePlanActionTest.testNodeLost() failure
Posted by ab...@apache.org.
SOLR-11451: ComputePlanActionTest.testNodeLost() failure
Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/ab4748a1
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/ab4748a1
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/ab4748a1
Branch: refs/heads/jira/solr-11285
Commit: ab4748a197794fd7ac9cda2702e7dd78e2121dc8
Parents: 2b5567e
Author: Noble Paul <no...@apache.org>
Authored: Fri Oct 13 00:13:42 2017 +1030
Committer: Andrzej Bialecki <ab...@apache.org>
Committed: Thu Oct 12 20:58:43 2017 +0200
----------------------------------------------------------------------
.../cloud/autoscaling/ComputePlanAction.java | 4 ++--
.../solr/cloud/autoscaling/TriggerEvent.java | 8 ++-----
.../autoscaling/ComputePlanActionTest.java | 23 +++++++++++++++-----
3 files changed, 21 insertions(+), 14 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/ab4748a1/solr/core/src/java/org/apache/solr/cloud/autoscaling/ComputePlanAction.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/cloud/autoscaling/ComputePlanAction.java b/solr/core/src/java/org/apache/solr/cloud/autoscaling/ComputePlanAction.java
index 9f74806..67a3704 100644
--- a/solr/core/src/java/org/apache/solr/cloud/autoscaling/ComputePlanAction.java
+++ b/solr/core/src/java/org/apache/solr/cloud/autoscaling/ComputePlanAction.java
@@ -81,12 +81,12 @@ public class ComputePlanAction extends TriggerActionBase {
case NODEADDED:
suggester = session.getSuggester(CollectionParams.CollectionAction.MOVEREPLICA)
.hint(Policy.Suggester.Hint.TARGET_NODE, event.getProperty(TriggerEvent.NODE_NAMES));
- log.debug("Created suggester with targetNode: {}", event.getProperty(TriggerEvent.NODE_NAMES));
+ log.debug("NODEADDED Created suggester with targetNode: {}", event.getProperty(TriggerEvent.NODE_NAMES));
break;
case NODELOST:
suggester = session.getSuggester(CollectionParams.CollectionAction.MOVEREPLICA)
.hint(Policy.Suggester.Hint.SRC_NODE, event.getProperty(TriggerEvent.NODE_NAMES));
- log.debug("Created suggester with srcNode: {}", event.getProperty(TriggerEvent.NODE_NAMES));
+ log.debug("NODELOST Created suggester with srcNode: {}", event.getProperty(TriggerEvent.NODE_NAMES));
break;
default:
throw new UnsupportedOperationException("No support for events other than nodeAdded and nodeLost, received: " + event.getEventType());
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/ab4748a1/solr/core/src/java/org/apache/solr/cloud/autoscaling/TriggerEvent.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/cloud/autoscaling/TriggerEvent.java b/solr/core/src/java/org/apache/solr/cloud/autoscaling/TriggerEvent.java
index 33eeebe..3d436af 100644
--- a/solr/core/src/java/org/apache/solr/cloud/autoscaling/TriggerEvent.java
+++ b/solr/core/src/java/org/apache/solr/cloud/autoscaling/TriggerEvent.java
@@ -22,6 +22,7 @@ import java.util.Map;
import org.apache.solr.client.solrj.cloud.autoscaling.TriggerEventType;
import org.apache.solr.common.MapWriter;
+import org.apache.solr.common.util.Utils;
import org.apache.solr.util.IdUtils;
/**
@@ -145,11 +146,6 @@ public class TriggerEvent implements MapWriter {
@Override
public String toString() {
- return this.getClass().getSimpleName() + "{" +
- "id='" + id + '\'' +
- ", source='" + source + '\'' +
- ", eventTime=" + eventTime +
- ", properties=" + properties +
- '}';
+ return Utils.toJSONString(this);
}
}
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/ab4748a1/solr/core/src/test/org/apache/solr/cloud/autoscaling/ComputePlanActionTest.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/cloud/autoscaling/ComputePlanActionTest.java b/solr/core/src/test/org/apache/solr/cloud/autoscaling/ComputePlanActionTest.java
index dfbcf73..621fc1a 100644
--- a/solr/core/src/test/org/apache/solr/cloud/autoscaling/ComputePlanActionTest.java
+++ b/solr/core/src/test/org/apache/solr/cloud/autoscaling/ComputePlanActionTest.java
@@ -19,6 +19,7 @@ package org.apache.solr.cloud.autoscaling;
import java.io.IOException;
import java.lang.invoke.MethodHandles;
+import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CountDownLatch;
@@ -55,7 +56,7 @@ import static org.apache.solr.common.params.CollectionParams.CollectionAction.MO
/**
* Test for {@link ComputePlanAction}
*/
-@LogLevel("org.apache.solr.cloud.autoscaling=DEBUG;org.apache.solr.cloud.Overseer=DEBUG;org.apache.solr.cloud.overseer=DEBUG;")
+@LogLevel("org.apache.solr.cloud.autoscaling=DEBUG;org.apache.solr.cloud.Overseer=DEBUG;org.apache.solr.cloud.overseer=DEBUG;org.apache.solr.client.solrj.impl.SolrClientDataProvider=DEBUG;")
public class ComputePlanActionTest extends SolrCloudTestCase {
private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
@@ -143,13 +144,14 @@ public class ComputePlanActionTest extends SolrCloudTestCase {
// let's start a node so that we have at least two
JettySolrRunner runner = cluster.startJettySolrRunner();
String node = runner.getNodeName();
+ AssertingTriggerAction.expectedNode = node;
CloudSolrClient solrClient = cluster.getSolrClient();
String setTriggerCommand = "{" +
"'set-trigger' : {" +
"'name' : 'node_lost_trigger'," +
"'event' : 'nodeLost'," +
- "'waitFor' : '1s'," +
+ "'waitFor' : '7s'," +
"'enabled' : true," +
"'actions' : [{'name':'compute_plan', 'class' : 'solr.ComputePlanAction'}," +
"{'name':'test','class':'" + ComputePlanActionTest.AssertingTriggerAction.class.getName() + "'}]" +
@@ -186,14 +188,15 @@ public class ComputePlanActionTest extends SolrCloudTestCase {
break;
}
}
+ log.info("$$$$$$$$$$$$$$Stopped_node : {}", node);
cluster.waitForAllNodes(30);
- assertTrue("Trigger was not fired even after 5 seconds", triggerFiredLatch.await(5, TimeUnit.SECONDS));
+ assertTrue("Trigger was not fired even after 10 seconds", triggerFiredLatch.await(10, TimeUnit.SECONDS));
assertTrue(fired.get());
Map context = actionContextPropsRef.get();
assertNotNull(context);
List<SolrRequest> operations = (List<SolrRequest>) context.get("operations");
- assertNotNull("The operations computed by ComputePlanAction should not be null , "+ getNodeStateProviderState(), operations);
+ assertNotNull("The operations computed by ComputePlanAction should not be null , "+ getNodeStateProviderState() + eventRef.get(), operations);
assertEquals("ComputePlanAction should have computed exactly 1 operation", 1, operations.size());
SolrRequest solrRequest = operations.get(0);
SolrParams params = solrRequest.getParams();
@@ -220,6 +223,8 @@ public class ComputePlanActionTest extends SolrCloudTestCase {
}
public void testNodeWithMultipleReplicasLost() throws Exception {
+ AssertingTriggerAction.expectedNode = null;
+
// start 3 more nodes
cluster.startJettySolrRunner();
cluster.startJettySolrRunner();
@@ -279,7 +284,7 @@ public class ComputePlanActionTest extends SolrCloudTestCase {
Map context = actionContextPropsRef.get();
assertNotNull(context);
List<SolrRequest> operations = (List<SolrRequest>) context.get("operations");
- assertNotNull("The operations computed by ComputePlanAction should not be null "+ getNodeStateProviderState(), operations);
+ assertNotNull("The operations computed by ComputePlanAction should not be null "+ getNodeStateProviderState() + actionContextPropsRef.get(), operations);
operations.forEach(solrRequest -> log.info(solrRequest.getParams().toString()));
assertEquals("ComputePlanAction should have computed exactly 2 operation", 2, operations.size());
@@ -293,6 +298,7 @@ public class ComputePlanActionTest extends SolrCloudTestCase {
@Test
public void testNodeAdded() throws Exception {
+ AssertingTriggerAction.expectedNode = null;
CloudSolrClient solrClient = cluster.getSolrClient();
String setTriggerCommand = "{" +
"'set-trigger' : {" +
@@ -345,7 +351,7 @@ public class ComputePlanActionTest extends SolrCloudTestCase {
Map context = actionContextPropsRef.get();
assertNotNull(context);
List<SolrRequest> operations = (List<SolrRequest>) context.get("operations");
- assertNotNull("The operations computed by ComputePlanAction should not be null" + getNodeStateProviderState(), operations);
+ assertNotNull("The operations computed by ComputePlanAction should not be null" + getNodeStateProviderState() + context, operations);
assertEquals("ComputePlanAction should have computed exactly 1 operation", 1, operations.size());
SolrRequest request = operations.get(0);
SolrParams params = request.getParams();
@@ -355,6 +361,7 @@ public class ComputePlanActionTest extends SolrCloudTestCase {
}
public static class AssertingTriggerAction implements TriggerAction {
+ static String expectedNode;
@Override
public String getName() {
@@ -363,6 +370,10 @@ public class ComputePlanActionTest extends SolrCloudTestCase {
@Override
public void process(TriggerEvent event, ActionContext context) {
+ if (expectedNode != null) {
+ Collection nodes = (Collection) event.getProperty(TriggerEvent.NODE_NAMES);
+ if (nodes == null || !nodes.contains(expectedNode)) return;//this is not the event we are looking for
+ }
if (fired.compareAndSet(false, true)) {
eventRef.set(event);
actionContextPropsRef.set(context.getProperties());