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 2019/04/15 01:10:40 UTC
[lucene-solr] branch master updated: SOLR-13395: make
DebugComponent.getRequestId() public
This is an automated email from the ASF dual-hosted git repository.
noble pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git
The following commit(s) were added to refs/heads/master by this push:
new e783207 SOLR-13395: make DebugComponent.getRequestId() public
e783207 is described below
commit e78320753583081c7402d66a259949ab85c8250e
Author: Noble Paul <no...@apache.org>
AuthorDate: Mon Apr 15 11:10:06 2019 +1000
SOLR-13395: make DebugComponent.getRequestId() public
---
.../solr/handler/component/DebugComponent.java | 20 ++++++++++++--------
1 file changed, 12 insertions(+), 8 deletions(-)
diff --git a/solr/core/src/java/org/apache/solr/handler/component/DebugComponent.java b/solr/core/src/java/org/apache/solr/handler/component/DebugComponent.java
index 1f398a9..87076a0 100644
--- a/solr/core/src/java/org/apache/solr/handler/component/DebugComponent.java
+++ b/solr/core/src/java/org/apache/solr/handler/component/DebugComponent.java
@@ -145,23 +145,27 @@ public class DebugComponent extends SearchComponent
private void doDebugTrack(ResponseBuilder rb) {
- SolrQueryRequest req = rb.req;
+ String rid = getRequestId(rb.req);
+ rb.addDebug(rid, "track", CommonParams.REQUEST_ID);//to see it in the response
+ rb.rsp.addToLog(CommonParams.REQUEST_ID, rid); //to see it in the logs of the landing core
+
+ }
+
+ public static String getRequestId(SolrQueryRequest req) {
String rid = req.getParams().get(CommonParams.REQUEST_ID);
if(rid == null || "".equals(rid)) {
- rid = generateRid(rb);
+ rid = generateRid(req);
ModifiableSolrParams params = new ModifiableSolrParams(req.getParams());
params.add(CommonParams.REQUEST_ID, rid);//add rid to the request so that shards see it
req.setParams(params);
}
- rb.addDebug(rid, "track", CommonParams.REQUEST_ID);//to see it in the response
- rb.rsp.addToLog(CommonParams.REQUEST_ID, rid); //to see it in the logs of the landing core
-
+ return rid;
}
@SuppressForbidden(reason = "Need currentTimeMillis, only used for naming")
- private String generateRid(ResponseBuilder rb) {
- String hostName = rb.req.getCore().getCoreContainer().getHostName();
- return hostName + "-" + rb.req.getCore().getName() + "-" + System.currentTimeMillis() + "-" + ridCounter.getAndIncrement();
+ private static String generateRid(SolrQueryRequest req) {
+ String hostName = req.getCore().getCoreContainer().getHostName();
+ return hostName + "-" + req.getCore().getName() + "-" + System.currentTimeMillis() + "-" + ridCounter.getAndIncrement();
}
@Override