mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
storage: release tx lock until finish using the readonly bytes
The backend will return read only bytes that are only vaild while the tx is open. We should hold the lock until we get a full copy by unmarshal.
This commit is contained in:
parent
d7f6ad0334
commit
ae5161382b
@ -324,7 +324,6 @@ func (s *watchableStore) syncWatchers() {
|
||||
tx := s.store.b.BatchTx()
|
||||
tx.Lock()
|
||||
ks, vs := tx.UnsafeRange(keyBucketName, minBytes, maxBytes, 0)
|
||||
tx.Unlock()
|
||||
|
||||
evs := []storagepb.Event{}
|
||||
|
||||
@ -351,6 +350,7 @@ func (s *watchableStore) syncWatchers() {
|
||||
|
||||
evs = append(evs, ev)
|
||||
}
|
||||
tx.Unlock()
|
||||
|
||||
for w, es := range newWatcherToEventMap(s.unsynced, evs) {
|
||||
select {
|
||||
|
Loading…
x
Reference in New Issue
Block a user