Conversation
Passive collect walked every live SkipMap key each tick even when almost nothing was still above durable_txid_max. Under load Rule 3 keeps currents in the map, so that walk grew with the working set. Enqueue write-set keys while the commit is still Preparing, collect from those maps, and retire tags only after a durable watermark publish. Recovery seeds the same maps above the replay cutoff. Tests: checkpoint_state_machine collect_* unit tests Measure: EC2 NVMe c=4 A/B tip-gc (45s): TPS 1781→2000, ckpt_max 7.0s→3.2s
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Passive checkpoint collect walked every live
MvStore.rows/index_rowskey each tick. Under load, Rule 3 keeps currents in the SkipMap, so that walk grew with the working set even when almost nothing was still abovedurable_txid_max. EC2 c=4 profiles showedSkipList::search_boundundercollect_table_rowsas a real cost beside SQPOLL.Scope
MvStore::checkpoint_pending_{table,index}_rowstagged by commit tsnote_checkpoint_pendingatPreparing(beforelast_committed_tx_tscan cover the keys)collect_table_rows/collect_index_rowsiterate pending maps and look up chains in the storeretire_checkpoint_pending_throughafter durable watermark publishcollect_table_rows_skips_rows_not_in_pending_setOut of scope: io_uring / SQPOLL, Passive write-phase cost that still grows with how much must land in the B-tree.
Tradeoffs
Pending-key set over a timestamp-ordered secondary index. Smaller surface; relies on existing
checkpoint_snapshot_tsPreparing floor plus enqueue-before-Committed. Nestedby_versionmaps remain available if out-of-order holes show up in production.Blast Radius
MVCC Passive and Truncate checkpoint collection and commit prepare. Failed checkpoints keep pending tags. Aborted prepares leave stale tags that collect no-ops and later retire.
Verification
cargo test -p turso_core --lib checkpoint_state_machine::tests(16 ok)cargo test -p turso_core --lib mvcc::database::tests::test_checkpoint(24 ok)i-05fc9cecc91c64a99, tip744d84a915, c=4, group-commit, checkpointer 1000, 45s):Artifacts:
/mnt/nvme/run/ab-pending-collect-c4-20260907/and.audit/ab-pending-collect-c4-20260907/summary.txt.