codelipenghui opened a new pull request #9255:
URL: https://github.com/apache/pulsar/pull/9255
### Motivation
Fix peek message metadata broker while enable broker entry metadata.
When enabled the broker entry metadata, following error occurs:
```
22:09:57.802
[broker-topic-workers-OrderedScheduler-4-0:org.apache.pulsar.common.protocol.Commands@1658]
ERROR org.apache.pulsar.common.protocol.Commands -
[PersistentSubscription{topic=persistent://public/default/__consumer_offsets-partition-0,
name=reader-31a9742e6c}] [-1] Failed to parse message metadata
java.lang.IllegalArgumentException: Invalid unknonwn tag type: 6
at
org.apache.pulsar.common.api.proto.LightProtoCodec.skipUnknownField(LightProtoCodec.java:270)
~[pulsar-common-2.8.0-rc-202101192246.jar:2.8.0-rc-202101192246]
at
org.apache.pulsar.common.api.proto.MessageMetadata.parseFrom(MessageMetadata.java:1370)
~[pulsar-common-2.8.0-rc-202101192246.jar:2.8.0-rc-202101192246]
at
org.apache.pulsar.common.protocol.Commands.parseMessageMetadata(Commands.java:425)
~[pulsar-common-2.8.0-rc-202101192246.jar:2.8.0-rc-202101192246]
at
org.apache.pulsar.common.protocol.Commands.parseMessageMetadata(Commands.java:415)
~[pulsar-common-2.8.0-rc-202101192246.jar:2.8.0-rc-202101192246]
at
org.apache.pulsar.common.protocol.Commands.peekMessageMetadata(Commands.java:1653)
~[pulsar-common-2.8.0-rc-202101192246.jar:2.8.0-rc-202101192246]
at
org.apache.pulsar.broker.service.AbstractBaseDispatcher.filterEntriesForConsumer(AbstractBaseDispatcher.java:82)
~[pulsar-broker-2.8.0-rc-202101192246.jar:2.8.0-rc-202101192246]
at
org.apache.pulsar.broker.service.persistent.PersistentDispatcherSingleActiveConsumer.internalReadEntriesComplete(PersistentDispatcherSingleActiveConsumer.java:232)
~[pulsar-broker-2.8.0-rc-202101192246.jar:2.8.0-rc-202101192246]
at
org.apache.pulsar.broker.service.persistent.PersistentDispatcherSingleActiveConsumer.lambda$readEntriesComplete$1(PersistentDispatcherSingleActiveConsumer.java:178)
~[pulsar-broker-2.8.0-rc-202101192246.jar:2.8.0-rc-202101192246]
at
org.apache.bookkeeper.mledger.util.SafeRun$1.safeRun(SafeRun.java:32)
[managed-ledger-2.8.0-rc-202101192246.jar:2.8.0-rc-202101192246]
at
org.apache.bookkeeper.common.util.SafeRunnable.run(SafeRunnable.java:36)
[bookkeeper-common-4.12.1.jar:4.12.1]
at
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
[?:1.8.0_261]
at java.util.concurrent.FutureTask.run$$$capture(FutureTask.java:266)
[?:1.8.0_261]
at java.util.concurrent.FutureTask.run(FutureTask.java) [?:1.8.0_261]
at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
[?:1.8.0_261]
at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
[?:1.8.0_261]
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
[?:1.8.0_261]
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
[?:1.8.0_261]
at
io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
[netty-common-4.1.51.Final.jar:4.1.51.Final]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_261]
```
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 changes*
- Dependencies (does it add or upgrade a dependency): (no)
- The public API: (no)
- The schema: (no)
- The default values of configurations: (no)
- The wire protocol: (no)
- The rest endpoints: (no)
- The admin cli options: (no)
- Anything that affects deployment: (no)
### Documentation
- Does this pull request introduce a new feature? (no)
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]