From f0276cb4fa4e3f509783df28f9ed1038e3c2af15 Mon Sep 17 00:00:00 2001 From: Benjamin Wang Date: Thu, 6 Jun 2024 19:34:44 +0100 Subject: [PATCH] print error log when validation on conf change failed Signed-off-by: Benjamin Wang --- etcdserver/server.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/etcdserver/server.go b/etcdserver/server.go index 2622409afb0..55ce02b03a0 100644 --- a/etcdserver/server.go +++ b/etcdserver/server.go @@ -2381,13 +2381,18 @@ func (s *EtcdServer) notifyAboutFirstCommitInTerm() { // 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) (bool, error) { + lg := s.getLogger() if err := s.cluster.ValidateConfigurationChange(cc); err != nil { + if lg != nil { + lg.Error("Validation on configuration change failed", zap.Error(err)) + } else { + plog.Errorf("Validation on configuration change failed: %v", err) + } cc.NodeID = raft.None s.r.ApplyConfChange(cc) return false, err } - lg := s.getLogger() *confState = *s.r.ApplyConfChange(cc) switch cc.Type { case raftpb.ConfChangeAddNode, raftpb.ConfChangeAddLearnerNode: