lhotari commented on code in PR #17401:
URL: https://github.com/apache/pulsar/pull/17401#discussion_r966673888
##########
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:
It's sufficient to call `cache.refresh(path)` after the election has been
completed.
The cached value is not used in any away in the leader election code path.
That's why I don't think it would make any difference. `cache.get` is currently
called in `tryToBecomeLeader`, but that seems unnecessary and should be removed.
--
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]