mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
do not get previous K/V for create event
Signed-off-by: Benjamin Wang <wachao@vmware.com>
This commit is contained in:
parent
314dcbf6f5
commit
cc1b0e6a44
@ -400,7 +400,7 @@ func (sws *serverWatchStream) sendLoop() {
|
||||
sws.mu.RUnlock()
|
||||
for i := range evs {
|
||||
events[i] = &evs[i]
|
||||
if needPrevKV {
|
||||
if needPrevKV && !isCreateEvent(evs[i]) {
|
||||
opt := mvcc.RangeOptions{Rev: evs[i].Kv.ModRevision - 1}
|
||||
r, err := sws.watchable.Range(evs[i].Kv.Key, nil, opt)
|
||||
if err == nil && len(r.KVs) != 0 {
|
||||
@ -534,6 +534,10 @@ func (sws *serverWatchStream) sendLoop() {
|
||||
}
|
||||
}
|
||||
|
||||
func isCreateEvent(e mvccpb.Event) bool {
|
||||
return e.Type == mvccpb.PUT && e.Kv.CreateRevision == e.Kv.ModRevision
|
||||
}
|
||||
|
||||
func sendFragments(
|
||||
wr *pb.WatchResponse,
|
||||
maxRequestBytes int,
|
||||
|
Loading…
x
Reference in New Issue
Block a user