-
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
[Issue 6043] Support force deleting subscription #6383
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.
@murong00 Currently we don't have a flag to control to enable or disable the subscription auto-creation, and subscription auto-creation is enabled by default. So, if the subscription that has some active consumers, then delete the subscription forcefully, the subscription will create again when the consumer reconnects to the broker. Looks we'd better expose the ability for users to disable the subscription auto-creation.
admin.topics().deleteSubscription(persistentTopicName, subName, true); | ||
|
||
// delete the subscription successfully | ||
assertEquals(admin.topics().getSubscriptions(persistentTopicName).size(), 0); |
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.
This will be a flaky test since the consumer can create a subscription when they reconnect to the broker.
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.
yes, maybe we can disable this line in this pr first and then refine it later when the ability to disable the subscription auto-creation is available?
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.
I hava fixed the unit test to cover this.
@codelipenghui yes, I hava already opened an issue (#6394) to track this, I am planning to fix it by a seperated pull request. |
09e62b4
to
f326504
Compare
@codelipenghui please help to review again, thanks. |
@codelipenghui @sijie @jiazhai Since #6394 is already fixed, I hava refined the unit test. Please help to review it again, thanks. |
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.
Left some comments, please take a look.
} | ||
|
||
private void internalDeleteSubscriptionForNonPartitionedTopicForcefully(AsyncResponse asyncResponse, String subName, boolean authoritative) { | ||
validateAdminAccessForSubscriber(subName, authoritative); |
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.
Should handle exception here since we need to resume the asyncResponse
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.
done.
if (topicName.isPartitioned()) { | ||
internalDeleteSubscriptionForNonPartitionedTopicForcefully(asyncResponse, subName, authoritative); | ||
} else { | ||
PartitionedTopicMetadata partitionMetadata = getPartitionedTopicMetadata(topicName, authoritative, false); |
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.
Should handle exception here since we need to resume the asyncResponse
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.
done.
@codelipenghui ok, I will refine this pr after #6483 is merged. |
@codelipenghui I hava addressed your comments, please help to take a look. |
* | ||
* @return a future that can be used to track when the subscription is deleted | ||
*/ | ||
CompletableFuture<Void> deleteSubscriptionAsync(String topic, String subName); | ||
CompletableFuture<Void> deleteSubscriptionAsync(String topic, String subName, boolean force); |
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.
This is an API breaking change. You can't directly change the method signature. Please add an override method.
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.
Added, thanks.
@sijie Please help to review this again, thanks. |
### Motivation Fixes apache#6043 ### Modifications Add method `deleteForcefully` to support force deleting subscription.
Motivation
Fixes #6043
Modifications
Add method
deleteForcefully
to support force deleting subscription.