Skip to content

Conversation

@poorbarcode
Copy link
Contributor

@poorbarcode poorbarcode commented Jan 21, 2026

Motivation

This is part-2 of PIP-433.

Modifications

Checks compatibility between two clusters when enabling namespace-level replication, which includes the following

  • All topics’ partitions that have been created should be the same
  • Auto-creation policies between both clusters should be the same, including broker-level and namespace-level.

Documentation

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

@poorbarcode poorbarcode added this to the 4.2.0 milestone Jan 21, 2026
@poorbarcode poorbarcode self-assigned this Jan 21, 2026
@github-actions github-actions bot added the doc-not-needed Your PR changes do not impact docs label Jan 21, 2026
|| ex instanceof PulsarAdminException.NotFoundException) {
return null;
}
throw new CompletionException(ex);
Copy link
Contributor

Choose a reason for hiding this comment

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

duplicate exception logic, better to add a method for this.

Copy link
Contributor

@Denovo1998 Denovo1998 left a comment

Choose a reason for hiding this comment

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

@poorbarcode
1.Partition consistency verification is "one-way" (only starting from the local topic).

  • The current logic will not detect the situation where "the remote already has a topic (and it may conflict with the local one in the future) but the local hasn't been created yet."
  • The test does not cover the case where "topic only exists remotely and conflicts with local policy".

2.Performance risk: Calling getPartitionedTopicMetadataAsync remotely once for each topic under the namespace

Should we consider concurrency limiting (semaphore), batching, or state in the document/comments that this is an admin operation and may take time?

* Validates that the effective auto-topic creation policies are the same between local and remote clusters.
* The effective policy is computed by: namespace-level policy overrides broker-level if it exists.
*/
private CompletableFuture<Void> validateAutoTopicCreationCompatibility(PulsarAdmin remoteAdmin,
Copy link
Contributor

Choose a reason for hiding this comment

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

validateAutoTopicCreationCompatibility(...) does not validate allowAutoTopicCreation?

Should we perhaps include allowAutoTopicCreation in the effective policy and participate in the comparison?

// Get local broker config
ServiceConfiguration localConfig = pulsar().getConfiguration();
TopicType localBrokerAutoCreationType = localConfig.getAllowAutoTopicCreationType();
int localBrokerDefaultPartitions = localConfig.getDefaultNumPartitions();
Copy link
Contributor

Choose a reason for hiding this comment

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

No matter whether the effective topicType is partitioned or not, will it compare the defaultNumPartitions?

When both sides are effective non-partitioned, but defaultNumPartitions is different, why are they treated as incompatible?

remoteAdmin.namespaces().getAutoTopicCreationAsync(namespaceStr)
.exceptionally(ex -> {
// If namespace doesn't have override, return null
if (ex.getCause() instanceof PulsarAdminException.NotFoundException
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need FutureUtil.unwrapCompletionException(e) here?

Comment on lines +57 to +58
* Helper method to clean up a namespace properly.
* First removes replication clusters (if any), then deletes the namespace.
Copy link
Contributor

Choose a reason for hiding this comment

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

Comment says "then deletes the namespace", the implementation is to reset the replication clusters to a single cluster.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants