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

consolidate empty wal entries error logs in one warning #1393

Merged
merged 4 commits into from
May 12, 2022
Merged
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: 10 additions & 2 deletions raft/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"errors"
"fmt"
"io"
"net"
"net/http"
"net/url"
Expand Down Expand Up @@ -484,10 +485,14 @@ func (pm *ProtocolManager) startRaft() {
// chain and all other nodes in the network have confirmed these blocks
if maybeRaftSnapshot != nil {
currentChainHead := pm.blockchain.CurrentBlock().Number()
for _, entry := range entries {
emptyEntries := make([]int, 0, len(entries))
for idx, entry := range entries {
if entry.Type == raftpb.EntryNormal {
var block types.Block
if err := rlp.DecodeBytes(entry.Data, &block); err != nil {
if err := rlp.DecodeBytes(entry.Data, &block); err == io.EOF {
emptyEntries = append(emptyEntries, idx)
continue
} else if err != nil {
log.Error("error decoding block: ", "err", err)
continue
}
Expand All @@ -505,6 +510,9 @@ func (pm *ProtocolManager) startRaft() {
}
}
}
if len(emptyEntries) > 0 {
log.Warn("empty wal entries", "index", emptyEntries)
}
}

if hardState, _, err := pm.raftStorage.InitialState(); err != nil {
Expand Down