Skip to content

Conversation

@nodece
Copy link
Member

@nodece nodece commented Aug 20, 2025

PIP: #24485

Motivation

In a GEO replication scenario, if the remote cluster does not have the replicated topic and the auto-creation type differs between the local and remote clusters, message replication may fail. To ensure seamless replication, the topic metadata must be properly synchronized across clusters.

This is part of PIP-433.

#24136 is the same as this PR.

Modifications

  • When both the local and remote partitioned topic metadata indicate partitions=0, this means the topic is non-partitioned. In this case, the local cluster sends a non-partitioned topic creation request to the remote cluster.

  • If the local partitioned topic metadata has partitions>0, this means the topic is partitioned:

    • If the remote partitioned topic metadata has partitions=0, the local cluster sends a partitioned topic creation request to the remote cluster.
    • If partitions differ between the local and remote cluster, please stop GEO.

Documentation

  • doc
  • doc-required
  • doc-not-needed
  • doc-complete

@github-actions github-actions bot added the doc-not-needed Your PR changes do not impact docs label Aug 20, 2025
@nodece nodece force-pushed the improve-topic-creation-and-partition-update-before-starting-geo branch from 9f91e51 to a613da2 Compare August 20, 2025 14:28
@poorbarcode poorbarcode added this to the 4.2.0 milestone Sep 3, 2025
Copy link
Contributor

@poorbarcode poorbarcode left a comment

Choose a reason for hiding this comment

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

@nodece Thanks for driving this feature

}
// Set useFallbackForNonPIP344Brokers to true when mix of PIP-344 and non-PIP-344 brokers are used, it
// can still work.
return client.getLookup().getPartitionedTopicMetadata(baseTopicName, false, true)
Copy link
Contributor

Choose a reason for hiding this comment

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

Since we have pulsarAdmin object, can we use pulsar-admin.topics.getPartitionedTopicMetadataAsync here?

Copy link
Member Author

Choose a reason for hiding this comment

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

Good point, I will refactor this logic.

Copy link
Member Author

Choose a reason for hiding this comment

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

@poorbarcode This is an asynchronous method, but the keyword async is missing from its name.

Copy link
Contributor

@poorbarcode poorbarcode Nov 28, 2025

Choose a reason for hiding this comment

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

Since we have pulsarAdmin object, can we use pulsar-admin.topics.getPartitionedTopicMetadataAsync here?

I have modified the code, please review it. f7d38d7

Copy link
Member Author

Choose a reason for hiding this comment

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

@poorbarcode Good, I should use pulsarAdmin instead of pulsarClient, this is better way.

@poorbarcode
Copy link
Contributor

Rebase master

@nodece nodece force-pushed the improve-topic-creation-and-partition-update-before-starting-geo branch from a47eb1f to 4c833ed Compare November 25, 2025 03:34
@nodece nodece force-pushed the improve-topic-creation-and-partition-update-before-starting-geo branch from 90de7bd to 36661e4 Compare December 25, 2025 08:59
@nodece
Copy link
Member Author

nodece commented Dec 25, 2025

The tests testReplicatorWithSpecialNonPartitionedTopic, testFailureReplicatorWithSpecialNonPartitionedTopic, and testFailureReplicatorWithSpecialNonPartitionedTopic2 were removed in commit 4238cbd. This behavior is no longer applicable because the corresponding scenario introduced by PIP-414 has been disabled, and PIP-433 was not cherry-picked into the older branch.

The new code has been refactored by the AI.

@nodece
Copy link
Member Author

nodece commented Dec 25, 2025

ping @poorbarcode

@poorbarcode
Copy link
Contributor

@nodece I will review the PR again by this weekend

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

doc-not-needed Your PR changes do not impact docs ready-to-test

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants