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][broker] Skip topic auto-creation for ExtensibleLoadManager internal topics #21729

Merged
merged 2 commits into from Dec 15, 2023

Conversation

heesung-sn
Copy link
Contributor

@heesung-sn heesung-sn commented Dec 15, 2023

Motivation

For our load data system topics such as, non-persistent://pulsar/system/loadbalancer-broker-load-data, allowAutoTopicCreationType=partitioned causes other broker's producer creation to incorrectly create a new partitioned topic (although we pre-create the system topics as non-partitioned topics). Because of this, the leader broker cannot collect all brokers' load data as the other brokers publish the load data in different topics(partitioned topics).

For non-persistent topics, Producer creation incorrectly creates a new partitioned topic, although the topic was created as a non-partitioned topic before.

Producer creation first fetches the partitionMedatadata from the broker, and when fetching this partitionMedatadata, brokers automatically create a new one with the conditions like the below code. The problem is that the broker serving handlePartitionMetadataRequest might not be the owner broker (I don't see checkBundleOwnership in the handlePartitionMetadataRequest code path.) Hence, the topicExists condition in the below code can become false, if not owner, and create a new partitioned topic (by default).

https://github.com/apache/pulsar/blob/master/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/BrokerService.java#L3167-L3175

Modifications

Skip to auto-create ExtensibleLoadManager internal system topics, as we precreate them now.

Verifying this change

  • added a test case to cover this logic.

Does this pull request potentially affect one of the following parts:

If the box was checked, please highlight the changes

  • Dependencies (add or upgrade a dependency)
  • The public API
  • The schema
  • The default values of configurations
  • The threading model
  • The binary protocol
  • The REST endpoints
  • The admin CLI options
  • The metrics
  • Anything that affects deployment

Documentation

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

Matching PR in forked repository

PR in forked repository:

@heesung-sn heesung-sn self-assigned this Dec 15, 2023
@github-actions github-actions bot added the doc-not-needed Your PR changes do not impact docs label Dec 15, 2023
@@ -3432,10 +3432,10 @@ private CompletableFuture<Boolean> isAllowAutoTopicCreationAsync(final TopicName
return CompletableFuture.completedFuture(false);
}

// ServiceUnitStateChannelImpl.TOPIC expects to be a non-partitioned-topic now.
// ExtensibleLoadManagerImpl.internal topics expects to be non-partitioned-topics now.
Copy link
Member

Choose a reason for hiding this comment

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

Should we checkBundleOwnership in handlePartitionMetadataRequest?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think that can be a separate PR.

Here, I think we better explicitly say we don't allow topic auto-creation for these system topics, as we pre-create them.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

One thing we need to think about is that checking ownership there might cause some performance impact, as we will lookup/redirect to the owner brokers for every producer and consumer creation for non-persistent topics(and other topic related operations).

Copy link
Contributor

@gaoran10 gaoran10 left a comment

Choose a reason for hiding this comment

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

Left some questions.

@heesung-sn heesung-sn merged commit 88df040 into apache:master Dec 15, 2023
47 of 48 checks passed
Demogorgon314 pushed a commit to streamnative/pulsar-archived that referenced this pull request Dec 18, 2023
@lhotari
Copy link
Member

lhotari commented Dec 19, 2023

Could be related to the increased flakiness of ExtensibleLoadManagerTest.testIsolationPolicy, #20608

Demogorgon314 pushed a commit that referenced this pull request Dec 25, 2023
heesung-sn added a commit to heesung-sn/pulsar that referenced this pull request Jan 4, 2024
heesung-sn added a commit that referenced this pull request Jan 4, 2024
nikhil-ctds pushed a commit to datastax/pulsar that referenced this pull request Jan 4, 2024
…rnal topics (apache#21729)

(cherry picked from commit 88df040)
(cherry picked from commit b403f3c)
srinath-ctds pushed a commit to datastax/pulsar that referenced this pull request Jan 8, 2024
…rnal topics (apache#21729)

(cherry picked from commit 88df040)
(cherry picked from commit b403f3c)
@heesung-sn heesung-sn deleted the internal-topic-auto-create branch April 2, 2024 17:45
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.

None yet

5 participants