Skip to content

[Branch 2.7] Avoid potentially blocking calls to metadata in PersistentTopic#getMessageTTL#16899

Merged
codelipenghui merged 1 commit intoapache:branch-2.7from
Jason918:fix_12340
Aug 3, 2022
Merged

[Branch 2.7] Avoid potentially blocking calls to metadata in PersistentTopic#getMessageTTL#16899
codelipenghui merged 1 commit intoapache:branch-2.7from
Jason918:fix_12340

Conversation

@Jason918
Copy link
Copy Markdown
Contributor

@Jason918 Jason918 commented Aug 1, 2022

Motivation

This PR is part of work of cherry-pick #12340 to branch 2.7

There is a concurrent issue when updating namespace TTL, causing AdminApiTest#testTopicStatsLastExpireTimestampForSubscription fails periodically.

The root cause is that in NamespacesBase#internalSetNamespaceMessageTTL:

  • Step A, we write new namespace policy data to zk
  • Step B, we call policiesCache().invalidate to disable the cache.

But between Step A and B, ZooKeeperDataCache will receive a data change event, and new data of policiesCache will be reloaded in ZooKeeperDataCache#reloadCache. So this reloaded data will invalidated in Step B.

And in PersistentTopic#onPoliciesUpdate (triggered by Step A) won't be able to get policy data with policiesCache().getDataIfPresent, so checkMessageExpiry is skipped and results in AdminApiTest#testTopicStatsLastExpireTimestampForSubscription failure.

Modifications

Remove policiesCache().invalidate in Step B.

Verifying this change

  • Make sure that the change passes the CI checks.

Documentation

Check the box below or label this PR directly.

  • doc-not-needed

Bug fix

@Jason918
Copy link
Copy Markdown
Contributor Author

Jason918 commented Aug 1, 2022

/pulsarbot run-failure-checks

@Jason918
Copy link
Copy Markdown
Contributor Author

Jason918 commented Aug 2, 2022

@codelipenghui codelipenghui merged commit 8c25d25 into apache:branch-2.7 Aug 3, 2022
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.

2 participants