From fdd6145d6db5291c011cc8d86679724021b1e052 Mon Sep 17 00:00:00 2001 From: Nicolas Gailly Date: Wed, 30 Mar 2022 14:44:04 +0100 Subject: [PATCH] Feat/log catchup (#877) * add logging when doing catchup * adding decision log * log for full queue for sync beacon * Update chain/beacon/node.go * Apply suggestions from code review Co-authored-by: Yolan Romailler --- chain/beacon/chain.go | 1 + chain/beacon/node.go | 3 +++ 2 files changed, 4 insertions(+) diff --git a/chain/beacon/chain.go b/chain/beacon/chain.go index 9b2ee3754..94ce2c42e 100644 --- a/chain/beacon/chain.go +++ b/chain/beacon/chain.go @@ -204,6 +204,7 @@ func (c *chainStore) tryAppend(last, newB *chain.Beacon) bool { // only send if it's not full already case c.catchupBeacons <- newB: default: + c.l.Debugw("", "chain_store", "catchup", "channel", "full") } return true } diff --git a/chain/beacon/node.go b/chain/beacon/node.go index 00e420123..e5e0c5826 100644 --- a/chain/beacon/node.go +++ b/chain/beacon/node.go @@ -328,6 +328,7 @@ func (h *Handler) run(startTime int64) { go h.chain.RunSync(context.Background(), current.round, nil) } case b := <-h.chain.AppendedBeaconNoSync(): + h.l.Debugw("", "beacon_loop", "catchupmode", "last_is", b.Round, "current", current.round, "catchup_launch", b.Round < current.round) if b.Round < current.round { // When network is down, all alive nodes will broadcast their // signatures periodically with the same period. As soon as one @@ -339,7 +340,9 @@ func (h *Handler) run(startTime int64) { // channel will trigger again etc until we arrive at the correct // round. go func(c roundInfo, latest *chain.Beacon) { + h.l.Debugw("sleeping now", "beacon_loop", "catchupmode", "last_is", latest.Round, "seep_for", h.conf.Group.CatchupPeriod) h.conf.Clock.Sleep(h.conf.Group.CatchupPeriod) + h.l.Debugw("broadcast next partial", "beacon_loop", "catchupmode", "last_is", latest.Round) h.broadcastNextPartial(c, latest) }(current, b) }