gerlowskija commented on a change in pull request #1574:
URL: https://github.com/apache/lucene-solr/pull/1574#discussion_r450186298



##########
File path: 
solr/core/src/java/org/apache/solr/handler/component/SearchHandler.java
##########
@@ -500,6 +508,31 @@ public void handleRequestBody(SolrQueryRequest req, 
SolrQueryResponse rsp) throw
     }
   }
 
+  private void tagRequestWithRequestId(ResponseBuilder rb) {
+    final boolean ridTaggingDisabled = 
rb.req.getParams().getBool(CommonParams.DISABLE_REQUEST_ID, false);
+    if (! ridTaggingDisabled) {
+      String rid = getRequestId(rb.req);
+      if 
(StringUtils.isBlank(rb.req.getParams().get(CommonParams.REQUEST_ID))) {
+        ModifiableSolrParams params = new 
ModifiableSolrParams(rb.req.getParams());
+        params.add(CommonParams.REQUEST_ID, rid);//add rid to the request so 
that shards see it
+        rb.req.setParams(params);
+      }
+      if (rb.isDistrib) {
+        rb.rsp.addToLog(CommonParams.REQUEST_ID, rid); //to see it in the logs 
of the landing core
+      }
+    }
+  }
+
+  public static String getRequestId(SolrQueryRequest req) {

Review comment:
       To documenting: sure +1.
   
   To your other point, I'm more on the fence.  If we always stored the RID in 
params, this would be a no-brainer.  But on the coordinator node we don't 
because it's displayed separately in coordinator log messages.
   
   I spent some time fiddling with the composition of the helper methods here 
before the long weekend but couldn't come up with an arrangement that made 
sense, without throwing everything in one larger method (that's hard for other 
places, like DebugComponent, to reuse.).  I did come up with some name 
clarifications and Javadocs here though - and I hope those address your 
underlying concern. 




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org

Reply via email to