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

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


The following commit(s) were added to refs/heads/jira/solr16636_test by this 
push:
     new 26d263e42aa  added more debugging 2
26d263e42aa is described below

commit 26d263e42aad188ee54c134834fa4d637854d53d
Author: Noble Paul <[email protected]>
AuthorDate: Wed Feb 22 17:13:30 2023 +1100

     added more debugging 2
---
 .../apache/solr/common/cloud/ZkStateReader.java    | 24 +++++++++++++++++-----
 1 file changed, 19 insertions(+), 5 deletions(-)

diff --git 
a/solr/solrj-zookeeper/src/java/org/apache/solr/common/cloud/ZkStateReader.java 
b/solr/solrj-zookeeper/src/java/org/apache/solr/common/cloud/ZkStateReader.java
index 3709853791b..e19f4aeca92 100644
--- 
a/solr/solrj-zookeeper/src/java/org/apache/solr/common/cloud/ZkStateReader.java
+++ 
b/solr/solrj-zookeeper/src/java/org/apache/solr/common/cloud/ZkStateReader.java
@@ -1904,14 +1904,12 @@ public class ZkStateReader implements SolrCloseable {
   public void waitForState(
       final String collection, long wait, TimeUnit unit, 
CollectionStatePredicate predicate)
       throws InterruptedException, TimeoutException {
-
-    log.info("1Waiting up to {}ms for state {}", unit.toMillis(wait), 
predicate);
     if (closed) {
       throw new AlreadyClosedException();
     }
     DocCollection coll = null;
     try {
-      coll = fetchCachedCollection(collection);
+      coll = getCollandLog(collection);
     } catch (Exception e) {
       log.warn("fetch threw exception",e);
       //do not do anything
@@ -1946,6 +1944,23 @@ public class ZkStateReader implements SolrCloseable {
     }
   }
 
+  private DocCollection getCollandLog(String collection) {
+    long start = System.currentTimeMillis();
+    try {
+      return fetchCachedCollection(collection);
+    } finally {
+      long time = System.currentTimeMillis() - start;
+      StringBuilder sb =  new StringBuilder();
+      StackTraceElement[] st = new RuntimeException().getStackTrace();
+      for (int i = 1; i < 5; i++) {
+        StackTraceElement e = st[i];
+        
sb.append(e.getMethodName()).append("@").append(e.getLineNumber()).append(" > 
");
+      }
+      log.info("fetchCachedCollection. Waited {} callstack : {}", time, sb);
+
+    }
+  }
+
   /**
    * Block until a Predicate returns true, or the wait times out
    *
@@ -1964,7 +1979,6 @@ public class ZkStateReader implements SolrCloseable {
   public DocCollection waitForState(
       final String collection, long wait, TimeUnit unit, 
Predicate<DocCollection> predicate)
       throws InterruptedException, TimeoutException {
-    log.info("2Waiting up to {}ms for state {}", unit.toMillis(wait), 
predicate);
 
     if (log.isDebugEnabled()) {
       log.debug("Waiting up to {}ms for state {}", unit.toMillis(wait), 
predicate);
@@ -1974,7 +1988,7 @@ public class ZkStateReader implements SolrCloseable {
     }
     DocCollection coll = null;
     try {
-      coll = fetchCachedCollection(collection);
+      coll = getCollandLog(collection);
     } catch (Exception e) {
       log.warn("fetch threw exception",e);
       //do not do anything

Reply via email to