Repository navigation
feat(engine): wire SpillGranularity.PerItem in spill write path (STN-5 #2339) - #4428
Merged
Merged
Conversation
oferchen
force-pushed
the
feature/stn-5-granularity-wiring
branch
from
May 18, 2026 00:55
0801bcc to
596ab5d
Compare
…#2339) The `SpillGranularity` knob on `SpillPolicy` was a forward-compat stub. This change makes `SpillableReorderBuffer` honour the field at write time and wires it through `ConcurrentDeltaConfig` so callers can actually pick a strategy: - `WholeBatch` (default): one length-prefixed record per spill event holds every non-hot-zone candidate concatenated. The 4-byte header is paid once per event instead of once per item, and reload decodes the whole record and refills the in-memory ring. - `PerItem`: keeps the historical layout of one record per item, so a single reload only has to decode one payload. `spill_index` keeps mapping sequence -> record offset for both flavours. A new `batch_members` map records the encode-order sibling sequences for whole-batch records so partial evictions survive without corrupting decode order; per-item records skip the map entirely. Three new unit tests cover the contract: `granularity_whole_batch_writes_single_chunk` asserts on-disk size equals `header_bytes + payload_bytes` with a single header per event; `granularity_per_item_writes_n_chunks` asserts the per-item layout pays one header per item; `granularity_per_item_round_trip_byte_identical` plus a matching whole-batch test pin payload integrity across both formats. Closes #2339.
oferchen
force-pushed
the
feature/stn-5-granularity-wiring
branch
from
May 18, 2026 01:13
596ab5d to
c6a0807
Compare
oferchen
added a commit
that referenced
this pull request
May 18, 2026
…#2339) (#4428) The `SpillGranularity` knob on `SpillPolicy` was a forward-compat stub. This change makes `SpillableReorderBuffer` honour the field at write time and wires it through `ConcurrentDeltaConfig` so callers can actually pick a strategy: - `WholeBatch` (default): one length-prefixed record per spill event holds every non-hot-zone candidate concatenated. The 4-byte header is paid once per event instead of once per item, and reload decodes the whole record and refills the in-memory ring. - `PerItem`: keeps the historical layout of one record per item, so a single reload only has to decode one payload. `spill_index` keeps mapping sequence -> record offset for both flavours. A new `batch_members` map records the encode-order sibling sequences for whole-batch records so partial evictions survive without corrupting decode order; per-item records skip the map entirely. Three new unit tests cover the contract: `granularity_whole_batch_writes_single_chunk` asserts on-disk size equals `header_bytes + payload_bytes` with a single header per event; `granularity_per_item_writes_n_chunks` asserts the per-item layout pays one header per item; `granularity_per_item_round_trip_byte_identical` plus a matching whole-batch test pin payload integrity across both formats. Closes #2339.
oferchen
added a commit
that referenced
this pull request
May 18, 2026
…#2339) (#4428) The `SpillGranularity` knob on `SpillPolicy` was a forward-compat stub. This change makes `SpillableReorderBuffer` honour the field at write time and wires it through `ConcurrentDeltaConfig` so callers can actually pick a strategy: - `WholeBatch` (default): one length-prefixed record per spill event holds every non-hot-zone candidate concatenated. The 4-byte header is paid once per event instead of once per item, and reload decodes the whole record and refills the in-memory ring. - `PerItem`: keeps the historical layout of one record per item, so a single reload only has to decode one payload. `spill_index` keeps mapping sequence -> record offset for both flavours. A new `batch_members` map records the encode-order sibling sequences for whole-batch records so partial evictions survive without corrupting decode order; per-item records skip the map entirely. Three new unit tests cover the contract: `granularity_whole_batch_writes_single_chunk` asserts on-disk size equals `header_bytes + payload_bytes` with a single header per event; `granularity_per_item_writes_n_chunks` asserts the per-item layout pays one header per item; `granularity_per_item_round_trip_byte_identical` plus a matching whole-batch test pin payload integrity across both formats. Closes #2339.
2 of 4 tasks
oferchen
added a commit
that referenced
this pull request
Jun 16, 2026
…ignore (#5842) * fix(filters): parse :C modifier on per-directory merge rules for CVS-ignore When a per-directory merge rule uses the `:C` (or `.C`) short form with an empty pattern, the parser rejected it as "unrecognized filter rule" instead of defaulting the filename to `.cvsignore`, and the `C` (CVS-ignore) modifier was never propagated from `RuleModifiers` onto the resulting `FilterRule`. The wire-format path and the CLI `--filter :C` path already handle this correctly; only merge files read from disk via `parse_rules` (e.g. `mid/.filt`) were affected. This breaks the upstream `merge` and `exclude-lsh` testsuite scenarios (task #4428, UTS-V4.B). Add a `cvs_mode` flag to `FilterRule` with a `with_cvs_mode` builder and `is_cvs_mode` accessor; propagate it through `RuleModifiers::apply`; and in `try_parse_short_form`, when a `:`/`.` rule has empty pattern and the `C` modifier set, default to the filename `.cvsignore`. upstream references (rsync-3.4.4): - exclude.c:1248-1255: `:C` sets FILTRULE_NO_PREFIXES | FILTRULE_WORD_SPLIT | FILTRULE_NO_INHERIT | FILTRULE_CVS_IGNORE. - exclude.c:1324: empty pattern only errors when FILTRULE_CVS_IGNORE is unset. - exclude.c:1404-1408: empty-pattern merge defaults to `.cvsignore`. - testsuite/merge.test, testsuite/exclude-lsh.test:86-88: failing fixtures. * fix(filters): backfill cvs_mode in FilterRule struct literals The :C modifier work added a cvs_mode field to FilterRule but missed the test-side struct literal initializations in crates/filters/src/ compiled/{clear,mod,rule}.rs. The build now fails with E0063 because those literals omit the new field. Add cvs_mode: false to every FilterRule struct literal in those test modules so the field set matches the public struct definition.
oferchen
added a commit
that referenced
this pull request
Aug 24, 2026
…#2339) (#4428) The `SpillGranularity` knob on `SpillPolicy` was a forward-compat stub. This change makes `SpillableReorderBuffer` honour the field at write time and wires it through `ConcurrentDeltaConfig` so callers can actually pick a strategy: - `WholeBatch` (default): one length-prefixed record per spill event holds every non-hot-zone candidate concatenated. The 4-byte header is paid once per event instead of once per item, and reload decodes the whole record and refills the in-memory ring. - `PerItem`: keeps the historical layout of one record per item, so a single reload only has to decode one payload. `spill_index` keeps mapping sequence -> record offset for both flavours. A new `batch_members` map records the encode-order sibling sequences for whole-batch records so partial evictions survive without corrupting decode order; per-item records skip the map entirely. Three new unit tests cover the contract: `granularity_whole_batch_writes_single_chunk` asserts on-disk size equals `header_bytes + payload_bytes` with a single header per event; `granularity_per_item_writes_n_chunks` asserts the per-item layout pays one header per item; `granularity_per_item_round_trip_byte_identical` plus a matching whole-batch test pin payload integrity across both formats. Closes #2339.
oferchen
added a commit
that referenced
this pull request
Aug 24, 2026
…ignore (#5842) * fix(filters): parse :C modifier on per-directory merge rules for CVS-ignore When a per-directory merge rule uses the `:C` (or `.C`) short form with an empty pattern, the parser rejected it as "unrecognized filter rule" instead of defaulting the filename to `.cvsignore`, and the `C` (CVS-ignore) modifier was never propagated from `RuleModifiers` onto the resulting `FilterRule`. The wire-format path and the CLI `--filter :C` path already handle this correctly; only merge files read from disk via `parse_rules` (e.g. `mid/.filt`) were affected. This breaks the upstream `merge` and `exclude-lsh` testsuite scenarios (task #4428, UTS-V4.B). Add a `cvs_mode` flag to `FilterRule` with a `with_cvs_mode` builder and `is_cvs_mode` accessor; propagate it through `RuleModifiers::apply`; and in `try_parse_short_form`, when a `:`/`.` rule has empty pattern and the `C` modifier set, default to the filename `.cvsignore`. upstream references (rsync-3.4.4): - exclude.c:1248-1255: `:C` sets FILTRULE_NO_PREFIXES | FILTRULE_WORD_SPLIT | FILTRULE_NO_INHERIT | FILTRULE_CVS_IGNORE. - exclude.c:1324: empty pattern only errors when FILTRULE_CVS_IGNORE is unset. - exclude.c:1404-1408: empty-pattern merge defaults to `.cvsignore`. - testsuite/merge.test, testsuite/exclude-lsh.test:86-88: failing fixtures. * fix(filters): backfill cvs_mode in FilterRule struct literals The :C modifier work added a cvs_mode field to FilterRule but missed the test-side struct literal initializations in crates/filters/src/ compiled/{clear,mod,rule}.rs. The build now fails with E0063 because those literals omit the new field. Add cvs_mode: false to every FilterRule struct literal in those test modules so the field set matches the public struct definition.
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.
Summary
SpillGranularity::WholeBatch(default) now packs every candidate selected by a single spill event into one length-prefixed record so the 4-byte header is amortised across many items.SpillGranularity::PerItempreserves the historical one-record-per-item layout for callers that want a single reload to decode only one payload.ConcurrentDeltaConfig::spill_policy.granularityis wired throughDeltaConsumer::spawn_with_configso the policy knob is no longer a forward-compat stub.On-disk format
Each record is
[u32 len LE][payload bytes]. Thelenfield isu32little-endian to match the existing per-item layout; nothing else on disk changes forPerItem. ForWholeBatchthe payload simply concatenates everySpillCodec::encodeoutput for the candidates selected in the same spill event, and the reload path decodes them sequentially using the self-delimiting codec contract.Test plan
cargo fmt --allcleangranularity_whole_batch_writes_single_chunk- default path writes one length-prefix per spill eventgranularity_per_item_writes_n_chunks- alternative path writes one length-prefix per itemgranularity_per_item_round_trip_byte_identicaland matching whole-batch round-trip pin payload integrity across both formatsCloses #2339.