Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: comment out expensive debug logs #143

Merged
merged 1 commit into from
Aug 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions consensus/reactor.go
Original file line number Diff line number Diff line change
Expand Up @@ -1395,12 +1395,12 @@ func (ps *PeerState) SetHasVoteFromPeer(vote *types.Vote, csHeight int64, valSiz
}

func (ps *PeerState) setHasVote(height int64, round int32, voteType cmtproto.SignedMsgType, index int32) {
ps.logger.Debug("setHasVote",
"peerH/R",
log.NewLazySprintf("%d/%d", ps.PRS.Height, ps.PRS.Round),
"H/R",
log.NewLazySprintf("%d/%d", height, round),
"type", voteType, "index", index)
// ps.logger.Debug("setHasVote",
// "peerH/R",
// log.NewLazySprintf("%d/%d", ps.PRS.Height, ps.PRS.Round),
// "H/R",
// log.NewLazySprintf("%d/%d", height, round),
// "type", voteType, "index", index)

// NOTE: some may be nil BitArrays -> no side effects.
psVotes := ps.getVoteBitArray(height, round, voteType)
Expand Down
14 changes: 7 additions & 7 deletions consensus/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -2211,7 +2211,7 @@ func (cs *State) addVote(vote *types.Vote, peerID p2p.ID) (added bool, err error
return added, err
}

cs.Logger.Debug("added vote to last precommits", "last_commit", cs.LastCommit.StringShort())
// cs.Logger.Debug("added vote to last precommits", "last_commit", cs.LastCommit.StringShort())
if err := cs.eventBus.PublishEventVote(types.EventDataVote{Vote: vote}); err != nil {
return added, err
}
Expand Down Expand Up @@ -2303,7 +2303,7 @@ func (cs *State) addVote(vote *types.Vote, peerID p2p.ID) (added bool, err error
switch vote.Type {
case cmtproto.PrevoteType:
prevotes := cs.Votes.Prevotes(vote.Round)
cs.Logger.Debug("added vote to prevote", "vote", vote, "prevotes", prevotes.StringShort())
// cs.Logger.Debug("added vote to prevote", "vote", vote, "prevotes", prevotes.StringShort())

// If +2/3 prevotes for a block or nil for *any* round:
if blockID, ok := prevotes.TwoThirdsMajority(); ok {
Expand Down Expand Up @@ -2338,11 +2338,11 @@ func (cs *State) addVote(vote *types.Vote, peerID p2p.ID) (added bool, err error
cs.ValidBlock = cs.ProposalBlock
cs.ValidBlockParts = cs.ProposalBlockParts
} else {
cs.Logger.Debug(
"valid block we do not know about; set ProposalBlock=nil",
"proposal", log.NewLazyBlockHash(cs.ProposalBlock),
"block_id", blockID.Hash,
)
// cs.Logger.Debug(
// "valid block we do not know about; set ProposalBlock=nil",
// "proposal", log.NewLazyBlockHash(cs.ProposalBlock),
// "block_id", blockID.Hash,
// )

// we're getting the wrong block
cs.ProposalBlock = nil
Expand Down
6 changes: 3 additions & 3 deletions p2p/conn/connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@
return false
}

c.Logger.Debug("Send", "channel", chID, "conn", c, "msgBytes", log.NewLazySprintf("%X", msgBytes))
// c.Logger.Debug("Send", "channel", chID, "conn", c, "msgBytes", log.NewLazySprintf("%X", msgBytes))

// Send message to channel.
channel, ok := c.channelsIdx[chID]
Expand All @@ -376,8 +376,8 @@
case c.send <- struct{}{}:
default:
}
} else {

Check failure on line 379 in p2p/conn/connection.go

View workflow job for this annotation

GitHub Actions / golangci-lint

SA9003: empty branch (staticcheck)
c.Logger.Debug("Send failed", "channel", chID, "conn", c, "msgBytes", log.NewLazySprintf("%X", msgBytes))
// c.Logger.Debug("Send failed", "channel", chID, "conn", c, "msgBytes", log.NewLazySprintf("%X", msgBytes))
}
return success
}
Expand All @@ -389,7 +389,7 @@
return false
}

c.Logger.Debug("TrySend", "channel", chID, "conn", c, "msgBytes", log.NewLazySprintf("%X", msgBytes))
// c.Logger.Debug("TrySend", "channel", chID, "conn", c, "msgBytes", log.NewLazySprintf("%X", msgBytes))

// Send message to channel.
channel, ok := c.channelsIdx[chID]
Expand Down
14 changes: 7 additions & 7 deletions p2p/peer.go
Original file line number Diff line number Diff line change
Expand Up @@ -319,13 +319,13 @@ func (p *peer) HasChannel(chID byte) bool {
}
// NOTE: probably will want to remove this
// but could be helpful while the feature is new
p.Logger.Debug(
"Unknown channel for peer",
"channel",
chID,
"channels",
p.channels,
)
// p.Logger.Debug(
// "Unknown channel for peer",
// "channel",
// chID,
// "channels",
// p.channels,
// )
return false
}

Expand Down
Loading