-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[fix][broker] revert remove duplicate topics name when deleteNamespace #21087
[fix][broker] revert remove duplicate topics name when deleteNamespace #21087
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#20683 Only apply in the master branch.
allUserCreatedTopics.removeIf(t -> | ||
allPartitionedTopics.contains(TopicName.get(t).getPartitionedTopicName())); | ||
allSystemTopics.removeIf(t -> | ||
allPartitionedTopics.contains(TopicName.get(t).getPartitionedTopicName())); | ||
topicPolicy.removeIf(t -> | ||
allPartitionedTopics.contains(TopicName.get(t).getPartitionedTopicName())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible to have a test to protect the behavior?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pulsar/pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/NamespacesBase.java
Lines 328 to 342 in e59c850
if (rc instanceof MetadataStoreException) { | |
if (rc.getCause() != null && rc.getCause() instanceof KeeperException.NotEmptyException) { | |
log.info("[{}] There are in-flight topics created during the namespace deletion, " | |
+ "retry to delete the namespace again.", namespaceName); | |
final int next = retryTimes - 1; | |
if (next > 0) { | |
// async recursive | |
internalRetryableDeleteNamespaceAsync0(force, next, callback); | |
} else { | |
callback.completeExceptionally( | |
new RestException(Status.CONFLICT, "The broker still have in-flight topics" | |
+ " created during namespace deletion, please try again.")); | |
// drop out recursive | |
} | |
return; |
Codecov Report
@@ Coverage Diff @@
## master #21087 +/- ##
=============================================
+ Coverage 36.92% 72.82% +35.90%
- Complexity 12187 32725 +20538
=============================================
Files 1698 1887 +189
Lines 129846 144180 +14334
Branches 14163 16491 +2328
=============================================
+ Hits 47947 105004 +57057
+ Misses 75570 30833 -44737
- Partials 6329 8343 +2014
Flags with carried forward coverage won't be shown. Click here to find out more.
|
Motivation
Related to #20683. When reading the code of master-branch and branch-2.10, I found we can not remove duplicate topics name when deleteNamespace, because the implementation of internalDeletePartitionedTopicsAsync() is different in two branch. In master-branch, if we remove topics name in allUserCreatedTopics and allSystemTopic, we actually not delete the topic. So the first time delete namespace will throw exception exactly.
branch-2.10 :
master-branch :
Modifications
revert the modification.
Verifying this change
Does this pull request potentially affect one of the following parts:
If the box was checked, please highlight the changes
Documentation
doc
doc-required
doc-not-needed
doc-complete
Matching PR in forked repository
PR in forked repository: TakaHiR07#14