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

[fix] Fix issue where DisableReplication flag does not work #1100

Merged
merged 1 commit into from
Oct 10, 2023

Conversation

massakam
Copy link

@massakam massakam commented Sep 29, 2023

Motivation

When producing a message, we can specify the DisableReplication option, and if set to true, the message is expected not to be replicated to remote clusters. However, this option currently does not work, and even if set to true, messages will be replicated to remote clusters.

The following part is the cause of this issue.

mm := p.genMetadata(msg, uncompressedSize, deliverAt)
// set default ReplicationClusters when DisableReplication
if msg.DisableReplication {
msg.ReplicationClusters = []string{"__local__"}
}

If DisableReplication is true, ReplicationClusters is set to __local__. However, the metadata that is actually sent to the broker has already been constructed immediately before that. Therefore, there is no point in changing the value of ReplicationClusters here. The order of these two must be reversed.

Modifications

Construct the metadata after changing ReplicationClusters to __local__.

Verifying this change

  • Make sure that the change passes the CI checks.

@massakam massakam added this to the v0.12.0 milestone Sep 29, 2023
@massakam massakam self-assigned this Sep 29, 2023
Copy link
Contributor

@kimula kimula left a comment

Choose a reason for hiding this comment

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

LGTM. checked that the added test succeeds iff the fix is applied.

gunli pushed a commit to gunli/pulsar-client-go that referenced this pull request Oct 8, 2023
Copy link

@nkurihar nkurihar left a comment

Choose a reason for hiding this comment

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

LGTM

@nkurihar nkurihar merged commit 0bf2f9b into apache:master Oct 10, 2023
6 checks passed
@massakam massakam deleted the fix-DisableReplication branch October 10, 2023 02:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants