mvcc: Add Unlock before panic to prevent double lock

release-3.5
Ziheng Liu 2019-10-28 22:38:34 -04:00
parent 84e2788c2e
commit 235d7c2e51
2 changed files with 2 additions and 0 deletions

View File

@ -427,6 +427,7 @@ func (s *store) restore() error {
for key, lid := range keyToLease {
if s.le == nil {
tx.Unlock()
panic("no lessor to attach lease")
}
err := s.le.Attach(lid, []lease.LeaseItem{{Key: key}})

View File

@ -159,6 +159,7 @@ func (s *watchableStore) cancelWatcher(wa *watcher) {
}
if !wa.victim {
s.mu.Unlock()
panic("watcher not victim but not in watch groups")
}