Skip to content

feat(frag-reuse): add LANCE_FRAG_REUSE_REMAP_MODE=assert(<mode>) - #79

Merged
amunra merged 1 commit into
release-10.0.0from
adam/fri-assert-mode-r10
Sep 10, 2026
Merged

amunra merged 1 commit into
release-10.0.0from
adam/fri-assert-mode-r10

Conversation

@amunra

@amunra amunra commented Sep 10, 2026

Copy link
Copy Markdown

Related

What

LANCE_FRAG_REUSE_REMAP_MODE=assert(compact) selects the compact reuse-remap form as the process default and turns every other form into a panic, so a deployment committed to one form finds the code path that picks the other as a backtrace rather than as the memory blowup the compact form exists to avoid.

Three sites cover the ways a form is chosen: Dataset::checkout_manifest, open_frag_reuse_index_with_mode, and commit_compaction. The compaction one is gated on needs_remapping, since a stable-row-id or deferred compaction never consults the mode.

Arming it warns once. The plain direct/compact spellings are unchanged, and an unparsable assert(...) falls back to warn-and-use-direct rather than failing an open.

Cherry-pick of 49d9a4093 from release-8.0.0, author preserved. The production change applies unchanged — this branch already has parse_frag_reuse_remap_mode and default_frag_reuse_remap_mode from #59. The one conflict was the #[case] list of test_parse_frag_reuse_remap_mode, resolved to the source's cases and its expected_asserted column, keeping this branch's unparsable spelling.

Testing

test_parse_frag_reuse_remap_mode covers 13 cases: the 7 existing plus assert(compact), assert(direct), upper case, padded, assert(nonsense) and unterminated assert(compact.

The assert was shown to fire end to end, not merely parse: optimize::tests passes with the env var unset (118/118) and produces 13 failures under LANCE_FRAG_REUSE_REMAP_MODE=assert(compact), all at the new assert_frag_reuse_remap_mode. Several of those are tests that deliberately request direct, so they are correct panics — running a whole suite under the assert is not the intended use.

Note optimize::tests is flaky on release-10.0.0 independently of this change: back-to-back runs of the same tree gave 115 passed; 3 failed then 118 passed; 0 failed.

Compatibility

None. With LANCE_FRAG_REUSE_REMAP_MODE unset or set to direct/compact, behaviour is unchanged; only the new assert(...) spelling adds the panic.

@github-actions github-actions Bot added the enhancement New feature or request label Sep 10, 2026
@amunra amunra added lance fork 10.0.0 Landed on the release-10.0.0 fork line upstreamable change Belongs upstream, but is not there yet labels Sep 10, 2026
@amunra
amunra requested a review from zehiko September 10, 2026 10:07
A deployment that has committed to the compact reuse-remap form still has no
way to tell whether some code path quietly falls back to the direct one -- it
finds out as the memory blowup the compact form exists to avoid, long after the
call that chose it.

`LANCE_FRAG_REUSE_REMAP_MODE=assert(compact)` selects the compact form as the
process default and turns every other form into a panic, so the offending call
site shows up as a backtrace instead. The assert is a plain `assert!`, not
`debug_assert!`, because the deployments that need it run release builds.

Three sites cover the ways a form is chosen: `Dataset::checkout_manifest` (every
dataset open, whichever path built the mode), `open_frag_reuse_index_with_mode`
(callers that pass a mode not coming from a `Dataset`), and `commit_compaction`
(`CompactionOptions::index_remap_mode`). The compaction one is gated on
`needs_remapping`, since a stable-row-id or deferred compaction never consults
the mode and asserting there would report configuration that costs nothing.

Arming it warns once, on the read that fixes the setting for the process, so an
operator can tell a later panic apart from an unrelated crash. The plain
`direct`/`compact` spellings are unchanged, and an unparsable `assert(...)`
falls back to the existing warn-and-use-direct behaviour rather than failing an
open.

The production change applies unchanged: release-10.0.0 already carries
`parse_frag_reuse_remap_mode` and `default_frag_reuse_remap_mode` from #59. The
one conflict was the `#[case]` list of `test_parse_frag_reuse_remap_mode`,
resolved to the source's cases and its `expected_asserted` column while keeping
this branch's `unparsable` spelling, which is what the typos hook and the rest
of the tree use.

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
(cherry picked from commit 49d9a40)
@amunra
amunra force-pushed the adam/fri-assert-mode-r10 branch from 4632e60 to f5e769b Compare September 10, 2026 11:10
@amunra
amunra merged commit 0e63a5a into release-10.0.0 Sep 10, 2026
40 checks passed
@amunra amunra added permanent fork change No upstream path; Rerun-specific by construction and removed upstreamable change Belongs upstream, but is not there yet labels Oct 6, 2026
@amunra

amunra commented Oct 6, 2026

Copy link
Copy Markdown
Author

Relabelled permanent fork change: upstream now always uses compact FRIs, so the assert mode will no longer be needed in future releases.

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

Labels

enhancement New feature or request lance fork 10.0.0 Landed on the release-10.0.0 fork line permanent fork change No upstream path; Rerun-specific by construction

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants