mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
Merge pull request #14290 from ahrtr/3.4_no_prevkv_for_create
[3.4] Do not get previous K/V for create event
This commit is contained in:
commit
ee366151c6
@ -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,
|
||||
|
2
test
2
test
@ -466,7 +466,7 @@ function govet_shadow_pass {
|
||||
# shellcheck disable=SC2206
|
||||
fmtpkgs=($fmtpkgs)
|
||||
# Golang 1.12 onwards the experimental -shadow option is no longer available with go vet
|
||||
go get golang.org/x/tools/go/analysis/passes/shadow/cmd/shadow
|
||||
go get golang.org/x/tools/go/analysis/passes/shadow/cmd/shadow@v0.1.11
|
||||
export PATH=${GOPATH}/bin:${PATH}
|
||||
# shellcheck disable=SC2230
|
||||
shadow_tool=$(which shadow)
|
||||
|
Loading…
x
Reference in New Issue
Block a user