mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
rafthttp: add/fix debugging lines
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
This commit is contained in:
parent
8f8b32b253
commit
8296ce0930
@ -344,8 +344,8 @@ func (c *RaftCluster) AddMember(m *Member) {
|
|||||||
"added member",
|
"added member",
|
||||||
zap.String("cluster-id", c.cid.String()),
|
zap.String("cluster-id", c.cid.String()),
|
||||||
zap.String("local-member-id", c.localID.String()),
|
zap.String("local-member-id", c.localID.String()),
|
||||||
zap.String("removed-remote-peer-id", m.ID.String()),
|
zap.String("added-peer-id", m.ID.String()),
|
||||||
zap.Strings("removed-remote-peer-peer-urls", m.PeerURLs),
|
zap.Strings("added-peer-peer-urls", m.PeerURLs),
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
plog.Infof("added member %s %v to cluster %s", m.ID, m.PeerURLs, c.cid)
|
plog.Infof("added member %s %v to cluster %s", m.ID, m.PeerURLs, c.cid)
|
||||||
@ -424,7 +424,7 @@ func (c *RaftCluster) UpdateAttributes(id types.ID, attr Attributes) {
|
|||||||
"skipped attributes update of removed member",
|
"skipped attributes update of removed member",
|
||||||
zap.String("cluster-id", c.cid.String()),
|
zap.String("cluster-id", c.cid.String()),
|
||||||
zap.String("local-member-id", c.localID.String()),
|
zap.String("local-member-id", c.localID.String()),
|
||||||
zap.String("removed-remote-peer-id", id.String()),
|
zap.String("updated-peer-id", id.String()),
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
plog.Warningf("skipped updating attributes of removed member %s", id)
|
plog.Warningf("skipped updating attributes of removed member %s", id)
|
||||||
|
@ -455,6 +455,8 @@ func (h *streamHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
|||||||
Writer: w,
|
Writer: w,
|
||||||
Flusher: w.(http.Flusher),
|
Flusher: w.(http.Flusher),
|
||||||
Closer: c,
|
Closer: c,
|
||||||
|
localID: h.tr.ID,
|
||||||
|
peerID: h.id,
|
||||||
}
|
}
|
||||||
p.attachOutgoingConn(conn)
|
p.attachOutgoingConn(conn)
|
||||||
<-c.closeNotify()
|
<-c.closeNotify()
|
||||||
|
@ -72,7 +72,7 @@ func (s *peerStatus) deactivate(failure failureType, reason string) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
if s.lg != nil {
|
if s.lg != nil {
|
||||||
s.lg.Warn("peer deactivated again", zap.String("peer-id", s.id.String()), zap.Error(errors.New(msg)))
|
s.lg.Debug("peer deactivated again", zap.String("peer-id", s.id.String()), zap.Error(errors.New(msg)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -101,6 +101,9 @@ type outgoingConn struct {
|
|||||||
io.Writer
|
io.Writer
|
||||||
http.Flusher
|
http.Flusher
|
||||||
io.Closer
|
io.Closer
|
||||||
|
|
||||||
|
localID types.ID
|
||||||
|
peerID types.ID
|
||||||
}
|
}
|
||||||
|
|
||||||
// streamWriter writes messages to the attached outgoingConn.
|
// streamWriter writes messages to the attached outgoingConn.
|
||||||
@ -242,6 +245,14 @@ func (cw *streamWriter) run() {
|
|||||||
default:
|
default:
|
||||||
plog.Panicf("unhandled stream type %s", conn.t)
|
plog.Panicf("unhandled stream type %s", conn.t)
|
||||||
}
|
}
|
||||||
|
if cw.lg != nil {
|
||||||
|
cw.lg.Info(
|
||||||
|
"set message encoder",
|
||||||
|
zap.String("from", conn.localID.String()),
|
||||||
|
zap.String("to", conn.peerID.String()),
|
||||||
|
zap.String("stream-type", t.String()),
|
||||||
|
)
|
||||||
|
}
|
||||||
flusher = conn.Flusher
|
flusher = conn.Flusher
|
||||||
unflushed = 0
|
unflushed = 0
|
||||||
cw.status.activate()
|
cw.status.activate()
|
||||||
@ -578,6 +589,14 @@ func (cr *streamReader) dial(t streamType) (io.ReadCloser, error) {
|
|||||||
uu := u
|
uu := u
|
||||||
uu.Path = path.Join(t.endpoint(), cr.tr.ID.String())
|
uu.Path = path.Join(t.endpoint(), cr.tr.ID.String())
|
||||||
|
|
||||||
|
if cr.lg != nil {
|
||||||
|
cr.lg.Debug(
|
||||||
|
"dial stream reader",
|
||||||
|
zap.String("from", cr.tr.ID.String()),
|
||||||
|
zap.String("to", cr.peerID.String()),
|
||||||
|
zap.String("address", uu.String()),
|
||||||
|
)
|
||||||
|
}
|
||||||
req, err := http.NewRequest("GET", uu.String(), nil)
|
req, err := http.NewRequest("GET", uu.String(), nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
cr.picker.unreachable(u)
|
cr.picker.unreachable(u)
|
||||||
|
@ -286,6 +286,15 @@ func (t *Transport) AddRemote(id types.ID, us []string) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
t.remotes[id] = startRemote(t, urls, id)
|
t.remotes[id] = startRemote(t, urls, id)
|
||||||
|
|
||||||
|
if t.Logger != nil {
|
||||||
|
t.Logger.Info(
|
||||||
|
"added new remote peer",
|
||||||
|
zap.String("local-member-id", t.ID.String()),
|
||||||
|
zap.String("remote-peer-id", id.String()),
|
||||||
|
zap.Strings("remote-peer-urls", us),
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *Transport) AddPeer(id types.ID, us []string) {
|
func (t *Transport) AddPeer(id types.ID, us []string) {
|
||||||
@ -311,7 +320,12 @@ func (t *Transport) AddPeer(id types.ID, us []string) {
|
|||||||
addPeerToProber(t.Logger, t.prober, id.String(), us)
|
addPeerToProber(t.Logger, t.prober, id.String(), us)
|
||||||
|
|
||||||
if t.Logger != nil {
|
if t.Logger != nil {
|
||||||
t.Logger.Info("added remote peer", zap.String("remote-peer-id", id.String()))
|
t.Logger.Info(
|
||||||
|
"added remote peer",
|
||||||
|
zap.String("local-member-id", t.ID.String()),
|
||||||
|
zap.String("remote-peer-id", id.String()),
|
||||||
|
zap.Strings("remote-peer-urls", us),
|
||||||
|
)
|
||||||
} else {
|
} else {
|
||||||
plog.Infof("added peer %s", id)
|
plog.Infof("added peer %s", id)
|
||||||
}
|
}
|
||||||
@ -347,7 +361,11 @@ func (t *Transport) removePeer(id types.ID) {
|
|||||||
t.prober.Remove(id.String())
|
t.prober.Remove(id.String())
|
||||||
|
|
||||||
if t.Logger != nil {
|
if t.Logger != nil {
|
||||||
t.Logger.Info("removed remote peer", zap.String("remote-peer-id", id.String()))
|
t.Logger.Info(
|
||||||
|
"removed remote peer",
|
||||||
|
zap.String("local-member-id", t.ID.String()),
|
||||||
|
zap.String("removed-remote-peer-id", id.String()),
|
||||||
|
)
|
||||||
} else {
|
} else {
|
||||||
plog.Infof("removed peer %s", id)
|
plog.Infof("removed peer %s", id)
|
||||||
}
|
}
|
||||||
@ -374,7 +392,12 @@ func (t *Transport) UpdatePeer(id types.ID, us []string) {
|
|||||||
addPeerToProber(t.Logger, t.prober, id.String(), us)
|
addPeerToProber(t.Logger, t.prober, id.String(), us)
|
||||||
|
|
||||||
if t.Logger != nil {
|
if t.Logger != nil {
|
||||||
t.Logger.Info("updated remote peer", zap.String("remote-peer-id", id.String()))
|
t.Logger.Info(
|
||||||
|
"updated remote peer",
|
||||||
|
zap.String("local-member-id", t.ID.String()),
|
||||||
|
zap.String("updated-remote-peer-id", id.String()),
|
||||||
|
zap.Strings("updated-remote-peer-urls", us),
|
||||||
|
)
|
||||||
} else {
|
} else {
|
||||||
plog.Infof("updated peer %s", id)
|
plog.Infof("updated peer %s", id)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user