Skip to content

Commit

Permalink
Disable proposal forwarding for lease revoke requests
Browse files Browse the repository at this point in the history
Signed-off-by: Hitoshi Mitake <[email protected]>
  • Loading branch information
mitake committed Oct 23, 2023
1 parent 3293e58 commit 8fffd7d
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions server/etcdserver/bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -522,6 +522,21 @@ func raftConfig(cfg config.ServerConfig, id uint64, s *raft.MemoryStorage) *raft
CheckQuorum: true,
PreVote: cfg.PreVote,
Logger: NewRaftLoggerZap(cfg.Logger.Named("raft")),
DisableProposalForwardingCallback: func(m raftpb.Message) bool {
for _, entry := range m.Entries {
var raftReq etcdserverpb.InternalRaftRequest
if !pbutil.MaybeUnmarshal(&raftReq, entry.Data) {
continue
}

if raftReq.LeaseRevoke != nil {
// If at least one of the entries has LeaseRevoke, the entire m will be discarded.
// TODO: LeaseCheckPoint should be discarded neither?
return true
}
}
return false
},
}
}

Expand Down

0 comments on commit 8fffd7d

Please sign in to comment.