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] improve shadow topic error message #18709

Merged
merged 1 commit into from
Dec 5, 2022

Conversation

labuladong
Copy link
Contributor

Motivation

PIP-180 add shadow topic feature. Shadow topic is read-only, but if I send msg to a shadow topic, the error message is "Only shadow topic supports sending messages with messageId", which is confusing.

Verifying this change

  • Make sure that the change passes the CI checks.

This change is a trivial rework / code cleanup without any test coverage.

Documentation

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

Matching PR in forked repository

PR in forked repository:

PTAL @Jason918

@github-actions github-actions bot added the doc-not-needed Your PR changes do not impact docs label Dec 2, 2022
if (isShadowTopic && position == null) {
cnx.execute(() -> {
cnx.getCommandSender().sendSendError(producerId, sequenceId, ServerError.NotAllowedError,
"Cannot send messages to a shadow topic");
Copy link
Contributor

Choose a reason for hiding this comment

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

We'd better tell this error is caused by position == null

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 position is only used in shadow topic internal replication:

// This position is only used for shadow replicator
Position position = send.hasMessageId()
? PositionImpl.get(send.getMessageId().getLedgerId(), send.getMessageId().getEntryId()) : null;

position should be null for regular producers. So I think it's not necessary to tell users about this detail.

Copy link
Contributor

Choose a reason for hiding this comment

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

position should be null for regular producers.

Correct. It's only used in ShadowReplicator.

Copy link
Contributor

@Jason918 Jason918 left a comment

Choose a reason for hiding this comment

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

Great, thank you for pointing this out.

@Jason918 Jason918 added this to the 2.12.0 milestone Dec 4, 2022
@Jason918 Jason918 added type/enhancement The enhancements for the existing features or docs. e.g. reduce memory usage of the delayed messages area/broker labels Dec 4, 2022
@Jason918
Copy link
Contributor

Jason918 commented Dec 4, 2022

/pulsarbot run-failure-checks

@codecov-commenter
Copy link

codecov-commenter commented Dec 4, 2022

Codecov Report

Merging #18709 (91c08fc) into master (90c5534) will decrease coverage by 3.30%.
The diff coverage is 0.00%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master   #18709      +/-   ##
============================================
- Coverage     50.05%   46.75%   -3.31%     
- Complexity     9706    10441     +735     
============================================
  Files           618      699      +81     
  Lines         58586    68734   +10148     
  Branches       6098     7374    +1276     
============================================
+ Hits          29327    32134    +2807     
- Misses        26092    33003    +6911     
- Partials       3167     3597     +430     
Flag Coverage Δ
unittests 46.75% <0.00%> (-3.31%) ⬇️

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

Impacted Files Coverage Δ
...ava/org/apache/pulsar/broker/service/Producer.java 60.72% <0.00%> (-1.04%) ⬇️
...ain/java/org/apache/pulsar/broker/rest/Topics.java 0.00% <0.00%> (-100.00%) ⬇️
.../pulsar/broker/rest/RestMessagePublishContext.java 0.00% <0.00%> (-77.78%) ⬇️
...er/metadata/v2/TransactionBufferSnapshotIndex.java 0.00% <0.00%> (-77.78%) ⬇️
...pache/pulsar/broker/tools/GenerateDocsCommand.java 0.00% <0.00%> (-77.28%) ⬇️
.../apache/pulsar/utils/CmdGenerateDocumentation.java 0.00% <0.00%> (-76.93%) ⬇️
.../metadata/v2/TransactionBufferSnapshotSegment.java 0.00% <0.00%> (-75.00%) ⬇️
...ava/org/apache/pulsar/broker/tools/BrokerTool.java 0.00% <0.00%> (-71.43%) ⬇️
.../metadata/v2/TransactionBufferSnapshotIndexes.java 0.00% <0.00%> (-71.43%) ⬇️
...ourcegroup/ResourceUsageTopicTransportManager.java 0.00% <0.00%> (-66.96%) ⬇️
... and 171 more

@labuladong
Copy link
Contributor Author

/pulsarbot run-failure-checks

1 similar comment
@labuladong
Copy link
Contributor Author

/pulsarbot run-failure-checks

@labuladong
Copy link
Contributor Author

This pr is ready to merge ^_^

@gaozhangmin gaozhangmin merged commit 99e26f5 into apache:master Dec 5, 2022
lifepuzzlefun pushed a commit to lifepuzzlefun/pulsar that referenced this pull request Jan 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/broker doc-not-needed Your PR changes do not impact docs 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.

4 participants