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 11:51:18 UTC
[40/50] [abbrv] lucene-solr:jira/solr-11285: SOLR-11451: added
logging to track the failures
SOLR-11451: added logging to track the failures
Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/371f7315
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/371f7315
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/371f7315
Branch: refs/heads/jira/solr-11285
Commit: 371f7315202ec8fd003692e06927132ace79d6f0
Parents: 11a1075
Author: Noble Paul <no...@apache.org>
Authored: Wed Oct 11 00:42:55 2017 +1030
Committer: Noble Paul <no...@apache.org>
Committed: Wed Oct 11 00:42:55 2017 +1030
----------------------------------------------------------------------
.../solr/cloud/autoscaling/ComputePlanAction.java | 1 +
.../cloud/autoscaling/ComputePlanActionTest.java | 18 +++++++++++++++---
.../client/solrj/impl/SolrClientDataProvider.java | 6 ++++++
3 files changed, 22 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/371f7315/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 5d5e3eb..dd710a4 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
@@ -63,6 +63,7 @@ public class ComputePlanAction extends TriggerActionBase {
}
Policy policy = autoScalingConf.getPolicy();
SolrClientDataProvider dataProvider = new SolrClientDataProvider(cloudSolrClient);
+ dataProvider.config = autoScalingConf;
if (log.isDebugEnabled()) {
log.debug("Cluster data provider: {}", dataProvider.toMap(new HashMap<>()));
}
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/371f7315/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 9f1e5de..ae69d00 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
@@ -30,6 +30,7 @@ import org.apache.solr.client.solrj.SolrRequest;
import org.apache.solr.client.solrj.cloud.autoscaling.TriggerEventType;
import org.apache.solr.client.solrj.embedded.JettySolrRunner;
import org.apache.solr.client.solrj.impl.CloudSolrClient;
+import org.apache.solr.client.solrj.impl.SolrClientDataProvider;
import org.apache.solr.client.solrj.request.CollectionAdminRequest;
import org.apache.solr.cloud.SolrCloudTestCase;
import org.apache.solr.common.cloud.ClusterState;
@@ -39,6 +40,7 @@ import org.apache.solr.common.cloud.ZkStateReader;
import org.apache.solr.common.params.CollectionParams;
import org.apache.solr.common.params.SolrParams;
import org.apache.solr.common.util.NamedList;
+import org.apache.solr.common.util.Utils;
import org.apache.solr.util.LogLevel;
import org.junit.Before;
import org.junit.BeforeClass;
@@ -174,6 +176,7 @@ public class ComputePlanActionTest extends SolrCloudTestCase {
// 1 replica per node and none on the overseer
JettySolrRunner node2 = cluster.startJettySolrRunner();
cluster.waitForAllNodes(30);
+ assertTrue(node2.getNodeName() + "is not live yet", cluster.getSolrClient().getZkStateReader().getClusterState().liveNodesContain(node2.getNodeName()) );
// stop the original node
for (int i = 0; i < cluster.getJettySolrRunners().size(); i++) {
@@ -190,7 +193,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", operations);
+ assertNotNull("The operations computed by ComputePlanAction should not be null , "+ getDataProviderState(), operations);
assertEquals("ComputePlanAction should have computed exactly 1 operation", 1, operations.size());
SolrRequest solrRequest = operations.get(0);
SolrParams params = solrRequest.getParams();
@@ -207,6 +210,15 @@ public class ComputePlanActionTest extends SolrCloudTestCase {
}
}
}
+ static String getDataProviderState() {
+ String result = "SolrClientDataProvider.DEBUG";
+ if(SolrClientDataProvider.INST != null) {
+ result+= Utils.toJSONString(SolrClientDataProvider.INST);
+ if(SolrClientDataProvider.INST.config != null) result+= Utils.toJSONString(SolrClientDataProvider.INST.config);
+ }
+ return result;
+
+ }
public void testNodeWithMultipleReplicasLost() throws Exception {
// start 3 more nodes
@@ -268,7 +280,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", operations);
+ assertNotNull("The operations computed by ComputePlanAction should not be null "+getDataProviderState(), operations);
operations.forEach(solrRequest -> log.info(solrRequest.getParams().toString()));
assertEquals("ComputePlanAction should have computed exactly 2 operation", 2, operations.size());
@@ -334,7 +346,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", operations);
+ assertNotNull("The operations computed by ComputePlanAction should not be null" + getDataProviderState(), operations);
assertEquals("ComputePlanAction should have computed exactly 1 operation", 1, operations.size());
SolrRequest request = operations.get(0);
SolrParams params = request.getParams();
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/371f7315/solr/solrj/src/java/org/apache/solr/client/solrj/impl/SolrClientDataProvider.java
----------------------------------------------------------------------
diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/SolrClientDataProvider.java b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/SolrClientDataProvider.java
index d63f5f0..6558a48 100644
--- a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/SolrClientDataProvider.java
+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/SolrClientDataProvider.java
@@ -32,6 +32,7 @@ import java.util.Set;
import org.apache.solr.client.solrj.SolrRequest;
import org.apache.solr.client.solrj.SolrServerException;
+import org.apache.solr.client.solrj.cloud.autoscaling.AutoScalingConfig;
import org.apache.solr.client.solrj.cloud.autoscaling.ClusterDataProvider;
import org.apache.solr.client.solrj.cloud.autoscaling.ReplicaInfo;
import org.apache.solr.client.solrj.request.GenericSolrRequest;
@@ -61,6 +62,10 @@ import static org.apache.solr.client.solrj.cloud.autoscaling.Clause.METRICS_PREF
*/
public class SolrClientDataProvider implements ClusterDataProvider, MapWriter {
private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
+ //only for debugging
+ public static SolrClientDataProvider INST;
+ //only for debugging, do not use it for anything else
+ public AutoScalingConfig config;
private final CloudSolrClient solrClient;
private final Map<String, Map<String, Map<String, List<ReplicaInfo>>>> data = new HashMap<>();
@@ -84,6 +89,7 @@ public class SolrClientDataProvider implements ClusterDataProvider, MapWriter {
replicas.add(new ReplicaInfo(replica.getName(), collName, shard, replica.getType(), new HashMap<>()));
});
});
+ if(log.isDebugEnabled()) INST = this;
}
@Override