Expand description
Size caps and the compaction trigger. Size caps and the compaction trigger.
Pure arithmetic over byte counts, deliberately free of engine and storage types so the thresholds can be tested and reasoned about on their own. Every constant here is derived from measurements recorded in the data layer design record, not chosen by feel.
Enums§
- Size
Verdict - Where a compacted document sits against the cap.
Constants§
- COMPACT_
DELTA_ LOG_ RATIO - Compact once the delta log is this many times the compacted document.
- COMPACT_
MAX_ COMMITS - Compact after this many commits regardless of byte ratios, 1024.
- COMPACT_
MIN_ DELTA_ LOG_ BYTES - Floor under the compaction trigger, 64 KiB.
- DOC_
SIZE_ WARN_ BYTES - Size at which a document starts warning, 768 KiB (75% of the cap).
- MAX_
DOC_ BYTES - Hard cap on the compacted encoding of one document, 1 MiB.
Functions§
- needs_
size_ check - Whether the document is close enough to the warning threshold that its true compacted size has to be measured before the next commit is accepted.
- should_
compact - Whether a document should be rewritten as a fresh compacted snapshot.
- size_
verdict - Classify a compacted document size.