-
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
Avoid setting ReplicatedFrom attribute with empty value while init batchMessageMetadata #107
Conversation
CLA is valid! |
@@ -611,7 +611,6 @@ public static long initBatchMessageMetadata(PulsarApi.MessageMetadata.Builder me | |||
messageMetadata.setPublishTime(builder.getPublishTime()); | |||
messageMetadata.setProducerName(builder.getProducerName()); | |||
messageMetadata.setSequenceId(builder.getSequenceId()); | |||
messageMetadata.setReplicatedFrom(builder.getReplicatedFrom()); |
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.
Good catch! Would it be worth to use "if (hasReplicatedFrom()) setTeplicatedFrom()" ?
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.
Can you also add a test in the replication unit test for batch messages? It should have caught this
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.
Addressed the changes.
producerConfiguration.setBatchingMaxMessages(5); | ||
} | ||
producer = client.createProducer(topicName); |
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.
Ouch, we weren't passing the producer config!
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.
👍
Motivation
As Batch-message was setting
ReplicatedFrom
with empty value, while replicating this batch message broker skips replication as broker considers this message as already replicated.Modifications
Do not set
ReplicatedFrom
field of Metadata with empty value.Result
Broker will be able to replicate batch messages.