Skip to content

docs: document ingester WAL truncation mechanics#7661

Open
CharlieTLe wants to merge 1 commit into
cortexproject:masterfrom
CharlieTLe:docs/ingester-wal
Open

docs: document ingester WAL truncation mechanics#7661
CharlieTLe wants to merge 1 commit into
cortexproject:masterfrom
CharlieTLe:docs/ingester-wal

Conversation

@CharlieTLe

Copy link
Copy Markdown
Member

Summary

  • Add docs/blocks-storage/ingester-wal.md, a dedicated page covering the ingester WAL: write path, replay on startup, and — most notably — exactly what triggers WAL truncation.
  • Cover the head-compaction loop cadence, the 1.5 × block-ranges-period head-compactable threshold, the head-compaction-idle-timeout forced-compaction path, and the lower-two-thirds checkpoint window inside TSDB's truncateWAL.
  • Cross-link the new page from docs/blocks-storage/_index.md and from the Ingester section of docs/blocks-storage/production-tips.md.

Motivation

The existing docs only state that "the WAL is truncated when a new TSDB block is created, which by default occurs every 2 hours." That is roughly true for busy tenants but leaves several questions unanswered:

  • What if a tenant produces very few samples? (Answer: head-compaction-idle-timeout.)
  • Which config flags affect the WAL cadence, and which ones look related but aren't (retention-period)?
  • Why does the WAL sometimes not shrink immediately after a block is written? (Answer: only the lower two-thirds of eligible segments are checkpointed.)

The new page consolidates that information in one place so operators tuning ingester disk usage don't have to trace through vendored TSDB code.

Test plan

  • Docs render correctly on the Cortex docs site (heading levels, table formatting, internal links).
  • All internal links resolve: ./ingester-wal.md, ../guides/ingesters-rolling-updates.md, ./production-tips.md#ingester-disk-space.
  • Frontmatter (weight: 5, slug: ingester-wal) matches sibling pages under docs/blocks-storage/.

Docs-only change; no code, tests, or config are modified.

Add a dedicated blocks-storage/ingester-wal.md page covering the WAL
write path, replay on startup, and — most notably — exactly what
triggers WAL truncation: the head-compaction loop, the
1.5 x block-ranges-period head-compactable threshold, the
head-compaction-idle-timeout forced path, and the lower-two-thirds
checkpoint window inside TSDB's truncateWAL.

Cross-link the new page from the blocks-storage overview and from
the ingester section of production-tips.

Signed-off-by: Charlie Le <charlie_le@apple.com>
@dosubot dosubot Bot added component/documentation component/ingester type/chore Something that needs to be done; not a bug or a feature labels Jul 1, 2026
| `-blocks-storage.tsdb.head-compaction-idle-timeout` | `1h` | Forces compaction (and therefore truncation) for tenants whose head is not otherwise compactable. `0` disables. |
| `-blocks-storage.tsdb.block-ranges-period` | `2h` | Sets both the block size and the `3/2 × block-range` head-compactable threshold. |
| `-blocks-storage.tsdb.wal-compression-type` | *(none)* | `snappy` or `zstd` reduces WAL size on disk; does not change truncation timing. |
| `-blocks-storage.tsdb.wal-segment-size-bytes` | TSDB default | Changes the size of each WAL segment; does not change truncation timing. |

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we make this default explicit as 134217728 (TSDB default, 128 MiB) instead of just TSDB default?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component/documentation component/ingester size/L type/chore Something that needs to be done; not a bug or a feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants