You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by is...@apache.org on 2021/04/05 21:23:59 UTC
[lucene-solr] 08/17: more logging
This is an automated email from the ASF dual-hosted git repository.
ishan pushed a commit to branch prs-perf-test
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git
commit faff0ee560aefa73990c673cc213dca7516989af
Author: noblepaul <no...@gmail.com>
AuthorDate: Sat Feb 6 00:00:11 2021 +1100
more logging
---
solr/core/src/java/org/apache/solr/cloud/Overseer.java | 13 ++++++++++++-
.../src/java/org/apache/solr/common/cloud/WaitTime.java | 12 ++++++++++++
2 files changed, 24 insertions(+), 1 deletion(-)
diff --git a/solr/core/src/java/org/apache/solr/cloud/Overseer.java b/solr/core/src/java/org/apache/solr/cloud/Overseer.java
index 3f52f74..3e17fc0 100644
--- a/solr/core/src/java/org/apache/solr/cloud/Overseer.java
+++ b/solr/core/src/java/org/apache/solr/cloud/Overseer.java
@@ -56,6 +56,7 @@ import org.apache.solr.common.cloud.ConnectionManager;
import org.apache.solr.common.cloud.DocCollection;
import org.apache.solr.common.cloud.Slice;
import org.apache.solr.common.cloud.SolrZkClient;
+import org.apache.solr.common.cloud.WaitTime;
import org.apache.solr.common.cloud.ZkNodeProps;
import org.apache.solr.common.cloud.ZkStateReader;
import org.apache.solr.common.params.CollectionAdminParams;
@@ -200,14 +201,18 @@ public class Overseer implements SolrCloseable {
}
// force flush to ZK after each message because there is no fallback if workQueue items
// are removed from workQueue but fail to be written to ZK
+ WaitTime.start("processQueueItem");
try {
clusterState = processQueueItem(message, clusterState, zkStateWriter, false, null);
+ log.info("processQueueItem : {}", WaitTime.timeElapsed());
} catch (Exception e) {
if (isBadMessage(e)) {
log.warn("Exception when process message = {}, consider as bad message and poll out from the queue", message);
fallbackQueue.poll();
}
throw e;
+ } finally {
+ WaitTime.end();
}
fallbackQueue.poll(); // poll-ing removes the element we got by peek-ing
data = fallbackQueue.peek();
@@ -390,7 +395,13 @@ public class Overseer implements SolrCloseable {
if (collectionAction != null) {
switch (collectionAction) {
case CREATE:
- return Collections.singletonList(new ClusterStateMutator(getSolrCloudManager()).createCollection(clusterState, message));
+ WaitTime.start("createCollection");
+ try {
+ return Collections.singletonList(new ClusterStateMutator(getSolrCloudManager()).createCollection(clusterState, message));
+ } finally {
+ log.info("createCollection time {}", WaitTime.timeElapsed());
+ WaitTime.end();
+ }
case DELETE:
return Collections.singletonList(new ClusterStateMutator(getSolrCloudManager()).deleteCollection(clusterState, message));
case CREATESHARD:
diff --git a/solr/solrj/src/java/org/apache/solr/common/cloud/WaitTime.java b/solr/solrj/src/java/org/apache/solr/common/cloud/WaitTime.java
index 75d0b8d..4e5df09 100644
--- a/solr/solrj/src/java/org/apache/solr/common/cloud/WaitTime.java
+++ b/solr/solrj/src/java/org/apache/solr/common/cloud/WaitTime.java
@@ -47,6 +47,18 @@ public class WaitTime {
}
+ public static long timeElapsed() {
+ WaitTime val = null;
+ try {
+ val = current.get().peek();
+ if (val == null) return 0;
+ return System.currentTimeMillis() - val.start;
+ } catch (Exception e) {
+ e.printStackTrace();
+ return 0;
+ }
+ }
+
public static void end() {
WaitTime val = null;
try {