dsmiley commented on code in PR #2811:
URL: https://github.com/apache/solr/pull/2811#discussion_r1824671510
##########
solr/solrj/src/java/org/apache/solr/client/solrj/impl/LBSolrClient.java:
##########
@@ -610,7 +611,7 @@ private void checkAZombieServer(EndpointWrapper
zombieServer) {
final String effectiveCollection =
Objects.requireNonNullElse(zombieEndpoint.getCore(),
getDefaultCollection());
final var responseRaw =
- doMakeRequest(
+ doRequest(
getClient(zombieEndpoint),
zombieEndpoint.getBaseUrl(),
Review Comment:
you didn't want to pass simply the endpoint (the overload)? Same for the
other cases in this file.
##########
solr/solrj/src/java/org/apache/solr/client/solrj/impl/LBSolrClient.java:
##########
@@ -480,14 +480,35 @@ private static boolean isTimeExceeded(long
timeAllowedNano, long timeOutTime) {
return timeAllowedNano > 0 && System.nanoTime() > timeOutTime;
}
+ private NamedList<Object> doMakeRequest(Endpoint endpoint, SolrRequest<?>
solrRequest)
+ throws SolrServerException, IOException {
+ final var solrClient = getClient(endpoint);
+ return doMakeRequest(solrClient, endpoint.getBaseUrl(),
endpoint.getCore(), solrRequest);
+ }
+
+ // TODO This special casing can be removed if either: (1) SOLR-16367 is
completed, or (2)
+ // LBHttp2SolrClient.getClient() is modified to return a client already
pointed at the correct URL
+ private NamedList<Object> doMakeRequest(
+ SolrClient solrClient, String baseUrl, String collection, SolrRequest<?>
solrRequest)
+ throws SolrServerException, IOException {
+ // Some implementations of LBSolrClient.getClient(...) return a
Http2SolrClient that may not be
+ // pointed at the desired URL (or any URL for that matter). We special
case that here to ensure
+ // the appropriate URL is provided.
+ if (solrClient instanceof Http2SolrClient) {
+ final var httpSolrClient = (Http2SolrClient) solrClient;
+ return httpSolrClient.requestWithBaseUrl(baseUrl, (c) ->
c.request(solrRequest, collection));
+ }
+
+ return solrClient.request(solrRequest, collection);
Review Comment:
Then maybe we should simply have LBSolrClient cache an HTTP based SolrClient
per baseURL. Such underlying clients can share the underlying HttpClient.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]