-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Conversation
if (isShadowTopic && position == null) { | ||
cnx.execute(() -> { | ||
cnx.getCommandSender().sendSendError(producerId, sequenceId, ServerError.NotAllowedError, | ||
"Cannot send messages to a shadow topic"); |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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:
pulsar/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/ServerCnx.java
Lines 1598 to 1602 in 5b062f3
// 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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
position
should benull
for regular producers.
Correct. It's only used in ShadowReplicator
.
There was a problem hiding this 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.
/pulsarbot run-failure-checks |
Codecov Report
@@ 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
Flags with carried forward coverage won't be shown. Click here to find out more.
|
/pulsarbot run-failure-checks |
1 similar comment
/pulsarbot run-failure-checks |
This pr is ready to merge ^_^ |
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
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