Skip to content

Truncate the WAL whenever no proposal is in flight - #735

Open
pfi79 wants to merge 1 commit into
hyperledger:mainfrom
pfi79:truncate-wal-on-sync
Open

pfi79 wants to merge 1 commit into
hyperledger:mainfrom
pfi79:truncate-wal-on-sync

Conversation

@pfi79

@pfi79 pfi79 commented Oct 23, 2026

Copy link
Copy Markdown
Contributor

Watching the stands, I found that some nodes are accumulating wal files, while they are quite working and efficient. The height of the blocks is normal. I think it's just that there are no signals for such nodes to trim the wal files. Below is my suggestion to change the situation:

The WAL only freed space at a truncation point, which only a pre-prepare carried. A node that never proposed never deleted a file: files rotated by size, truncateIndex stayed zero, and restarts accumulated anchor-only files.

PersistedState.Save now derives the truncation flag from whether a proposal is in flight rather than from the message type, so NewView after sync or view change and ViewChange with nothing in flight also truncate. A commit never does, keeping a pre-prepare and its commit together. Open also drops trailing anchor-only files, so restarts stop adding files.

@pfi79
pfi79 marked this pull request as draft October 23, 2026 12:41
@pfi79
pfi79 force-pushed the truncate-wal-on-sync branch from 1e6d8cf to 6329c7f Compare October 23, 2026 13:02
The WAL only freed space at a truncation point, which only a pre-prepare
carried. A node that never proposed never deleted a file: files rotated by
size, truncateIndex stayed zero, and restarts accumulated anchor-only files.

PersistedState.Save now derives the truncation flag from whether a proposal
is in flight rather than from the message type, so NewView after sync or view
change and ViewChange with nothing in flight also truncate. A commit never
does, keeping a pre-prepare and its commit together. Open also drops trailing
anchor-only files, so restarts stop adding files.

Signed-off-by: Fedor Partanskiy <fredprtnsk@gmail.com>
@pfi79
pfi79 force-pushed the truncate-wal-on-sync branch from 6329c7f to aa13246 Compare October 23, 2026 13:04
@pfi79
pfi79 marked this pull request as ready for review October 23, 2026 13:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant