michaeljmarshall commented on code in PR #17401:
URL: https://github.com/apache/pulsar/pull/17401#discussion_r966615232


##########
pulsar-metadata/src/main/java/org/apache/pulsar/metadata/coordination/impl/LeaderElectionImpl.java:
##########
@@ -207,11 +219,6 @@ private synchronized 
CompletableFuture<LeaderElectionState> tryToBecomeLeader()
                         // There was a conflict between 2 participants trying 
to become leaders at same time. Retry
                         // to fetch info on new leader.
 
-                        // We force the invalidation of the cache entry. Since 
we received a BadVersion error, we
-                        // already know that the entry is out of date. If we 
don't invalidate, we'd be retrying the
-                        // leader election many times until we finally receive 
the notification that invalidates the
-                        // cache.
-                        cache.invalidate(path);

Review Comment:
   The `elect()` method only calls `cache.refresh(path);` after a callback from 
this method (`handleExistingLeaderValue()`) is completed, and if we don't 
invalidate the cache, I think we'll recursively call 
`handleExistingLeaderValue()` as the comment indicates because 
`store.get(path)` will return a non empty result.



-- 
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