Skip to content

feat(node,store): compress existing cached blocks - #6853

Draft
MoonBoi9001 wants to merge 2 commits into
mb9/compress-new-blocksfrom
mb9/compress-existing-blocks
Draft

MoonBoi9001 wants to merge 2 commits into
mb9/compress-new-blocksfrom
mb9/compress-existing-blocks

Conversation

@MoonBoi9001

@MoonBoi9001 MoonBoi9001 commented Dec 1, 2026 •

Copy link
Copy Markdown
Member

TL;DR

Adds graphman chain compress-blocks, which compresses blocks already in a chain's block cache while the chain stays in use.

Motivation

#6851 only compresses blocks as they are written, so an existing cache keeps its uncompressed blocks until they are deleted. The alternative, truncating the cache and letting graph-node fetch blocks again, costs an RPC call for every block a subgraph needs and slows indexing while the cache refills; converting in place needs no RPC calls.

Summary

  • compress-blocks <chain> run copies the blocks into a new compressed table at a limited rate (--max-rate, 20 MB/s by default), keeps it up to date with changes, and swaps the tables at the end; --no-swap stops before the swap.
  • An interrupted run continues where it stopped; status shows progress and abort undoes an unfinished run.
  • drop-old deletes the uncompressed table after the swap.

Important

Until drop-old runs, the chain needs disk space for a second copy of its blocks, at about half their current size.

@MoonBoi9001
MoonBoi9001 added this pull request to stack #6852 December 1, 2026 10:28
@MoonBoi9001
MoonBoi9001 marked this pull request as ready for review December 1, 2026 10:48
@MoonBoi9001
MoonBoi9001 marked this pull request as draft December 1, 2026 10:57
@MoonBoi9001
MoonBoi9001 marked this pull request as ready for review December 1, 2026 16:56
@MoonBoi9001
MoonBoi9001 force-pushed the mb9/compress-existing-blocks branch from 880cfc3 to 297477c Compare December 1, 2026 17:24
@MoonBoi9001
MoonBoi9001 marked this pull request as draft December 1, 2026 17:48
Copy the blocks of a chain to a new table at a limited rate, compressing them with zstd,
while a trigger notes which blocks change. Then apply these changes and swap the tables. A
run can be continued or undone.
Blocks that are already cached stay uncompressed when compression is turned on. Add
compress-blocks, which compresses them, shows how far it got, and can undo an unfinished run
or delete the uncompressed blocks.
@MoonBoi9001
MoonBoi9001 force-pushed the mb9/compress-existing-blocks branch from 297477c to 0c67d4d Compare December 2, 2026 17:20

This branch has not been deployed

No deployments
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