fix: revert chain sync mutex to a regular lock

Conditions always call "unlock" so we can't safely use the condition
with both the read and write side of lock. So we might as well revert
back to a regular lock.

fixes #10616
This commit is contained in:
Steven Allen 2023-04-04 11:15:21 -07:00 committed by Phi
parent d77ac5ddcb
commit 34f46d736f
2 changed files with 3 additions and 3 deletions

View File

@ -188,7 +188,7 @@ type SplitStore struct {
cancel func()
outOfSync int32 // for fast checking
chainSyncMx sync.RWMutex
chainSyncMx sync.Mutex
chainSyncCond sync.Cond
chainSyncFinished bool // protected by chainSyncMx

View File

@ -917,8 +917,8 @@ func (s *SplitStore) waitForSync() {
if atomic.LoadInt32(&s.outOfSync) == 0 {
return
}
s.chainSyncMx.RLock()
defer s.chainSyncMx.RUnlock()
s.chainSyncMx.Lock()
defer s.chainSyncMx.Unlock()
for !s.chainSyncFinished {
s.chainSyncCond.Wait()