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:15:17 UTC

[lucene-solr] branch branch_8x 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 branch_8x
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git


The following commit(s) were added to refs/heads/branch_8x by this push:
     new d7e3953  SOLR-13395: make DebugComponent.getRequestId() public
d7e3953 is described below

commit d7e3953ada4884e75763c7c550360ffe9a4e1d61
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