Skip to content

[improve][admin]internalGetMessageById shouldn't be allowed on partitioned topic - #19013

Merged
gaozhangmin merged 5 commits into
apache:masterfrom
gaozhangmin:getMessageById
Jan 9, 2023
Merged

[improve][admin]internalGetMessageById shouldn't be allowed on partitioned topic#19013
gaozhangmin merged 5 commits into
apache:masterfrom
gaozhangmin:getMessageById

Conversation

@gaozhangmin

@gaozhangmin gaozhangmin commented Dec 21, 2022

Copy link
Copy Markdown
Contributor

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

codecov-commenter commented Dec 21, 2022

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 56.25000% with 21 lines in your changes missing coverage. Please review.
✅ Project coverage is 47.67%. Comparing base (9ec1d07) to head (866109b).
⚠️ Report is 3034 commits behind head on master.

Files with missing lines Patch % Lines
...pulsar/broker/admin/impl/PersistentTopicsBase.java 63.33% 7 Missing and 4 partials ⚠️
...pache/pulsar/broker/admin/v1/PersistentTopics.java 0.00% 9 Missing ⚠️
...pache/pulsar/broker/admin/v2/PersistentTopics.java 88.88% 0 Missing and 1 partial ⚠️
Additional details and impacted files

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.

Files with missing lines Coverage Δ
...pache/pulsar/broker/admin/v2/PersistentTopics.java 74.80% <88.88%> (+0.39%) ⬆️
...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%) ⬇️

... and 26 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.

@congbobo184 congbobo184 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.

could you please add the test for it?

@liangyepianzhou liangyepianzhou 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.

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

@poorbarcode poorbarcode 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.

could you please add the test for it?

+1

@gaozhangmin

Copy link
Copy Markdown
Contributor Author

could you please add the test for it?

+1

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

@gaozhangmin
gaozhangmin requested review from Technoboy-, congbobo184 and poorbarcode 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