Jason918 opened a new pull request, #16899:
URL: https://github.com/apache/pulsar/pull/16899

   ### 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.
   
   - [x] `doc-not-needed` 
   
   Bug fix
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to