Skip to content

[fix][broker] Fix namespace deletion if __change_events topic has not been created yet - #18804

Merged
nicoloboschi merged 6 commits into
apache:masterfrom
nicoloboschi:fix-namespace-del
Dec 13, 2022
Merged

[fix][broker] Fix namespace deletion if __change_events topic has not been created yet#18804
nicoloboschi merged 6 commits into
apache:masterfrom
nicoloboschi:fix-namespace-del

Conversation

@nicoloboschi

Copy link
Copy Markdown
Contributor

Fixes #18802

Motivation

Sending the event to the __change_events topic is useless if the namespace is deleted (or in the process of).
Also during the namespace deletion procedure, it's not possible to create new topics so if it doesn't exist yet it throws an error.

Modifications

  • Skip sending events for topic policies if the namespace has been deleted

Verifying this change

  • Make sure that the change passes the CI checks.

Documentation

  • doc
  • doc-required
  • doc-not-needed
  • doc-complete

@codecov-commenter

codecov-commenter commented Dec 8, 2022

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 62.50000% with 18 lines in your changes missing coverage. Please review.
✅ Project coverage is 34.23%. Comparing base (68ca60c) to head (ac72e17).
⚠️ Report is 3159 commits behind head on master.

Files with missing lines Patch % Lines
.../service/SystemTopicBasedTopicPoliciesService.java 60.86% 10 Missing and 8 partials ⚠️

❗ There is a different number of reports uploaded between BASE (68ca60c) and HEAD (ac72e17). Click for more details.

HEAD has 4 uploads less than BASE
Flag BASE (68ca60c) HEAD (ac72e17)
unittests 8 4
Additional details and impacted files

Impacted file tree graph

@@              Coverage Diff              @@
##             master   #18804       +/-   ##
=============================================
- Coverage     50.05%   34.23%   -15.83%     
+ Complexity    11024     6518     -4506     
=============================================
  Files           703      623       -80     
  Lines         68814    59090     -9724     
  Branches       7378     6145     -1233     
=============================================
- Hits          34446    20227    -14219     
- Misses        30621    36194     +5573     
+ Partials       3747     2669     -1078     
Flag Coverage Δ
unittests 34.23% <62.50%> (-15.83%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...rg/apache/pulsar/broker/service/BrokerService.java 47.80% <100.00%> (-11.26%) ⬇️
.../service/SystemTopicBasedTopicPoliciesService.java 52.13% <60.86%> (-12.29%) ⬇️

... and 278 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@gaoran10 gaoran10 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure we need to handle the warning, it's expected behavior.

String namespace = tenant + "/test-ns2";
admin.namespaces().createNamespace(namespace, Set.of("test"));
admin.topics().createNonPartitionedTopic(namespace + "/tobedeleted");
// verify namespace can be deleted even without topic policy events

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure why the namespace couldn't be deleted when there is no topic policy events.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's the scope of this pull 😁
When deleting namespace with force=true, you first delete the topics in it. For each topics deleted, a new event is generated. However if the __change_events doesn't exist yet, it's auto-created. But the creation fails since the namespace is being deleted.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

btw I've added a more specific unit test case

@nicoloboschi

Copy link
Copy Markdown
Contributor Author

@gaoran10 @Technoboy- PTAL

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Broker internal error while deleting namespace

5 participants