You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ma...@apache.org on 2020/07/30 13:43:59 UTC
[lucene-solr] 02/04: @468 Reenable max outstanding async requests
for http2 client.
This is an automated email from the ASF dual-hosted git repository.
markrmiller pushed a commit to branch reference_impl_dev
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git
commit 53cff67936fc51cdca6c19585ea7b3f0ae56ff45
Author: markrmiller@gmail.com <ma...@gmail.com>
AuthorDate: Thu Jul 30 03:16:53 2020 -0500
@468 Reenable max outstanding async requests for http2 client.
---
.../src/java/org/apache/solr/update/SolrCmdDistributor.java | 6 +++---
.../org/apache/solr/client/solrj/impl/Http2SolrClient.java | 10 ++++++++++
2 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/solr/core/src/java/org/apache/solr/update/SolrCmdDistributor.java b/solr/core/src/java/org/apache/solr/update/SolrCmdDistributor.java
index d000bfc..c7ed8fd 100644
--- a/solr/core/src/java/org/apache/solr/update/SolrCmdDistributor.java
+++ b/solr/core/src/java/org/apache/solr/update/SolrCmdDistributor.java
@@ -234,7 +234,7 @@ public class SolrCmdDistributor implements Closeable {
req.uReq.setBasePath(req.node.getUrl());
solrClient.request(req.uReq);
} catch (Exception e) {
- SolrException.log(log, e);
+ log.error("Exception sending synchronous dist update", e);
Error error = new Error();
error.t = e;
error.req = req;
@@ -263,7 +263,7 @@ public class SolrCmdDistributor implements Closeable {
@Override
public void onFailure(Throwable t) {
- log.warn("Error sending distributed update", t);
+ log.error("Exception sending dist update", t);
arrive(req);
Error error = new Error();
@@ -282,7 +282,7 @@ public class SolrCmdDistributor implements Closeable {
}});
} catch (Exception e) {
- log.warn("Error sending distributed update", e);
+ log.error("Exception sending dist update", e);
arrive(req);
Error error = new Error();
error.t = e;
diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/Http2SolrClient.java b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/Http2SolrClient.java
index 629f4eb..c2a6a8a 100644
--- a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/Http2SolrClient.java
+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/Http2SolrClient.java
@@ -43,6 +43,7 @@ import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Phaser;
+import java.util.concurrent.Semaphore;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
@@ -887,6 +888,8 @@ public class Http2SolrClient extends SolrClient {
// nocommit - look at outstanding max again
private static final int MAX_OUTSTANDING_REQUESTS = 1000;
+ private final Semaphore available;
+
// wait for async requests
private final Phaser phaser = new Phaser(1) {
@Override
@@ -903,9 +906,11 @@ public class Http2SolrClient extends SolrClient {
// phaser.register();
// if (log.isDebugEnabled()) log.debug("Request queued registered: {} arrived: {}", phaser.getRegisteredParties(), phaser.getArrivedParties());
// };
+ available = new Semaphore(MAX_OUTSTANDING_REQUESTS, false);
completeListener = result -> {
if (log.isDebugEnabled()) log.debug("Request complete registered: {} arrived: {}", phaser.getRegisteredParties(), phaser.getArrivedParties());
phaser.arriveAndDeregister();
+ available.release();
};
}
@@ -934,6 +939,11 @@ public class Http2SolrClient extends SolrClient {
log.debug("Registered new party");
}
phaser.register();
+ try {
+ available.acquire();
+ } catch (InterruptedException ignored) {
+ ParWork.propegateInterrupt(ignored);
+ }
}
}