You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by bo...@apache.org on 2022/12/11 12:53:57 UTC

[pulsar] branch branch-2.10 updated: [cherry-pick][branch-2.10] fix code style and run test (#18863)

This is an automated email from the ASF dual-hosted git repository.

bogong pushed a commit to branch branch-2.10
in repository https://gitbox.apache.org/repos/asf/pulsar.git


The following commit(s) were added to refs/heads/branch-2.10 by this push:
     new 6441714fb46 [cherry-pick][branch-2.10] fix code style and run test (#18863)
6441714fb46 is described below

commit 6441714fb46b425d03fcb505ae907e94e827ae65
Author: congbo <39...@users.noreply.github.com>
AuthorDate: Sun Dec 11 20:53:49 2022 +0800

    [cherry-pick][branch-2.10] fix code style and run test (#18863)
    
    Co-authored-by: congbobo184 <co...@github.com>
---
 .../java/org/apache/pulsar/broker/admin/impl/NamespacesBase.java     | 2 +-
 .../org/apache/pulsar/broker/service/persistent/PersistentTopic.java | 5 +++--
 .../java/org/apache/pulsar/broker/service/BrokerServiceTest.java     | 2 --
 3 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/NamespacesBase.java b/pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/NamespacesBase.java
index 59193447fbc..2269b226cf0 100644
--- a/pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/NamespacesBase.java
+++ b/pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/NamespacesBase.java
@@ -342,7 +342,7 @@ public abstract class NamespacesBase extends AdminResource {
                     NamespaceBundles bundles = pulsar().getNamespaceService().getNamespaceBundleFactory()
                                     .getBundles(namespaceName);
                     for (NamespaceBundle bundle : bundles.getBundles()) {
-                                // check if the bundle is owned by any broker, if not then we do not need to delete the bundle
+                        // check if the bundle is owned by any broker, if not then we do not need to delete the bundle
                         deleteBundleFutures.add(pulsar().getNamespaceService().getOwnerAsync(bundle)
                                 .thenCompose(ownership -> {
                                     if (ownership.isPresent()) {
diff --git a/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentTopic.java b/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentTopic.java
index e41d2905301..58bba282d0b 100644
--- a/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentTopic.java
+++ b/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentTopic.java
@@ -1178,10 +1178,11 @@ public class PersistentTopic extends AbstractTopic implements Topic, AddEntryCal
                 return null;
             });
 
-                closeClientFuture.thenAccept(__ -> {
+                closeClientFuture.thenAccept(delete -> {
                     CompletableFuture<Void> deleteTopicAuthenticationFuture = new CompletableFuture<>();
                     brokerService.deleteTopicAuthenticationWithRetry(topic, deleteTopicAuthenticationFuture, 5);
-                    deleteTopicAuthenticationFuture.thenCompose(ignore -> deleteSchema())
+                    deleteTopicAuthenticationFuture.thenCompose(__ -> deleteSchema ? deleteSchema() :
+                                    CompletableFuture.completedFuture(null))
                             .thenCompose(ignore -> {
                                 if (!EventsTopicNames.isTopicPoliciesSystemTopic(topic)) {
                                     return deleteTopicPolicies();
diff --git a/pulsar-broker/src/test/java/org/apache/pulsar/broker/service/BrokerServiceTest.java b/pulsar-broker/src/test/java/org/apache/pulsar/broker/service/BrokerServiceTest.java
index 89cc626b262..e479519f393 100644
--- a/pulsar-broker/src/test/java/org/apache/pulsar/broker/service/BrokerServiceTest.java
+++ b/pulsar-broker/src/test/java/org/apache/pulsar/broker/service/BrokerServiceTest.java
@@ -86,13 +86,11 @@ import org.apache.pulsar.client.api.ProducerBuilder;
 import org.apache.pulsar.client.api.PulsarClient;
 import org.apache.pulsar.client.api.PulsarClientException;
 import org.apache.pulsar.client.api.Schema;
-import org.apache.pulsar.client.api.SubscriptionInitialPosition;
 import org.apache.pulsar.client.api.SubscriptionType;
 import org.apache.pulsar.client.impl.ConnectionPool;
 import org.apache.pulsar.client.impl.PulsarServiceNameResolver;
 import org.apache.pulsar.client.impl.auth.AuthenticationTls;
 import org.apache.pulsar.client.impl.conf.ClientConfigurationData;
-import org.apache.pulsar.common.events.EventsTopicNames;
 import org.apache.pulsar.common.naming.NamespaceBundle;
 import org.apache.pulsar.common.naming.NamespaceName;
 import org.apache.pulsar.common.naming.TopicName;