[fix][broker] Fix can not delete namespace by force - #18307
Conversation
### Motivation 1. When we delete a namespace by force, if the __transaction_buffer_snapshot and __change_events be deleted first, and then the deleting of the normal topic will be failed at clearing snapshot and clearing topic policies. 2. fix flaky test testCreateTransactionSystemTopic. Test failed due to cleaning up after class. ### Modification 1. Delete normal topic and then delete system topic. 2. The system topic is not need to clean up topic policies.
Codecov Report
@@ Coverage Diff @@
## master #18307 +/- ##
============================================
+ Coverage 40.29% 47.02% +6.73%
- Complexity 8685 10369 +1684
============================================
Files 687 692 +5
Lines 67441 67779 +338
Branches 7225 7260 +35
============================================
+ Hits 27175 31876 +4701
+ Misses 37257 32322 -4935
- Partials 3009 3581 +572
Flags with carried forward coverage won't be shown. Click here to find out more.
|
|
@Technoboy- Why the namespace should not be deleted here? |
There was a problem hiding this comment.
Good catch. left some comments.
When we delete a namespace by force if the __transaction_buffer_snapshot and __change_events be deleted first, and then the deleting of the normal topic will be failed at clearing the snapshot and clearing topic policies.
Can we add a test for this case?
|
@mattisonchao Could you help review this? |
| } | ||
|
|
||
| @Test | ||
| public void testDeleteNamespaceBeforeCommit() throws Exception { |
There was a problem hiding this comment.
Why we should delete the entire test?
If the expected behavior is the transaction is not allowed to commit. We can just change the test to check the expected exception.
There was a problem hiding this comment.
This test is strange. The expected behavior is the namespace can be deleted by force when
there are transactions used to send a message. But the test is executed in the opposite logic.
Should be related with #14991. There is one case that the test did not coverage after discuss then. So add this test. Do you remember the case ? @codelipenghui @congbobo184 @mattisonchao |
|
@liangyepianzhou Could you please help push a PR to fix branch-2.10, branch-2.9, and branch-2.11? I tried to cherry-pick it directly, but it looks like there are many conflicts. It's better to create a PR to get more eyes on the change to release branches. |
|
In case you want to delete the namespace and this fix is not on the broker, the workaround is to manually delete the topics in the namespace created by the users and then trigger the namespace deletion again, right @liangyepianzhou ? |
|
@nicoloboschi If they use the topic of topic policy. Then the fix has to be contained in the broker. |
(cherry picked from commit 6c9ff8f)
(cherry picked from commit 6c9ff8f)
|
Cherry-picked by #18826 |
Motivation
Modification
For modification 2, there is a supported error msg.

Verifying this change
(Please pick either of the following options)
This change is a trivial rework / code cleanup without any test coverage.
(or)
This change is already covered by existing tests, such as (please describe tests).
(or)
This change added tests and can be verified as follows:
(example:)
Does this pull request potentially affect one of the following parts:
If the box was checked, please highlight the changes
Documentation
docdoc-requireddoc-not-neededdoc-completeMatching PR in forked repository
PR in forked repository: liangyepianzhou#8