Skip to content

Add Litestream checkpoint configuration settings#727

Merged
epompeii merged 3 commits intodevelfrom
claude/litestream-checkpoint-config-Ga0DL
Mar 23, 2026
Merged

Add Litestream checkpoint configuration settings#727
epompeii merged 3 commits intodevelfrom
claude/litestream-checkpoint-config-Ga0DL

Conversation

@epompeii
Copy link
Copy Markdown
Member

@epompeii epompeii commented Mar 23, 2026

Added 3 optional fields to JsonLitestream: min_checkpoint_page_count, checkpoint_interval, and truncate_page_n.

Default truncate_page_n to 0.

@epompeii epompeii changed the title Adapt dotnet memory allocations (#705) Add Litestream checkpoint configuration settings Mar 23, 2026
@epompeii epompeii changed the base branch from main to devel March 23, 2026 01:15
@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 23, 2026

🤖 Claude Code Review

PR: #727
Base: devel
Head: claude/litestream-checkpoint-config-Ga0DL
Commit: c788feab106b683a3de293338e79a328ed2ebc06


PR Review: Litestream Checkpoint Configuration

Summary

3 commits adding Litestream checkpoint configuration options (JsonCheckpoint struct) with interval, min_page_count, and truncate_page_n fields, plus documentation updates across 9 languages and OpenAPI spec changes.


Issues

1. Breaking YAML output change (Medium)
LitestreamDb::truncate_page_n is non-optional (u64, not Option<u64>), so truncate-page-n: 0 is now always emitted in every generated Litestream YAML — even when the user didn't configure any checkpoint settings. This is a behavioral change for all existing deployments. While 0 is the Litestream default (TRUNCATE disabled), explicitly injecting a new key into the config file could be surprising. Consider either:

  • Making truncate_page_n an Option<u64> with skip_serializing_if (only emit when explicitly set), or
  • Documenting this as an intentional change that pins the safe default.

2. Missing trailing newlines in docs files (Low)
All 9 localized .mdx files end with \ No newline at end of file. This can cause diff noise in future edits and some tools warn about it.

3. No validation of duration strings (Low, pre-existing pattern)
interval is Option<String> with no validation — a typo like "5x" would only fail at Litestream runtime. This matches existing fields (sync_interval, snapshot_interval), so it's consistent, but worth noting as technical debt.


Positive Observations

  • Good use of destructuring in into_yaml — matches project convention and ensures compiler errors if fields are added later.
  • TRUNCATE_DISABLED constant is well-documented and provides a clear semantic name for the magic value 0.
  • Thorough test coverage — new into_yaml_with_checkpoint_config test covers the happy path, and existing tests are updated to assert the new default behavior.
  • OpenAPI spec updated via cargo gen-types — stays in sync with the Rust types.
  • Consistent patternsJsonCheckpoint follows the same Option + skip_serializing_if pattern used throughout the config module.
  • Documentation updated across all 9 languages simultaneously.

Verdict

The change is clean and well-structured. The main point to address is issue #1 — whether truncate-page-n: 0 should always appear in generated YAML or only when explicitly configured. The missing trailing newlines (#2) are a minor fix.


Model: claude-opus-4-6

@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 23, 2026

🐰 Bencher Report

Branchclaude/litestream-checkpoint-config-Ga0DL
Testbedubuntu-22.04
Click to view all benchmark results
BenchmarkLatencyBenchmark Result
microseconds (µs)
(Result Δ%)
Upper Boundary
microseconds (µs)
(Limit %)
Adapter::Json📈 view plot
🚷 view threshold
3.78 µs
(+6.36%)Baseline: 3.56 µs
4.69 µs
(80.70%)
Adapter::Magic (JSON)📈 view plot
🚷 view threshold
3.74 µs
(+5.98%)Baseline: 3.53 µs
4.61 µs
(81.10%)
Adapter::Magic (Rust)📈 view plot
🚷 view threshold
25.00 µs
(-1.99%)Baseline: 25.50 µs
31.53 µs
(79.28%)
Adapter::Rust📈 view plot
🚷 view threshold
2.82 µs
(+0.26%)Baseline: 2.81 µs
3.25 µs
(86.70%)
Adapter::RustBench📈 view plot
🚷 view threshold
2.80 µs
(-0.31%)Baseline: 2.81 µs
3.25 µs
(86.22%)
head_version_insert/batch/10📈 view plot
🚷 view threshold
102.62 µs
(+1.91%)Baseline: 100.70 µs
118.47 µs
(86.62%)
head_version_insert/batch/100📈 view plot
🚷 view threshold
242.67 µs
(+1.85%)Baseline: 238.26 µs
265.15 µs
(91.52%)
head_version_insert/batch/255📈 view plot
🚷 view threshold
465.87 µs
(+0.57%)Baseline: 463.25 µs
498.73 µs
(93.41%)
head_version_insert/batch/50📈 view plot
🚷 view threshold
162.34 µs
(+0.56%)Baseline: 161.44 µs
182.69 µs
(88.86%)
threshold_query/join/10📈 view plot
🚷 view threshold
151.39 µs
(+4.17%)Baseline: 145.33 µs
169.23 µs
(89.46%)
threshold_query/join/20📈 view plot
🚷 view threshold
162.99 µs
(+1.95%)Baseline: 159.87 µs
186.12 µs
(87.57%)
threshold_query/join/5📈 view plot
🚷 view threshold
147.52 µs
(+7.32%)Baseline: 137.46 µs
160.02 µs
(92.19%)
threshold_query/join/50📈 view plot
🚷 view threshold
199.44 µs
(-0.90%)Baseline: 201.26 µs
231.06 µs
(86.31%)
🐰 View full continuous benchmarking report in Bencher

claude added 2 commits March 23, 2026 02:20
Expose three checkpoint knobs in the disaster_recovery config:
- checkpoint_interval: PASSIVE checkpoint frequency (default: Litestream's 1m)
- min_checkpoint_page_count: PASSIVE checkpoint page threshold (default: Litestream's 1000)
- truncate_page_n: TRUNCATE checkpoint threshold (default: 0/disabled,
  overriding Litestream's 121359 to prevent blocking writes)

https://claude.ai/code/session_01NuwxpSViwEiAd7q6Jp8sRP
Group the three checkpoint fields (interval, min_page_count, truncate_page_n)
into an `Option<JsonCheckpoint>` struct on JsonLitestream, following the
codebase pattern for optional config groups. Update docs to use dot notation
(checkpoint.interval, etc.) with table rows. Regenerate OpenAPI spec.

https://claude.ai/code/session_01NuwxpSViwEiAd7q6Jp8sRP
@epompeii epompeii force-pushed the claude/litestream-checkpoint-config-Ga0DL branch from 1a188a4 to 1b1e456 Compare March 23, 2026 02:20
@epompeii epompeii merged commit d6c2b40 into devel Mar 23, 2026
62 checks passed
@epompeii epompeii deleted the claude/litestream-checkpoint-config-Ga0DL branch March 23, 2026 04:27
epompeii added a commit that referenced this pull request Mar 24, 2026
This changeset continues the `litestream` configuration updates
following:

1. #719
2. #727
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants