Merge 4518b4874e1d18cf68e86b517629c40c50ad75e4 into c86c93ca2951338115159dcdd20711603044e1f1

This commit is contained in:
Cristian Ferretti 2024-09-26 01:21:40 -04:00 committed by GitHub
commit 6089460224
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -195,13 +195,15 @@ func (e *Election) observe(ctx context.Context, ch chan<- v3.GetResponse) {
return return
} }
// only accept puts; a delete will make observe() spin // only accept puts; a delete will make observe() spin
// find the smaller create revision among the puts
for _, ev := range wr.Events { for _, ev := range wr.Events {
if ev.Type == mvccpb.PUT { if ev.Type == mvccpb.PUT {
hdr, kv = &wr.Header, ev.Kv if kv == nil || ev.Kv.CreateRevision < kv.CreateRevision {
// may have multiple revs; hdr.rev = the last rev hdr, kv = &wr.Header, ev.Kv
// set to kv's rev in case batch has multiple Puts // may have multiple revs; hdr.rev = the last rev
hdr.Revision = kv.ModRevision // set to kv's rev in case batch has multiple Puts
break hdr.Revision = kv.ModRevision
}
} }
} }
} }