mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
Merge pull request #17113 from ahrtr/etcd_log_20231213
Added some log messages for better diagnosis
This commit is contained in:
commit
a70fa9b471
@ -90,18 +90,22 @@ func bootstrap(cfg config.ServerConfig) (b *bootstrappedServer, err error) {
|
|||||||
bwal = bootstrapWALFromSnapshot(cfg, backend.snapshot)
|
bwal = bootstrapWALFromSnapshot(cfg, backend.snapshot)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cfg.Logger.Info("bootstrapping cluster")
|
||||||
cluster, err := bootstrapCluster(cfg, bwal, prt)
|
cluster, err := bootstrapCluster(cfg, bwal, prt)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
backend.Close()
|
backend.Close()
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cfg.Logger.Info("bootstrapping storage")
|
||||||
s := bootstrapStorage(cfg, st, backend, bwal, cluster)
|
s := bootstrapStorage(cfg, st, backend, bwal, cluster)
|
||||||
|
|
||||||
if err = cluster.Finalize(cfg, s); err != nil {
|
if err = cluster.Finalize(cfg, s); err != nil {
|
||||||
backend.Close()
|
backend.Close()
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cfg.Logger.Info("bootstrapping raft")
|
||||||
raft := bootstrapRaft(cfg, cluster, s.wal)
|
raft := bootstrapRaft(cfg, cluster, s.wal)
|
||||||
return &bootstrappedServer{
|
return &bootstrappedServer{
|
||||||
prt: prt,
|
prt: prt,
|
||||||
|
@ -298,8 +298,10 @@ type EtcdServer struct {
|
|||||||
func NewServer(cfg config.ServerConfig) (srv *EtcdServer, err error) {
|
func NewServer(cfg config.ServerConfig) (srv *EtcdServer, err error) {
|
||||||
b, err := bootstrap(cfg)
|
b, err := bootstrap(cfg)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
cfg.Logger.Error("bootstrap failed", zap.Error(err))
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
cfg.Logger.Info("bootstrap successfully")
|
||||||
|
|
||||||
defer func() {
|
defer func() {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -1975,7 +1977,9 @@ func removeNeedlessRangeReqs(txn *pb.TxnRequest) {
|
|||||||
// applyConfChange applies a ConfChange to the server. It is only
|
// applyConfChange applies a ConfChange to the server. It is only
|
||||||
// invoked with a ConfChange that has already passed through Raft
|
// 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) {
|
func (s *EtcdServer) applyConfChange(cc raftpb.ConfChange, confState *raftpb.ConfState, shouldApplyV3 membership.ShouldApplyV3) (bool, error) {
|
||||||
|
lg := s.Logger()
|
||||||
if err := s.cluster.ValidateConfigurationChange(cc); err != nil {
|
if err := s.cluster.ValidateConfigurationChange(cc); err != nil {
|
||||||
|
lg.Error("Validation on configuration change failed", zap.Bool("shouldApplyV3", bool(shouldApplyV3)), zap.Error(err))
|
||||||
cc.NodeID = raft.None
|
cc.NodeID = raft.None
|
||||||
s.r.ApplyConfChange(cc)
|
s.r.ApplyConfChange(cc)
|
||||||
|
|
||||||
@ -1988,7 +1992,6 @@ func (s *EtcdServer) applyConfChange(cc raftpb.ConfChange, confState *raftpb.Con
|
|||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
|
|
||||||
lg := s.Logger()
|
|
||||||
*confState = *s.r.ApplyConfChange(cc)
|
*confState = *s.r.ApplyConfChange(cc)
|
||||||
s.beHooks.SetConfState(confState)
|
s.beHooks.SetConfState(confState)
|
||||||
switch cc.Type {
|
switch cc.Type {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user