This is an automated email from the ASF dual-hosted git repository.
eolivelli pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar.git
The following commit(s) were added to refs/heads/master by this push:
new 464ad59 [pulsar-broker] Fix: unblock stuck thread on update-partition
api (#10447)
464ad59 is described below
commit 464ad59772aa376d2e098e19962c6d692135c32d
Author: Rajan Dhabalia <[email protected]>
AuthorDate: Thu Apr 29 21:47:53 2021 -0700
[pulsar-broker] Fix: unblock stuck thread on update-partition api (#10447)
---
.../apache/pulsar/broker/admin/impl/PersistentTopicsBase.java | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git
a/pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/PersistentTopicsBase.java
b/pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/PersistentTopicsBase.java
index 7000e08..76747e4 100644
---
a/pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/PersistentTopicsBase.java
+++
b/pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/PersistentTopicsBase.java
@@ -19,6 +19,7 @@
package org.apache.pulsar.broker.admin.impl;
import static
org.apache.pulsar.broker.cache.ConfigurationCacheService.POLICIES;
+import static
org.apache.pulsar.broker.resources.PulsarResources.DEFAULT_OPERATION_TIMEOUT_SEC;
import static org.apache.pulsar.common.util.Codec.decode;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.github.zafarkhaja.semver.Version;
@@ -483,7 +484,7 @@ public class PersistentTopicsBase extends AdminResource {
throw new RestException(Status.FORBIDDEN, "Local cluster is
not part of replicate cluster list");
}
try {
- createSubscriptions(topicName, numPartitions).get();
+ createSubscriptions(topicName,
numPartitions).get(DEFAULT_OPERATION_TIMEOUT_SEC, TimeUnit.SECONDS);
} catch (Exception e) {
if (e.getCause() instanceof RestException) {
throw (RestException) e.getCause();
@@ -512,7 +513,7 @@ public class PersistentTopicsBase extends AdminResource {
return null;
});
try {
- updatePartition.get();
+ updatePartition.get(DEFAULT_OPERATION_TIMEOUT_SEC,
TimeUnit.SECONDS);
} catch (Exception e) {
log.error("{} Failed to update number of partitions in zk
for topic {} and partitions {}",
clientAppId(), topicName, numPartitions, e);
@@ -529,8 +530,8 @@ public class PersistentTopicsBase extends AdminResource {
throw new RestException(Status.NOT_ACCEPTABLE, "Number of
partitions should be more than 0");
}
try {
- tryCreatePartitionsAsync(numPartitions).get();
- updatePartitionedTopic(topicName, numPartitions).get();
+
tryCreatePartitionsAsync(numPartitions).get(DEFAULT_OPERATION_TIMEOUT_SEC,
TimeUnit.SECONDS);
+ updatePartitionedTopic(topicName,
numPartitions).get(DEFAULT_OPERATION_TIMEOUT_SEC, TimeUnit.SECONDS);
} catch (Exception e) {
if (e.getCause() instanceof RestException) {
throw (RestException) e.getCause();