Skip to content

Conversation

@hanmz
Copy link
Contributor

@hanmz hanmz commented Apr 16, 2024

Motivation

Repeat the handleMetadataChanges callback when configurationMetadataStore equals localMetadataStore.
This is caused by repeatedly registering the same callback handleMetadataChanges for the same object in class BrokerService.
pulsar.getLocalMetadataStore().registerListener(this::handleMetadataChanges); pulsar.getConfigurationMetadataStore().registerListener(this::handleMetadataChanges);

For example, when we perform the update namespaces policies, here we call set-message-ttl:
sh bin/pulsar-admin namespaces set-message-ttl --messageTTL 60 test-tenant/test-ns

We will see the server output two lines of the same log:
`
2024-04-16T21:43:05,378+0800 [pulsar-15-5] INFO org.apache.pulsar.broker.service.BrokerService (BrokerService.java:2446) - [test-tenant/test-ns] updating with Policies(auth_policies=AuthPoliciesImpl(namespaceAuthentication={}, topicAuthentication={}, subscriptionAuthentication={}), replication_clusters=[standalone], bundles=BundlesDataImpl(boundaries=[0x00000000, 0x40000000, 0x80000000, 0xc0000000, 0xffffffff], numBundles=4), backlog_quota_map={}, clusterDispatchRate={}, topicDispatchRate={}, subscriptionDispatchRate={}, replicatorDispatchRate={}, clusterSubscribeRate={}, persistence=null, deduplicationEnabled=null, autoTopicCreationOverride=null, autoSubscriptionCreationOverride=null, publishMaxMessageRate={}, latency_stats_sample_rate={}, message_ttl_in_seconds=60, subscription_expiration_time_minutes=null, retention_policies=RetentionPolicies{retentionTimeInMinutes=10, retentionSizeInMB=-1}, deleted=false, encryption_required=false, delayed_delivery_policies=null, inactive_topic_policies=null, subscription_auth_mode=None, max_producers_per_topic=null, max_consumers_per_topic=null, max_consumers_per_subscription=null, max_unacked_messages_per_consumer=null, max_unacked_messages_per_subscription=null, max_subscriptions_per_topic=null, compaction_threshold=null, offload_threshold=-1, offload_threshold_in_seconds=-1, offload_deletion_lag_ms=null, max_topics_per_namespace=null, schema_auto_update_compatibility_strategy=null, schema_compatibility_strategy=UNDEFINED, is_allow_auto_update_schema=null, schema_validation_enforced=false, offload_policies=null, deduplicationSnapshotIntervalSeconds=null, subscription_types_enabled=[], properties={}, resource_group_name=null, migrated=false, dispatcherPauseOnAckStatePersistentEnabled=null, entryFilters=null)

2024-04-16T21:43:05,378+0800 [pulsar-15-12] INFO org.apache.pulsar.broker.service.BrokerService (BrokerService.java:2446) - [test-tenant/test-ns] updating with Policies(auth_policies=AuthPoliciesImpl(namespaceAuthentication={}, topicAuthentication={}, subscriptionAuthentication={}), replication_clusters=[standalone], bundles=BundlesDataImpl(boundaries=[0x00000000, 0x40000000, 0x80000000, 0xc0000000, 0xffffffff], numBundles=4), backlog_quota_map={}, clusterDispatchRate={}, topicDispatchRate={}, subscriptionDispatchRate={}, replicatorDispatchRate={}, clusterSubscribeRate={}, persistence=null, deduplicationEnabled=null, autoTopicCreationOverride=null, autoSubscriptionCreationOverride=null, publishMaxMessageRate={}, latency_stats_sample_rate={}, message_ttl_in_seconds=60, subscription_expiration_time_minutes=null, retention_policies=RetentionPolicies{retentionTimeInMinutes=10, retentionSizeInMB=-1}, deleted=false, encryption_required=false, delayed_delivery_policies=null, inactive_topic_policies=null, subscription_auth_mode=None, max_producers_per_topic=null, max_consumers_per_topic=null, max_consumers_per_subscription=null, max_unacked_messages_per_consumer=null, max_unacked_messages_per_subscription=null, max_subscriptions_per_topic=null, compaction_threshold=null, offload_threshold=-1, offload_threshold_in_seconds=-1, offload_deletion_lag_ms=null, max_topics_per_namespace=null, schema_auto_update_compatibility_strategy=null, schema_compatibility_strategy=UNDEFINED, is_allow_auto_update_schema=null, schema_validation_enforced=false, offload_policies=null, deduplicationSnapshotIntervalSeconds=null, subscription_types_enabled=[], properties={}, resource_group_name=null, migrated=false, dispatcherPauseOnAckStatePersistentEnabled=null, entryFilters=null)
`

Modifications

Do not register listener for configurationMetadataStore when configurationMetadataStore equals localMetadataStore.

Documentation

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

…igurationMetadataStore equals localMetadataStore
@github-actions github-actions bot added the doc-not-needed Your PR changes do not impact docs label Apr 16, 2024
@lhotari lhotari added this to the 3.3.0 milestone Apr 16, 2024
Copy link
Member

@lhotari lhotari left a comment

Choose a reason for hiding this comment

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

LGTM. Good catch @hanmz

@Technoboy- Technoboy- merged commit 1dd82a0 into apache:master Apr 17, 2024
lhotari pushed a commit that referenced this pull request Apr 22, 2024
…igurationMetadataStore equals localMetadataStore (#22519)

(cherry picked from commit 1dd82a0)
lhotari pushed a commit that referenced this pull request Apr 22, 2024
…igurationMetadataStore equals localMetadataStore (#22519)

(cherry picked from commit 1dd82a0)
mukesh-ctds pushed a commit to datastax/pulsar that referenced this pull request Apr 23, 2024
…igurationMetadataStore equals localMetadataStore (apache#22519)

(cherry picked from commit 1dd82a0)
(cherry picked from commit 8f5b825)
srinath-ctds pushed a commit to datastax/pulsar that referenced this pull request Apr 23, 2024
…igurationMetadataStore equals localMetadataStore (apache#22519)

(cherry picked from commit 1dd82a0)
(cherry picked from commit 8f5b825)
hanmz added a commit to hanmz/pulsar that referenced this pull request Feb 12, 2025
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