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 2021/03/30 14:37:08 UTC

[lucene-solr] branch jira/solr15288 updated: added debugging

This is an automated email from the ASF dual-hosted git repository.

noble pushed a commit to branch jira/solr15288
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git


The following commit(s) were added to refs/heads/jira/solr15288 by this push:
     new 2ddfcf8  added debugging
2ddfcf8 is described below

commit 2ddfcf8a5542241b192bf9255aa6aaed90a0f985
Author: Noble Paul <no...@gmail.com>
AuthorDate: Wed Mar 31 01:36:30 2021 +1100

    added debugging
---
 .../java/org/apache/solr/cloud/ZkController.java   | 29 ++++++++++++++++++----
 .../apache/solr/cloud/overseer/ReplicaMutator.java |  1 +
 .../solr/common/cloud/PerReplicaStatesOps.java     |  6 +++++
 3 files changed, 31 insertions(+), 5 deletions(-)

diff --git a/solr/core/src/java/org/apache/solr/cloud/ZkController.java b/solr/core/src/java/org/apache/solr/cloud/ZkController.java
index 475eb41..5456d63 100644
--- a/solr/core/src/java/org/apache/solr/cloud/ZkController.java
+++ b/solr/core/src/java/org/apache/solr/cloud/ZkController.java
@@ -1544,6 +1544,7 @@ public class ZkController implements Closeable {
         }
       }
     }
+    log.info("publish_state : {} , forcePublish: {}, cd: {}",state, forcePublish, cd.getName()  );
     MDCLoggingContext.setCoreDescriptor(cc, cd);
     try {
       String collection = cd.getCloudDescriptor().getCollectionName();
@@ -1618,6 +1619,9 @@ public class ZkController implements Closeable {
       }
       DocCollection coll = zkStateReader.getCollection(collection);
       if (forcePublish || sendToOverseer(coll, coreNodeName)) {
+        if(state == Replica.State.DOWN){
+          log.info("DOWN state being published for replica: "+Utils.toJSONString(m) + " "+coreNodeName, new RuntimeException("SEND.DOWN"));
+        }
         overseerJobQueue.offer(Utils.toJSON(m));
       } else {
         if (log.isDebugEnabled()) {
@@ -1637,15 +1641,30 @@ public class ZkController implements Closeable {
    */
   static boolean sendToOverseer(DocCollection coll, String replicaName) {
     if (coll == null) return true;
-    if (coll.getStateFormat() < 2 || !coll.isPerReplicaState()) return true;
+    if (coll.getStateFormat() < 2 || !coll.isPerReplicaState()) {
+      log.info("sendToOverseer PRS=false");
+      return true;
+    }
     Replica r = coll.getReplica(replicaName);
-    if (r == null) return true;
+    if (r == null) {
+      log.info("sendToOverseer replicaIsNull in state.json");
+      return true;
+    }
     Slice shard = coll.getSlice(r.slice);
     if (shard == null) return true;//very unlikely
-    if (shard.getState() == Slice.State.RECOVERY) return true;
-    if (shard.getParent() != null) return true;
+    if (shard.getState() == Slice.State.RECOVERY) {
+      log.info("sendToOverseer ShardState=Recovery");
+      return true;
+    }
+    if (shard.getParent() != null) {
+      log.info("sendToOverseer shard.parent NOTNULL");
+      return true;
+    }
     for (Slice slice : coll.getSlices()) {
-      if (Objects.equals(shard.getName(), slice.getParent())) return true;
+      if (Objects.equals(shard.getName(), slice.getParent())) {
+        log.info("sendToOverseer IamParentOf  "+ slice.getName());
+        return true;
+      }
     }
     return false;
   }
diff --git a/solr/core/src/java/org/apache/solr/cloud/overseer/ReplicaMutator.java b/solr/core/src/java/org/apache/solr/cloud/overseer/ReplicaMutator.java
index 436aa93..464d1cc 100644
--- a/solr/core/src/java/org/apache/solr/cloud/overseer/ReplicaMutator.java
+++ b/solr/core/src/java/org/apache/solr/cloud/overseer/ReplicaMutator.java
@@ -213,6 +213,7 @@ public class ReplicaMutator {
     if (Overseer.isLegacy(cloudManager.getClusterStateProvider())) {
       return updateState(clusterState, message);
     } else {
+      log.info("MESSAGE: {}", Utils.toJSONString(message));
       return updateStateNew(clusterState, message);
     }
   }
diff --git a/solr/solrj/src/java/org/apache/solr/common/cloud/PerReplicaStatesOps.java b/solr/solrj/src/java/org/apache/solr/common/cloud/PerReplicaStatesOps.java
index 3d3a184..7b4bc74 100644
--- a/solr/solrj/src/java/org/apache/solr/common/cloud/PerReplicaStatesOps.java
+++ b/solr/solrj/src/java/org/apache/solr/common/cloud/PerReplicaStatesOps.java
@@ -115,6 +115,12 @@ public class PerReplicaStatesOps {
    * @param newState the new state
    */
   public static PerReplicaStatesOps flipState(String replica, Replica.State newState, PerReplicaStates rs) {
+    PerReplicaStates.State state = rs.get(replica);
+    if(state != null && state.state == Replica.State.ACTIVE && newState == Replica.State.DOWN) {
+      log.info("replica: " + replica +
+          "marked A->D ", new RuntimeException("DOWN"));
+    }
+
     return new PerReplicaStatesOps(prs -> {
       List<PerReplicaStates.Operation> operations = new ArrayList<>(2);
       PerReplicaStates.State existing = prs.get(replica);