Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 0 additions & 21 deletions server/etcdserver/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -1981,9 +1981,6 @@ func (s *EtcdServer) applyEntryNormal(e *raftpb.Entry, shouldApplyV3 membership.

needResult := s.w.IsRegistered(id)
if needResult || !noSideEffect(&raftReq) {
if !needResult && raftReq.Txn != nil {
removeNeedlessRangeReqs(raftReq.Txn)
}
ar = s.uberApply.Apply(&raftReq, shouldApplyV3)
}

Expand Down Expand Up @@ -2024,24 +2021,6 @@ func noSideEffect(r *pb.InternalRaftRequest) bool {
return r.Range != nil || r.AuthUserGet != nil || r.AuthRoleGet != nil || r.AuthStatus != nil
}

func removeNeedlessRangeReqs(txn *pb.TxnRequest) {
f := func(ops []*pb.RequestOp) []*pb.RequestOp {
j := 0
for i := 0; i < len(ops); i++ {
if _, ok := ops[i].Request.(*pb.RequestOp_RequestRange); ok {
continue
}
ops[j] = ops[i]
j++
}

return ops[:j]
}

txn.Success = f(txn.Success)
txn.Failure = f(txn.Failure)
}

// applyConfChange applies a ConfChange to the server. It is only
// invoked with a ConfChange that has already passed through Raft
func (s *EtcdServer) applyConfChange(cc raftpb.ConfChange, confState *raftpb.ConfState, shouldApplyV3 membership.ShouldApplyV3) (bool, error) {
Expand Down
6 changes: 1 addition & 5 deletions tests/e2e/reproduce_18667_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,6 @@ func TestReproduce18667(t *testing.T) {
// hasn't been resolved yet, so some members hold the wrong data
// "k2:foo". Once the issue is fixed, we should remove the if-else
// branch below, and all member should have consistent data k2:v2.
if i == 0 {
assert.Equal(t, "v2", string(resp.Kvs[0].Value))
} else {
assert.Equal(t, "foo", string(resp.Kvs[0].Value))
}
assert.Equal(t, "v2", string(resp.Kvs[0].Value))
}
}