mvcc: no need to hold tx lock when converting kvs to watch events (#11701)
Method `kvsToEvents` can take a long time if a large number of events need to be synchronized. However, this method does not access any shared resources, so it no need to hold the tx lock when executing. So we can move it outside to reduce lock holding time.release-3.5
parent
72526cef00
commit
0eee733220
|
@ -358,9 +358,9 @@ func (s *watchableStore) syncWatchers() int {
|
|||
tx := s.store.b.ReadTx()
|
||||
tx.RLock()
|
||||
revs, vs := tx.UnsafeRange(keyBucketName, minBytes, maxBytes, 0)
|
||||
tx.RUnlock()
|
||||
var evs []mvccpb.Event
|
||||
evs = kvsToEvents(s.store.lg, wg, revs, vs)
|
||||
tx.RUnlock()
|
||||
|
||||
var victims watcherBatch
|
||||
wb := newWatcherBatch(wg, evs)
|
||||
|
|
Loading…
Reference in New Issue