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][broker] PIP-300: Add custom dynamic configuration for plugins #20884

Merged
merged 9 commits into from
Dec 14, 2023

Conversation

nodece
Copy link
Member

@nodece nodece commented Jul 26, 2023

Motivation

See PIP-300

Modifications

  • Update PIP-300 goals and fix the wrong code
  • Add registerCustomDynamicConfiguration() to support adding the dynamic configuration.

Verifying this change

  • Make sure that the change passes the CI checks.

  • Add testRegisterCustomDynamicConfiguration() test.

Documentation

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

@github-actions github-actions bot added the doc-not-needed Your PR changes do not impact docs label Jul 26, 2023
@nodece nodece force-pushed the add-custom-dynamic-configuration branch from 3b2294a to 98eb21f Compare July 26, 2023 10:41
final Field field;
// value holds the external dynamic configuration.
final String value;
Copy link
Contributor

Choose a reason for hiding this comment

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

Why add the new field value, I could not find the place which uses it.

Copy link
Member Author

Choose a reason for hiding this comment

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

This value can be removed, and then call the addCustomDynamicConfiguration() without the value.

* <p>
* The custom dynamic configuration doesn't support setting up a listener.
*/
public void addCustomDynamicConfiguration(String key, String defaultValue, Predicate<String> validator) {
Copy link
Contributor

@poorbarcode poorbarcode Jul 28, 2023

Choose a reason for hiding this comment

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

This new API is dangerous because some config's dynamic update is not supported now, such as messageExpiryCheckIntervalInMinutes, serverPort, the field can be marked dynamic update only when we have genuinely implemented the dynamic update.

Copy link
Contributor

Choose a reason for hiding this comment

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

@codelipenghui @Technoboy- Could you take a look?

Copy link
Member Author

Choose a reason for hiding this comment

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

I see, this method is used for the third-party plugin, when a dynamic configuration has been added, the user can use the PulsarAdmin to update this dynamic configuration, and then the plugin can also call the pulsar().getPulsarResources().getDynamicConfigResources().getDynamicConfigurationAsync() to get the dynamic configuration.

@Technoboy- Technoboy- added this to the 3.2.0 milestone Jul 31, 2023
@nodece nodece marked this pull request as draft August 17, 2023 04:02
@nodece nodece force-pushed the add-custom-dynamic-configuration branch 3 times, most recently from ccd4c39 to 1d99f18 Compare August 17, 2023 05:49
@nodece nodece closed this Aug 17, 2023
@nodece nodece force-pushed the add-custom-dynamic-configuration branch from 1d99f18 to 0cb1c78 Compare August 17, 2023 05:50
@nodece nodece reopened this Aug 17, 2023
@nodece nodece marked this pull request as ready for review August 17, 2023 05:50
@nodece
Copy link
Member Author

nodece commented Aug 17, 2023

@liudezhi2098 If you want to cherry-pick this PR to branch-2.10 and branch-2.11, please use release/2.10.6 and release/2.11.3 labels, when this PR into branch-2.10 and branch-2.11, please append cherry-picked/branch-2.10 and cherry-picked/branch-2.11 labels.

@nodece
Copy link
Member Author

nodece commented Sep 1, 2023

/pulsarbot rerun-failure-checks

@codelipenghui
Copy link
Contributor

codelipenghui commented Sep 4, 2023

@nodece This is a new capability that will be introduced to Pulsar plugins. It should be started with a PIP, and we can't cherry-pick features to the patch releases.

@github-actions
Copy link

github-actions bot commented Oct 5, 2023

The pr had no activity for 30 days, mark with Stale label.

@github-actions github-actions bot added the Stale label Oct 5, 2023
@nodece
Copy link
Member Author

nodece commented Dec 13, 2023

@nodece Are you still working on this proposal?

I'm sorry for missing out on this PR recently. I can continue working on it.

@BewareMyPower
Copy link
Contributor

Could you rebase to master since the branch of PR is far behind the master branch?

@codecov-commenter
Copy link

codecov-commenter commented Dec 13, 2023

Codecov Report

Merging #20884 (a2e2bad) into master (50007c3) will decrease coverage by 0.13%.
Report is 2 commits behind head on master.
The diff coverage is 87.50%.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##             master   #20884      +/-   ##
============================================
- Coverage     73.50%   73.37%   -0.13%     
+ Complexity    32818    32750      -68     
============================================
  Files          1893     1893              
  Lines        140721   140726       +5     
  Branches      15502    15502              
============================================
- Hits         103432   103253     -179     
- Misses        29200    29356     +156     
- Partials       8089     8117      +28     
Flag Coverage Δ
inttests 24.14% <4.16%> (-0.02%) ⬇️
systests 24.70% <4.16%> (-0.14%) ⬇️
unittests 72.65% <87.50%> (-0.13%) ⬇️

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

Files Coverage Δ
...rg/apache/pulsar/broker/service/BrokerService.java 81.18% <87.50%> (-0.11%) ⬇️

... and 77 files with indirect coverage changes

@nodece nodece force-pushed the add-custom-dynamic-configuration branch from c04dbd2 to 2da728d Compare December 13, 2023 07:58
Co-authored-by: Yunze Xu <xyzinfernity@163.com>
Co-authored-by: Yunze Xu <xyzinfernity@163.com>
nodece and others added 4 commits December 13, 2023 17:24
Co-authored-by: Yunze Xu <xyzinfernity@163.com>
Co-authored-by: Yunze Xu <xyzinfernity@163.com>
Co-authored-by: Yunze Xu <xyzinfernity@163.com>
@nodece
Copy link
Member Author

nodece commented Dec 13, 2023

@BewareMyPower Thanks for your review and your suggestions have been applied.

@BewareMyPower
Copy link
Contributor

@mattisonchao Could you take a look again?

@BewareMyPower
Copy link
Contributor

@nodece Please fix the code style:

[INFO] There are 3 errors reported by Checkstyle 8.37 with /home/runner/work/pulsar/pulsar/buildtools/src/main/resources/pulsar/checkstyle.xml ruleset.
Error:  src/main/java/org/apache/pulsar/broker/service/BrokerService.java:[2528,79] (whitespace) WhitespaceAround: '==' is not followed by whitespace.
Error:  src/main/java/org/apache/pulsar/broker/service/BrokerService.java:[2528,93] (whitespace) WhitespaceAround: ':' is not followed by whitespace.
Error:  src/test/java/org/apache/pulsar/broker/admin/AdminApiDynamicConfigurationsTest.java:[28,8] (imports) UnusedImports: Unused import: java.util.function.Consumer.

@nodece nodece merged commit 41b1ab1 into apache:master Dec 14, 2023
48 checks passed
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 ready-to-test Stale type/PIP
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

9 participants