Skip to content
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

Merged
merged 1 commit into from
Nov 11, 2016

Conversation

rdhabalia
Copy link
Contributor

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.

@yahoocla
Copy link

CLA is valid!

@rdhabalia rdhabalia changed the title Avoid setting ReplicatedFrom while init batchMessageMetadata Avoid setting ReplicatedFrom attribute with empty value while init batchMessageMetadata Nov 11, 2016
@rdhabalia rdhabalia added the type/bug The PR fixed a bug or issue reported a bug label Nov 11, 2016
@rdhabalia rdhabalia added this to the 1.16 milestone Nov 11, 2016
@rdhabalia rdhabalia self-assigned this Nov 11, 2016
@@ -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());
Copy link
Contributor

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()" ?

Copy link
Contributor

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

Copy link
Contributor Author

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);
Copy link
Contributor

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!

Copy link
Contributor

@merlimat merlimat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/bug The PR fixed a bug or issue reported a bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants