From 18fef6e13741b537bcc13584afdb20aaf544e9f3 Mon Sep 17 00:00:00 2001 From: Matteo Merli Date: Fri, 28 Feb 2020 15:14:21 -0800 Subject: [PATCH 1/3] Fixed the max backoff configuration for lookups --- .../org/apache/pulsar/client/impl/BinaryProtoLookupService.java | 2 +- .../java/org/apache/pulsar/client/impl/PulsarClientImpl.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pulsar-client/src/main/java/org/apache/pulsar/client/impl/BinaryProtoLookupService.java b/pulsar-client/src/main/java/org/apache/pulsar/client/impl/BinaryProtoLookupService.java index 3419a6397fbd9..102f394091d8e 100644 --- a/pulsar-client/src/main/java/org/apache/pulsar/client/impl/BinaryProtoLookupService.java +++ b/pulsar-client/src/main/java/org/apache/pulsar/client/impl/BinaryProtoLookupService.java @@ -213,7 +213,7 @@ public CompletableFuture> getTopicsUnderNamespace(NamespaceName nam Backoff backoff = new BackoffBuilder() .setInitialTime(100, TimeUnit.MILLISECONDS) .setMandatoryStop(opTimeoutMs.get() * 2, TimeUnit.MILLISECONDS) - .setMax(0, TimeUnit.MILLISECONDS) + .setMax(1, TimeUnit.MINUTES) .create(); getTopicsUnderNamespace(serviceNameResolver.resolveHost(), namespace, backoff, opTimeoutMs, topicsFuture, mode); return topicsFuture; diff --git a/pulsar-client/src/main/java/org/apache/pulsar/client/impl/PulsarClientImpl.java b/pulsar-client/src/main/java/org/apache/pulsar/client/impl/PulsarClientImpl.java index f51fb6b65c3f3..2aca5cf6a49bd 100644 --- a/pulsar-client/src/main/java/org/apache/pulsar/client/impl/PulsarClientImpl.java +++ b/pulsar-client/src/main/java/org/apache/pulsar/client/impl/PulsarClientImpl.java @@ -659,7 +659,7 @@ public CompletableFuture getPartitionedTopicMetadata(S Backoff backoff = new BackoffBuilder() .setInitialTime(100, TimeUnit.MILLISECONDS) .setMandatoryStop(opTimeoutMs.get() * 2, TimeUnit.MILLISECONDS) - .setMax(0, TimeUnit.MILLISECONDS) + .setMax(1, TimeUnit.MINUTES) .create(); getPartitionedTopicMetadata(topicName, backoff, opTimeoutMs, metadataFuture); } catch (IllegalArgumentException e) { From 1f3e4fdef17f567e6b7ee79a46c01c660e9f8f7d Mon Sep 17 00:00:00 2001 From: Matteo Merli Date: Mon, 2 Mar 2020 11:19:39 -0800 Subject: [PATCH 2/3] Fixed test expectation --- .../pulsar/proxy/server/ProxyConnectionThrottlingTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pulsar-proxy/src/test/java/org/apache/pulsar/proxy/server/ProxyConnectionThrottlingTest.java b/pulsar-proxy/src/test/java/org/apache/pulsar/proxy/server/ProxyConnectionThrottlingTest.java index 3e1084f4efb87..c30ae4daed456 100644 --- a/pulsar-proxy/src/test/java/org/apache/pulsar/proxy/server/ProxyConnectionThrottlingTest.java +++ b/pulsar-proxy/src/test/java/org/apache/pulsar/proxy/server/ProxyConnectionThrottlingTest.java @@ -100,7 +100,7 @@ public void testInboundConnection() throws Exception { // OK } // should add retry count since retry every 100ms and operation timeout is set to 1000ms - Assert.assertEquals(ProxyService.rejectedConnections.get(), 11.0d); + Assert.assertEquals(ProxyService.rejectedConnections.get(), 5.0d); } private static final Logger LOG = LoggerFactory.getLogger(ProxyConnectionThrottlingTest.class); From aa0ddb5affec7558e9b036076157957c63803834 Mon Sep 17 00:00:00 2001 From: Matteo Merli Date: Mon, 2 Mar 2020 13:28:42 -0800 Subject: [PATCH 3/3] More test fixes --- .../apache/pulsar/proxy/server/ProxyLookupThrottlingTest.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pulsar-proxy/src/test/java/org/apache/pulsar/proxy/server/ProxyLookupThrottlingTest.java b/pulsar-proxy/src/test/java/org/apache/pulsar/proxy/server/ProxyLookupThrottlingTest.java index 4d38c5e5958be..8949f8df34995 100644 --- a/pulsar-proxy/src/test/java/org/apache/pulsar/proxy/server/ProxyLookupThrottlingTest.java +++ b/pulsar-proxy/src/test/java/org/apache/pulsar/proxy/server/ProxyLookupThrottlingTest.java @@ -96,7 +96,7 @@ public void testLookup() throws Exception { } catch (Exception ex) { // Ignore } - Assert.assertEquals(LookupProxyHandler.rejectedPartitionsMetadataRequests.get(), 11.0d); + Assert.assertEquals(LookupProxyHandler.rejectedPartitionsMetadataRequests.get(), 5.0d); proxyService.getLookupRequestSemaphore().release(); try { @Cleanup @@ -106,6 +106,6 @@ public void testLookup() throws Exception { Assert.fail("Should not have failed since can acquire LookupRequestSemaphore"); } - Assert.assertEquals(LookupProxyHandler.rejectedPartitionsMetadataRequests.get(), 11.0d); + Assert.assertEquals(LookupProxyHandler.rejectedPartitionsMetadataRequests.get(), 5.0d); } }