This is an automated email from the ASF dual-hosted git repository. zhaijia pushed a commit to branch branch-2.5 in repository https://gitbox.apache.org/repos/asf/pulsar.git
commit d8c9a24ea58315fa31f10dfa9f267b175074f84c Author: Matteo Merli <[email protected]> AuthorDate: Tue Mar 3 13:35:27 2020 -0800 Fixed the max backoff configuration for lookups (#6444) * Fixed the max backoff configuration for lookups * Fixed test expectation * More test fixes (cherry picked from commit 6ff87eed0df2eea424f95363f086589c13c502d8) --- .../java/org/apache/pulsar/client/impl/BinaryProtoLookupService.java | 2 +- .../src/main/java/org/apache/pulsar/client/impl/PulsarClientImpl.java | 2 +- .../org/apache/pulsar/proxy/server/ProxyConnectionThrottlingTest.java | 2 +- .../org/apache/pulsar/proxy/server/ProxyLookupThrottlingTest.java | 4 ++-- 4 files changed, 5 insertions(+), 5 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 3419a63..102f394 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 class BinaryProtoLookupService implements LookupService { 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 db66c90..2fe8201 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 @@ -663,7 +663,7 @@ public class PulsarClientImpl implements PulsarClient { 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) { 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 3e1084f..c30ae4d 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 class ProxyConnectionThrottlingTest extends MockedPulsarServiceBaseTest { // 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); 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 4d38c5e..8949f8d 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 class ProxyLookupThrottlingTest extends MockedPulsarServiceBaseTest { } 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 class ProxyLookupThrottlingTest extends MockedPulsarServiceBaseTest { Assert.fail("Should not have failed since can acquire LookupRequestSemaphore"); } - Assert.assertEquals(LookupProxyHandler.rejectedPartitionsMetadataRequests.get(), 11.0d); + Assert.assertEquals(LookupProxyHandler.rejectedPartitionsMetadataRequests.get(), 5.0d); } }
