Skip to content

kvstorage: add WAG truncation infrastructure#167533

Draft
iskettaneh wants to merge 2 commits intocockroachdb:masterfrom
iskettaneh:rse_truncate_2
Draft

kvstorage: add WAG truncation infrastructure#167533
iskettaneh wants to merge 2 commits intocockroachdb:masterfrom
iskettaneh:rse_truncate_2

Conversation

@iskettaneh
Copy link
Copy Markdown
Contributor

@iskettaneh iskettaneh commented Apr 4, 2026

First commit is based on #167527

This PR adds the infrastructure that will be used to truncating WAG
nodes. It will be used in two places: 1) Truncating all WAG nodes on
startup, and 2) Periodically truncating durably applied WAG nodes.

A lot of functions are similar to WAG replay, and there are TODOs to
reconcile the functions between WAG replay and truncation.

There is also some work left for clearing the Raft state, and deleting
sideloaded files.

Release note: None

Epic: None

This commit sets up the premitives for WAG truncations by:

1) Adding a `Delete` function for removing WAG nodes by index.
2) Changing the WAG `Iterator.Iter` method to return
 `iter.Seq2[uint64, wagpb.Node]` pair. This will be useful when we
  iterate over the WAG and truncate the nodes that have been applied and
  synced.

Epic: none
Release note: None

Co-Authored-By: roachdev-claude <roachdev-claude-bot@cockroachlabs.com>
@trunk-io
Copy link
Copy Markdown
Contributor

trunk-io bot commented Apr 4, 2026

Merging to master in this repository is managed by Trunk.

  • To merge this pull request, check the box to the left or comment /trunk merge below.

After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here

@cockroach-teamcity
Copy link
Copy Markdown
Member

This change is Reviewable

This PR adds the infrastructure that will be used to truncating WAG
nodes. It will be used in two places: 1) Truncating all WAG nodes on
startup, and 2) Periodically truncating durably applied WAG nodes.

A lot of functions are similar to WAG replay, and there are TODOs to
reconcile the functions between WAG replay and truncation.

There is also some work left for clearing the Raft state, and deleting
sideloaded files.

Release note: None

Co-Authored-By: roachdev-claude <roachdev-claude-bot@cockroachlabs.com>

kvstorage/wag: prepare for WAG truncation

This commit sets up the premitives for WAG truncations by:

1) Adding a `Delete` function for removing WAG nodes by index.
2) Changing the WAG `Iterator.Iter` method to return
 `iter.Seq2[uint64, wagpb.Node]` pair. This will be useful when we
  iterate over the WAG and truncate the nodes that have been applied and
  synced.

Epic: none
Release note: None

Co-Authored-By: roachdev-claude <roachdev-claude-bot@cockroachlabs.com>
@iskettaneh iskettaneh changed the title kvstorage/wag: prepare for WAG truncation kvstorage: add WAG truncation infrastructure Apr 5, 2026
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.

2 participants