Skip to content

[cherry-pick][branch-2.9] Fix issue where leader broker information isn't available after 10 minutes - #18393

Closed
congbobo184 wants to merge 4 commits into
apache:branch-2.9from
congbobo184:congbo/cherry-pick/#17401
Closed

[cherry-pick][branch-2.9] Fix issue where leader broker information isn't available after 10 minutes#18393
congbobo184 wants to merge 4 commits into
apache:branch-2.9from
congbobo184:congbo/cherry-pick/#17401

Conversation

@congbobo184

Copy link
Copy Markdown
Contributor

Motivation

  • Fixes issue where leader broker information isn't available and this warning gets logged:
    WARN org.apache.pulsar.broker.namespace.NamespaceService - The information about the current leader broker wasn't available. Handling load manager decisions in a decentralized way.

  • Possibly fixing:

The root cause of the problem is that currently leader election cache entries expire in 10 minutes. Entries are refreshed when there's a cache hit between 5 to 10 minutes after the entry was added to the cache or refreshed the last time. This expiration behavior cannot be configured currently in MetadataCache.

Modifications

Since leader election cache expiration leads to problems, it is better to disable expiration completely for leader election entries. The cache entry refreshing is not changed so a missed Zookeeper change notification won't cause the cache to serve stale values.

  • change MetadataStore
    • add support passing cache configuration for a MetadataCache so that expiration can be disabled for leader election cache
  • revisit expiration logic in LeaderElectionImpl. Use cache.refresh instead of removing entries from the cache.
  • schedule a call to refresh the cached entry to mitigate possible stale values

Additional context

merlimat and others added 4 commits November 9, 2022 11:27
…ite (apache#12788)

### Motivation

When we're doing a write to the store from outside the `MetadataCache`, we are immediately invalidating the cache to ensure read-after-write consistency through the cache.

The only issue is that the invalidation, will not trigger a reloading of the value. Instead it is relying on the next call to `cache.get()` which will see the cache miss and it will load the new value into the cache.

This means that calls `cache.getIfCached()`, which is not triggering a cache load, will keep seeing the key as missing.

### Modification

Ensure we're calling refresh on the cache to get the value automatically reloaded in background and make sure the `getIfCached()` will eventually return the new value, even if there are no calls to `cache.get()`.

(cherry picked from commit 2bc4499)
Co-authored-by: Jiang Haiting <jianghaiting@didichuxing.com>
(cherry picked from commit 2b939b7)
@congbobo184 congbobo184 added doc-not-needed Your PR changes do not impact docs cherry-picked/branch-2.9 Archived: 2.9 is end of life release/2.9.4 labels Nov 9, 2022
@congbobo184 congbobo184 self-assigned this Nov 9, 2022
@lhotari

lhotari commented Nov 9, 2022

Copy link
Copy Markdown
Member

Already cherry-picked without a PR

@lhotari lhotari closed this Nov 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cherry-picked/branch-2.9 Archived: 2.9 is end of life doc-not-needed Your PR changes do not impact docs release/2.9.4

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants