Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions solr/core/src/java/org/apache/solr/cloud/ZkController.java
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
import org.apache.solr.client.solrj.cloud.SolrCloudManager;
import org.apache.solr.client.solrj.impl.CloudHttp2SolrClient;
import org.apache.solr.client.solrj.impl.CloudSolrClient;
import org.apache.solr.client.solrj.impl.HttpSolrClient.Builder;
import org.apache.solr.client.solrj.impl.Http2SolrClient;
import org.apache.solr.client.solrj.impl.SolrClientCloudManager;
import org.apache.solr.client.solrj.impl.SolrZkClientTimeout;
import org.apache.solr.client.solrj.impl.ZkClientClusterStateProvider;
Expand Down Expand Up @@ -2306,12 +2306,13 @@ private ZkCoreNodeProps waitForLeaderToSeeDownState(
}

// short timeouts, we may be in a storm and this is just best effort, and maybe we should be
// the
// leader now
// the leader now
// TODO ideally want 8sec connection timeout but can't easily also share the client
// listeners
try (SolrClient client =
new Builder(leaderBaseUrl)
.withConnectionTimeout(8000, TimeUnit.MILLISECONDS)
.withSocketTimeout(30000, TimeUnit.MILLISECONDS)
new Http2SolrClient.Builder(leaderBaseUrl)
.withHttpClient(getCoreContainer().getDefaultHttpSolrClient())
.withIdleTimeout(30000, TimeUnit.MILLISECONDS)
.build()) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about the security listeners?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed it now. It's a trade-off but at least the listener issue could be a real bug

WaitForState prepCmd = new WaitForState();
prepCmd.setCoreName(leaderCoreName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
import org.apache.solr.client.solrj.SolrQuery;
import org.apache.solr.client.solrj.SolrServerException;
import org.apache.solr.client.solrj.impl.CloudSolrClient;
import org.apache.solr.client.solrj.impl.HttpSolrClient.Builder;
import org.apache.solr.client.solrj.impl.Http2SolrClient;
import org.apache.solr.client.solrj.response.QueryResponse;
import org.apache.solr.common.cloud.ClusterState;
import org.apache.solr.common.util.SimpleOrderedMap;
Expand Down Expand Up @@ -124,7 +124,7 @@ public String getDatabaseProductVersion() throws SQLException {
for (String node : liveNodes) {
try {
String nodeURL = Utils.getBaseUrlForNodeName(node, urlScheme);
solrClient = new Builder(nodeURL).build();
solrClient = new Http2SolrClient.Builder(nodeURL).build();

QueryResponse rsp = solrClient.query(sysQuery);
return String.valueOf(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
import org.apache.solr.client.solrj.SolrClient;
import org.apache.solr.client.solrj.SolrRequest;
import org.apache.solr.client.solrj.SolrServerException;
import org.apache.solr.client.solrj.impl.ConcurrentUpdateSolrClient.Update;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't want to use that internal POJO, so I created a similar record, copying the same javadoc line as well.

import org.apache.solr.client.solrj.request.UpdateRequest;
import org.apache.solr.client.solrj.util.ClientUtils;
import org.apache.solr.common.SolrException;
Expand Down Expand Up @@ -177,6 +176,9 @@ protected ConcurrentUpdateHttp2SolrClient(Builder builder) {
// processedCount is now managed by StallDetection
}

/** Class representing an UpdateRequest and an optional collection. */
private record Update(UpdateRequest request, String collection) {}

/** Opens a connection and sends everything... */
class Runner implements Runnable {

Expand Down Expand Up @@ -237,16 +239,16 @@ void sendUpdateStream() throws Exception {

InputStreamResponseListener responseListener = null;
try (Http2SolrClient.OutStream out =
client.initOutStream(basePath, update.getRequest(), update.getCollection())) {
client.initOutStream(basePath, update.request(), update.collection())) {
Update upd = update;
while (upd != null) {
UpdateRequest req = upd.getRequest();
if (!out.belongToThisStream(req, upd.getCollection())) {
UpdateRequest req = upd.request();
if (!out.belongToThisStream(req, upd.collection())) {
// Request has different params or destination core/collection, return to queue
queue.add(upd);
break;
}
client.send(out, upd.getRequest(), upd.getCollection());
client.send(out, upd.request(), upd.collection());
out.flush();

notifyQueueAndRunnersIfEmptyQueue();
Expand Down
Loading