Merge pull request #11300 from lzhfromustc/MU_mvcc2

mvcc: Add Unlock before panic to prevent double lock
This commit is contained in:
Gyuho Lee 2019-10-31 10:14:34 -07:00 committed by GitHub
commit fa972cf296
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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")
}