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.
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.
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.
I think we should also use getBytes(StandardCharsets.UTF_8) here.
There was a problem hiding this comment.
If there is no key, instead of calling getBytes() each time, we should just keep a static ref to the byte[]
|
/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
yeswas chosen, please highlight the changesDocumentation