Skip to content

Commit d25513d

Browse files
committed
Execute the same validation for TXN
This commit will ensure all members execute the same validation for TXN by not removing range requests from TXN. Ref patch: ahrtr@76ac23f Signed-off-by: ArkaSaha30 <[email protected]>
1 parent 7b429f9 commit d25513d

File tree

1 file changed

+0
-21
lines changed

1 file changed

+0
-21
lines changed

server/etcdserver/server.go

-21
Original file line numberDiff line numberDiff line change
@@ -1967,9 +1967,6 @@ func (s *EtcdServer) applyEntryNormal(e *raftpb.Entry, shouldApplyV3 membership.
19671967

19681968
needResult := s.w.IsRegistered(id)
19691969
if needResult || !noSideEffect(&raftReq) {
1970-
if !needResult && raftReq.Txn != nil {
1971-
removeNeedlessRangeReqs(raftReq.Txn)
1972-
}
19731970
ar = s.applyInternalRaftRequest(&raftReq, shouldApplyV3)
19741971
}
19751972

@@ -2041,24 +2038,6 @@ func noSideEffect(r *pb.InternalRaftRequest) bool {
20412038
return r.Range != nil || r.AuthUserGet != nil || r.AuthRoleGet != nil || r.AuthStatus != nil
20422039
}
20432040

2044-
func removeNeedlessRangeReqs(txn *pb.TxnRequest) {
2045-
f := func(ops []*pb.RequestOp) []*pb.RequestOp {
2046-
j := 0
2047-
for i := 0; i < len(ops); i++ {
2048-
if _, ok := ops[i].Request.(*pb.RequestOp_RequestRange); ok {
2049-
continue
2050-
}
2051-
ops[j] = ops[i]
2052-
j++
2053-
}
2054-
2055-
return ops[:j]
2056-
}
2057-
2058-
txn.Success = f(txn.Success)
2059-
txn.Failure = f(txn.Failure)
2060-
}
2061-
20622041
// applyConfChange applies a ConfChange to the server. It is only
20632042
// invoked with a ConfChange that has already passed through Raft
20642043
func (s *EtcdServer) applyConfChange(cc raftpb.ConfChange, confState *raftpb.ConfState, shouldApplyV3 membership.ShouldApplyV3) (bool, error) {

0 commit comments

Comments
 (0)