Skip to content
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

[improve][pip] PIP-369: Flag based selective unload on changing ns-isolation-policy #23116

Merged
merged 8 commits into from
Aug 14, 2024

Conversation

iosdev747
Copy link
Contributor

@iosdev747 iosdev747 commented Aug 1, 2024

Discussion thread: #23094

Motivation

In Apache Pulsar 3.x, changing a namespace isolation policy results in unloading all namespace bundles that match the namespace's regular expression provided in the isolation policy.
This can be problematic for cases where the regex matches a large subset of namespaces, such as tenant-x/.*.
One of such case is mentioned on this issue #23092 where policy change resulted in 100+ namespace bundles to get unloaded.
And broker exhausted all the available connections due to too many unload calls happening at once resulting in 5xx response.
Other issues that happens with this approach are huge latency spikes as topics are unavailable until bundles are loaded back, increasing the pending produce calls.
The only benefit this approach serves is ensuring that all the namespaces matching the policy regex will come to correct broker group.
But when namespace bundles are already on the correct broker group (according to the policy), unloading those namespaces doesn't serve any purpose.

This PIP aims to address the need to either prevent unnecessary unloading or provide a more granular approach to determine what should be unloaded.

Some of the cases covered by this PIP are discussed in #23094 by @grssam.

  • unload nothing as part of the set policy call
  • unload every matching namespace as part of the policy set call
  • unload only the changed namespaces (newly added + removed)

Does this pull request potentially affect one of the following parts:

If the box was checked, please highlight the changes

  • Dependencies (add or upgrade a dependency)
  • The public API
  • The schema
  • The default values of configurations
  • The threading model
  • The binary protocol
  • The REST endpoints
  • The admin CLI options
  • The metrics
  • Anything that affects deployment

Documentation

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

Matching PR in forked repository

PR in forked repository:

Copy link

github-actions bot commented Aug 1, 2024

@iosdev747 Please add the following content to your PR description and select a checkbox:

- [ ] `doc` <!-- Your PR contains doc changes -->
- [ ] `doc-required` <!-- Your PR changes impact docs and you will update later -->
- [ ] `doc-not-needed` <!-- Your PR changes do not impact docs -->
- [ ] `doc-complete` <!-- Docs have been already added -->

@github-actions github-actions bot added doc-not-needed Your PR changes do not impact docs and removed doc-label-missing labels Aug 1, 2024
@iosdev747 iosdev747 marked this pull request as ready for review August 2, 2024 13:04
@lhotari
Copy link
Member

lhotari commented Aug 8, 2024

Well written and explained. Thanks.

In the initial review, I only have a few knits about improving some concepts such as the unload enum in the proposal.
I think that putting more effort in the naming of it and the different values could be useful. For example, all should be something like MATCHING and the name of the enum should be more descriptive.

@grssam
Copy link
Contributor

grssam commented Aug 9, 2024

Well written and explained. Thanks.

In the initial review, I only have a few knits about improving some concepts such as the unload enum in the proposal. I think that putting more effort in the naming of it and the different values could be useful. For example, all should be something like MATCHING and the name of the enum should be more descriptive.

Thanks for the feedback. We can certainly name it all_matching . Notice that I am still using snake case to be consistent with some other enums used in the same policy call.
Generally the description of a flag is meant to contain more context. It's very tricky to convey what this param would do without exploding the param length.. How about something like unload-scope does that make more sense at first glance?

@lhotari
Copy link
Member

lhotari commented Aug 9, 2024

Thanks for the feedback. We can certainly name it all_matching . Notice that I am still using snake case to be consistent with some other enums used in the same policy call.
Generally the description of a flag is meant to contain more context. It's very tricky to convey what this param would do without exploding the param length.. How about something like unload-scope does that make more sense at first glance?

+1. Sounds good! UnloadScope would be a great concise name for the enum. Snake case values are fine if that's already the convention.

pip/pip-369.md Outdated Show resolved Hide resolved
@iosdev747
Copy link
Contributor Author

iosdev747 commented Aug 9, 2024

Thank you everyone for giving the feedback :)
I have addressed the review comments. And adding explicitly in the PIP that this should get cherry picked in 3.0.x as it provides a way to address the issue mentioned in #23092.

For changing the definition of all/all_matching and changing the default option to changed, it can be taken in a separate PR that will be present in 4.0+ but not in 3.0.x

I'll start a voting thread.

@lhotari
Copy link
Member

lhotari commented Aug 9, 2024

minor detail: unload_scope (snake case) as the enum name is perhaps against typical conventions. I believe that most enums are CamelCase, so instead of unload_scope, the enum type name should be UnloadScope.

@Technoboy- Technoboy- added this to the 4.0.0 milestone Aug 14, 2024
@lhotari lhotari merged commit ce38ee2 into apache:master Aug 14, 2024
20 checks passed
grssam pushed a commit to grssam/pulsar that referenced this pull request Sep 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
doc-not-needed Your PR changes do not impact docs PIP
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants