From 5e9054b5ac4af5f2a92d628e1b96b68829039433 Mon Sep 17 00:00:00 2001 From: Hitoshi Mitake Date: Mon, 23 Oct 2023 17:43:51 +0900 Subject: [PATCH] Disable proposal forwarding for lease revoke requests Signed-off-by: Hitoshi Mitake --- server/etcdserver/bootstrap.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/server/etcdserver/bootstrap.go b/server/etcdserver/bootstrap.go index 466aa549ecd1..bbeaee34e8eb 100644 --- a/server/etcdserver/bootstrap.go +++ b/server/etcdserver/bootstrap.go @@ -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 + }, } }