Merge pull request #224 from ekexium/deadlock-comment

Add some comment for deadlock #219
This commit is contained in:
Nick Cameron 2021-01-13 16:01:48 +13:00 committed by GitHub
commit 0c68c51d63
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 0 deletions

View File

@ -54,6 +54,8 @@ macro_rules! retry {
let stats = pd_stats($tag);
let mut last_err = Ok(());
for _ in 0..LEADER_CHANGE_RETRY {
// use the block here to drop the guard of the read lock,
// otherwise `reconnect` will try to acquire the write lock and results in a deadlock
let res = {
let $cluster = &$self.cluster.read().await.0;
let res = $call.await;