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][admin]internalGetMessageById shouldn't be allowed on partitioned topic #19013

Merged
merged 5 commits into from
Jan 9, 2023

Conversation

gaozhangmin
Copy link
Contributor

@gaozhangmin gaozhangmin commented Dec 21, 2022

Motivation

Now, if a topic without partition index provided when querying internalGetMessageById, error Topic not found will be thrown out. It will confuse users.

We'd better forbidden internalGetMessageById on partitioned-topic.

Modifications

If a partitioned-topic is provided, Status.METHOD_NOT_ALLOWED will be thrown out

Verifying this change

  • Make sure that the change passes the CI checks.

(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:)

  • Added integration tests for end-to-end deployment with large payloads (10MB)
  • Extended integration test for recovery after broker failure

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

gaozhangmin#5

@gaozhangmin gaozhangmin self-assigned this Dec 21, 2022
@github-actions github-actions bot added the doc-not-needed Your PR changes do not impact docs label Dec 21, 2022
@Technoboy- Technoboy- added this to the 2.12.0 milestone Dec 21, 2022
@codecov-commenter
Copy link

codecov-commenter commented Dec 21, 2022

Codecov Report

Merging #19013 (866109b) into master (9ec1d07) will decrease coverage by 0.05%.
The diff coverage is 56.25%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master   #19013      +/-   ##
============================================
- Coverage     47.73%   47.67%   -0.06%     
- Complexity    10819    10825       +6     
============================================
  Files           712      712              
  Lines         69645    69650       +5     
  Branches       7481     7480       -1     
============================================
- Hits          33242    33203      -39     
- Misses        32699    32758      +59     
+ Partials       3704     3689      -15     
Flag Coverage Δ
unittests 47.67% <56.25%> (-0.06%) ⬇️

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

Impacted Files Coverage Δ
...pache/pulsar/broker/admin/v1/PersistentTopics.java 47.09% <0.00%> (-0.28%) ⬇️
...pulsar/broker/admin/impl/PersistentTopicsBase.java 59.47% <63.33%> (-0.01%) ⬇️
...pache/pulsar/broker/admin/v2/PersistentTopics.java 74.80% <88.88%> (+0.39%) ⬆️
...java/org/apache/pulsar/proxy/stats/TopicStats.java 58.82% <0.00%> (-41.18%) ⬇️
...lsar/broker/loadbalance/impl/ThresholdShedder.java 3.27% <0.00%> (-27.05%) ⬇️
...org/apache/pulsar/broker/loadbalance/LoadData.java 58.33% <0.00%> (-8.34%) ⬇️
...roker/loadbalance/impl/ModularLoadManagerImpl.java 65.39% <0.00%> (-3.50%) ⬇️
...a/org/apache/pulsar/proxy/server/ProxyService.java 80.00% <0.00%> (-0.94%) ⬇️
...rg/apache/pulsar/compaction/TwoPhaseCompactor.java 72.81% <0.00%> (-0.93%) ⬇️
...sar/broker/loadbalance/impl/LoadManagerShared.java 45.17% <0.00%> (-0.88%) ⬇️
... and 21 more

Copy link
Contributor

@congbobo184 congbobo184 left a comment

Choose a reason for hiding this comment

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

could you please add the test for it?

Copy link
Contributor

@liangyepianzhou liangyepianzhou left a comment

Choose a reason for hiding this comment

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

Overall right, and it is better if you can add a unit test to verify it.

Copy link
Contributor

@poorbarcode poorbarcode left a comment

Choose a reason for hiding this comment

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

could you please add the test for it?

+1

@gaozhangmin
Copy link
Contributor Author

could you please add the test for it?

+1

org.apache.pulsar.broker.admin.PersistentTopicsTest#testGetMessageById

@gaozhangmin gaozhangmin requested review from Technoboy-, poorbarcode and congbobo184 and removed request for poorbarcode January 4, 2023 06:47
@gaozhangmin gaozhangmin merged commit b05fddb into apache:master Jan 9, 2023
lhotari pushed a commit that referenced this pull request Mar 6, 2024
…ioned topic (#19013)

Co-authored-by: gavingaozhangmin <gavingaozhangmin@didiglobal.com>
(cherry picked from commit b05fddb)
codelipenghui pushed a commit that referenced this pull request Mar 7, 2024
…ioned topic (#19013)

Co-authored-by: gavingaozhangmin <gavingaozhangmin@didiglobal.com>
(cherry picked from commit b05fddb)
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.

9 participants