Skip to content

Commit 6b50b96

Browse files
NRG: Clarify debug log when clearing WAL (#6705)
Before this change there were two log statements: `WRN Resetting WAL state` and `DBG Resetting WAL`. Whenever a WAL needs to be reset, when looking at the WRN log, it means something went wrong and we can't properly replicate (which could result in desync). The DBG log however looks just as scary but actually is harmless. You'd see that log message when truncating the WAL back to applied/snapshot, which is normal and can happen. Updating the wording in the DBG log to clearly differentiate between a (bad) reset and clearing/truncating the WAL which is normal in this case. Signed-off-by: Maurice van Veen <[email protected]>
2 parents de08012 + c23f837 commit 6b50b96

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

server/raft.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3272,8 +3272,9 @@ func (n *raft) truncateWAL(term, index uint64) {
32723272
if err := n.wal.Truncate(index); err != nil {
32733273
// If we get an invalid sequence, reset our wal all together.
32743274
// We will not have holes, so this means we do not have this message stored anymore.
3275+
// This is normal when truncating back to applied/snapshot.
32753276
if err == ErrInvalidSequence {
3276-
n.debug("Resetting WAL")
3277+
n.debug("Clearing WAL")
32773278
n.wal.Truncate(0)
32783279
// If our index is non-zero use PurgeEx to set us to the correct next index.
32793280
if index > 0 {

0 commit comments

Comments
 (0)