Repository navigation
[PIP 70][Issue 8617] Introduce lightweight broker entry metadata - #8618
Conversation
|
/pulsarbot run-failure-checks |
|
/pulsarbot run-failure-checks |
1 similar comment
|
/pulsarbot run-failure-checks |
|
@BewareMyPower Would you please also take a look? |
|
@jiazhai Ok |
BewareMyPower
left a comment
There was a problem hiding this comment.
I think we should add a method isRawMetadataEnable() to ManagedLedgerConfig like:
public boolean isRawMetadataEnable() {
return isBrokerTimestampForMessageEnable();
}
Then if we want to support more features like message sequence id, we'll only need to change this method to return isConfig1() || isConfig2() || .... And other occurrences like OpAndEntry#initiate() need no changes.
|
@BewareMyPower Would you give some deatils about what the method |
|
See and These two code blocks both check if (config.isBrokerTimestampForMessageEnable() || config.isMessageSequenceIdEnable())Right? So we should wrap the check into a single method, like: public boolean isRawMetadataEnable() {
return isBrokerTimestampForMessageEnable() /* || isMessageSequenceIdEnable() or more checks */;
} |
|
@BewareMyPower |
|
/pulsarbot run-failure-checks |
|
@BewareMyPower I applied your comment, PTAL. |
|
/pulsarbot run-failure-checks |
4 similar comments
|
/pulsarbot run-failure-checks |
|
/pulsarbot run-failure-checks |
|
/pulsarbot run-failure-checks |
|
/pulsarbot run-failure-checks |
|
@aloyszhang Thanks for the great work. Would you please help add backward compact test, there was already some tests, e.g. |
|
@jiazhai I will hanlde backward compact test soon. |
|
/pulsarbot run-failure-checks |
1 similar comment
|
/pulsarbot run-failure-checks |
|
/pulsarbot run-failure-checks |
|
|
||
| @FieldContext( | ||
| category = CATEGORY_SERVER, | ||
| doc = "List of interceptors for broker metadata.") |
There was a problem hiding this comment.
| doc = "List of interceptors for broker metadata.") | |
| doc = "List of interceptors for entry metadata.") |
|
|
||
| ByteBuf duplicateBuffer = data.retainedDuplicate(); | ||
| if (ml.getConfig().isBrokerEntryMetaEnabled()) { | ||
| duplicateBuffer = Commands.addBrokerEntryMetadata(duplicateBuffer, |
There was a problem hiding this comment.
I am still not convinced why do we need to this here. ManagedLedger only handles serialized entry. The entry metadata should be appended at the broker level. I think the right place to add this logic should be done in https://github.com/apache/pulsar/blob/master/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentTopic.java#L342.
There was a problem hiding this comment.
As we described in PIP-70, this feature can support continous sequenceId for Pulsar entry in the future, so, I think do these operations here is in favour of the future features. For this broker-timestamp feature only, move this logic as you suggested is a good choice. But for further extension, maybe do this logic by ManagedLedger is better. What's your opinion about this?
| try { | ||
| msg = MessageImpl.deserialize(entry.getDataBuffer()); | ||
| return msg.isExpired(messageTTLInSeconds); | ||
| pair = MessageImpl.deserializeWithBrokerEntryMetaData(entry.getDataBuffer()); |
There was a problem hiding this comment.
We should expose the broker metadata in the Message. So this would avoid using Pair and a lot of if-else logic.
We can improve msg.isExpired logic. If entry metadata is present, use broker timestamp; otherwise use client timestamp.
There was a problem hiding this comment.
Thanks for your suggestion. I'll optimize the implement as follow steps:
- expose the entry metadata to MessageImpl
- if entry metadata exist, skip the deserialization of MessageMetadata
- if not exist, deserialization the MessageMetadata
|
/pulsarbot run-failure-checks |
…f comparation condition
|
/pulsarbot run-failure-checks |
sijie
left a comment
There was a problem hiding this comment.
@aloyszhang the change looks great now! I left a couple of comments. Once you address them, I think this change is ready to merge.
|
@aloyszhang great job! |
|
@aloyszhang thanks for your great work. Shall the changes be documented in the user guide? If so, could you please help add the docs accordingly? Then you can ping me to review, thanks |
Fixes #8617
Motivation
Introduce lightweight raw Message metadata, details can be found PIP-70
Modifications
Verifying this change
Does this pull request potentially affect one of the following parts:
If
yeswas chosen, please highlight the changes