-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Fix peek message metadata broker while enable broker entry metadata. #9255
Fix peek message metadata broker while enable broker entry metadata. #9255
Conversation
return metadata.getPartitionKey().getBytes(); | ||
} | ||
return key; |
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.
Change getBytes()
to getBytes(StandardCharsets.UTF_8)
to fix spotbugs check. It looks like that pulsar-broker
module doesn't enable spotbugs check yet so the same code passed the check in pulsar-broker
but failed in pulsar-common
.
@BeforeClass | ||
protected void setup() throws Exception { | ||
conf.setBrokerEntryMetadataInterceptors(Sets.newTreeSet( | ||
"org.apache.pulsar.common.intercept.AppendBrokerTimestampMetadataInterceptor" |
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.
Should we also add org.apache.pulsar.common.intercept.AppendIndexMetadataInterceptor
to test multiple BrokerEntryMetadataInterceptors
?
skipBrokerEntryMetadataIfExist(metadataAndPayload); | ||
MessageMetadata metadata = Commands.parseMessageMetadata(metadataAndPayload); | ||
metadataAndPayload.readerIndex(readerIdx); | ||
byte[] key = NONE_KEY.getBytes(); |
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.
I think we should also use getBytes(StandardCharsets.UTF_8)
here.
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.
If there is no key, instead of calling getBytes()
each time, we should just keep a static ref to the byte[]
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.
+1 overall lgtm.
/pulsarbot run-failure-checks |
/pulsarbot run-failure-checks |
1 similar comment
/pulsarbot run-failure-checks |
/pulsarbot run-failure-checks |
2 similar comments
/pulsarbot run-failure-checks |
/pulsarbot run-failure-checks |
Motivation
Fix peek message metadata broker while enable broker entry metadata.
When enabled the broker entry metadata, following error occurs:
The root cause is peeking message metadata does not skip the broker entry metadata.
Modifications
Skip the broker entry metadata if exists when peek message metadata.
Verifying this change
Tests added.
Does this pull request potentially affect one of the following parts:
If
yes
was chosen, please highlight the changesDocumentation