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

Add backoff for setting for getting topic policies. #11487

Merged

Conversation

codelipenghui
Copy link
Contributor

Motivation

Currently, if we start a new broker which does not owned any namepsaces bundles.
Then when use the pulsar-admin to setting or getting topic policies, we will get
topic policies have not been initialized yet error log and the admin operation will
get failed.

The root cause is we are failed immediately without any retry while the topic polices
cache have not init yet. So the PR to introduce the backoff for setting or getting
the topic policy if encounter the topic policies cache not init exception

Verifying this change

Remove the cache init check for the tests.

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

If yes was chosen, please highlight the changes

  • Dependencies (does it add or upgrade a dependency): (no)
  • The public API: (no)
  • The schema: (no)
  • The default values of configurations: (no)
  • The wire protocol: (no)
  • The rest endpoints: (no)
  • The admin cli options: (no)
  • Anything that affects deployment: (no)

Currently, if we start a new broker which does not owned any namepsaces bundles.
Then when use the pulsar-admin to setting or getting topic policies, we will get
`topic policies have not been initialized yet` error log and the admin operation will
get failed.

The root cause is we are failed immediately without any retry while the topic polices
cache have not init yet. So the PR to introduce the backoff for setting or getting
the topic policy if encounter the topic policies cache not init exception
@codelipenghui codelipenghui added type/enhancement The enhancements for the existing features or docs. e.g. reduce memory usage of the delayed messages component/topic-policy release/2.8.1 release/2.7.4 labels Jul 28, 2021
@codelipenghui codelipenghui added this to the 2.9.0 milestone Jul 28, 2021
@codelipenghui codelipenghui self-assigned this Jul 28, 2021
@codelipenghui codelipenghui reopened this Jul 28, 2021
* @param topicName
* @return
*/
boolean cacheIsInitialized(TopicName topicName);
Copy link
Contributor

Choose a reason for hiding this comment

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

The interface mark as Deprecated instead of directly delete?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This method does not been used by the client-side, after checking the reference to this method, all of them are from the test class, I think we can delete it directly since we are not exposing the interface for users to implement their own topic policies service implementation.

Copy link
Contributor

Choose a reason for hiding this comment

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

ok

@hangc0276
Copy link
Contributor

Good job!

@codelipenghui codelipenghui merged commit bebaadf into apache:master Jul 30, 2021
codelipenghui added a commit that referenced this pull request Jul 30, 2021
Currently, if we start a new broker which does not owned any namepsaces bundles.
Then when use the pulsar-admin to setting or getting topic policies, we will get
`topic policies have not been initialized yet` error log and the admin operation will
get failed.

The root cause is we are failed immediately without any retry while the topic polices
cache have not init yet. So the PR to introduce the backoff for setting or getting
the topic policy if encounter the topic policies cache not init exception

Remove the cache init check for the tests.

(cherry picked from commit bebaadf)
@codelipenghui codelipenghui added the cherry-picked/branch-2.8 Archived: 2.8 is end of life label Jul 30, 2021
@codelipenghui codelipenghui deleted the penghui/backoff-topic-policy branch July 30, 2021 06:53
codelipenghui added a commit to codelipenghui/incubator-pulsar that referenced this pull request Aug 4, 2021
codelipenghui added a commit that referenced this pull request Aug 5, 2021
* Fix some topic policy operation without backoff

Related to #11487
Technoboy- added a commit to Technoboy-/pulsar that referenced this pull request Aug 5, 2021
Technoboy- added a commit to Technoboy-/pulsar that referenced this pull request Aug 5, 2021
codelipenghui added a commit that referenced this pull request Aug 6, 2021
* Fix some topic policy operation without backoff

Related to #11487

(cherry picked from commit 92a3ac7)
Technoboy- added a commit to Technoboy-/pulsar that referenced this pull request Aug 6, 2021
Technoboy- added a commit to Technoboy-/pulsar that referenced this pull request Aug 6, 2021
Technoboy- added a commit to Technoboy-/pulsar that referenced this pull request Aug 9, 2021
@codelipenghui codelipenghui added the cherry-picked/branch-2.7 Archived: 2.7 is end of life label Aug 9, 2021
LeBW pushed a commit to LeBW/pulsar that referenced this pull request Aug 9, 2021
* Fix some topic policy operation without backoff

Related to apache#11487
bharanic-dev pushed a commit to bharanic-dev/pulsar that referenced this pull request Mar 18, 2022
### Motivation

Currently, if we start a new broker which does not owned any namepsaces bundles.
Then when use the pulsar-admin to setting or getting topic policies, we will get
`topic policies have not been initialized yet` error log and the admin operation will
get failed.

The root cause is we are failed immediately without any retry while the topic polices
cache have not init yet. So the PR to introduce the backoff for setting or getting
the topic policy if encounter the topic policies cache not init exception

### Verifying this change

Remove the cache init check for the tests.
bharanic-dev pushed a commit to bharanic-dev/pulsar that referenced this pull request Mar 18, 2022
* Fix some topic policy operation without backoff

Related to apache#11487
@codelipenghui codelipenghui restored the penghui/backoff-topic-policy branch May 17, 2022 01:19
@codelipenghui codelipenghui deleted the penghui/backoff-topic-policy branch May 17, 2022 01:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cherry-picked/branch-2.7 Archived: 2.7 is end of life cherry-picked/branch-2.8 Archived: 2.8 is end of life release/2.7.4 release/2.8.1 type/enhancement The enhancements for the existing features or docs. e.g. reduce memory usage of the delayed messages
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants