Skip to content

fix(compaction): default index_remap_mode from LANCE_FRAG_REUSE_REMAP_MODE - #80

Merged
amunra merged 1 commit into
release-10.0.0from
adam/compaction-remap-default-r10
Sep 10, 2026
Merged

amunra merged 1 commit into
release-10.0.0from
adam/compaction-remap-default-r10

Conversation

@amunra

@amunra amunra commented Sep 10, 2026

Copy link
Copy Markdown

Related

What

CompactionOptions::index_remap_mode hardcoded Direct and was wired to nothing, so a deployment that moved its readers onto the compact reuse-remap form to bound memory still had every compact_files call that did not name a form build the per-row HashMap<u64, Option<u64>> — the writer-side instance of exactly the growth the compact form exists to avoid. Nobody chose it; the default was never revisited when the compact form landed.

Both sides expand the same reuse payload, so they take the same setting: the field now defaults to default_frag_reuse_remap_mode(), and its serde(default) does too, so a serialized options struct that omits the field agrees with a freshly defaulted one.

With LANCE_FRAG_REUSE_REMAP_MODE unset the default is still Direct, so this is not a behaviour change on its own.

Cherry-pick of a17ee6527 from release-8.0.0, author preserved. default_frag_reuse_remap_mode() is already on this branch from #59, so the port is the wiring only.

Testing

cargo check -p lance --tests clean; from_dataset_config tests pass with the env var unset and set to compact.

test_from_dataset_config_empty pinned the default to Direct literally; it now pins it to the env-derived default, which is what the field actually promises. That assertion is necessarily self-referential: default_frag_reuse_remap_mode() caches in a OnceLock, so a test cannot vary the env var within one test binary. The wiring itself is a two-line change and visible in the diff.

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.

Merge order

Nothing here depends on #79. The production change applied to release-10.0.0 with no conflict; the only conflict in the cherry-pick was the ReadParams::frag_reuse_remap_mode doc comment, whose source version carries #79's assert(<mode>) paragraph as context. That paragraph is left to #79.

Both PRs touch that doc block and default_frag_reuse_remap_mode, so whichever merges second wants a rebase. Either order works.

Compatibility

None with LANCE_FRAG_REUSE_REMAP_MODE unset. Where it is set, compaction now follows it instead of always building the direct form — which is the point.

…_MODE

`CompactionOptions::index_remap_mode` hardcoded `Direct` and was wired to
nothing, so a deployment that moved its readers onto the compact reuse-remap
form to bound memory still had every `compact_files` call that did not name a
form build the per-row `HashMap<u64, Option<u64>>` -- the writer-side instance
of exactly the growth the compact form exists to avoid. Nobody chose it; the
default was simply never revisited when the compact form landed.

Both sides expand the same reuse payload, so they take the same setting: the
field now defaults to `default_frag_reuse_remap_mode()`, and its `serde(default)`
does too, so a serialized options struct that omits the field agrees with a
freshly defaulted one. With `LANCE_FRAG_REUSE_REMAP_MODE` unset the default is
still `Direct`, so this is not a behaviour change on its own.

`test_from_dataset_config_empty` pinned the default to `Direct` literally; it now
pins it to the env-derived default, which is what the field actually promises.

Found by `LANCE_FRAG_REUSE_REMAP_MODE=assert(compact)`, which took the `lance`
lib suite from 39 failures to 8 in `optimize::tests` alone.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
(cherry picked from commit a17ee65)
@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
@github-actions github-actions Bot added the bug Something isn't working label Sep 10, 2026
@amunra
amunra merged commit 68467dc into release-10.0.0 Sep 10, 2026
56 of 58 checks passed
@amunra
amunra deleted the adam/compaction-remap-default-r10 branch September 10, 2026 11:04
@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 Sep 16, 2026
@amunra

amunra commented Sep 16, 2026

Copy link
Copy Markdown
Author

Not applicable upstream.

This change defaults CompactionOptions::index_remap_mode from LANCE_FRAG_REUSE_REMAP_MODE. That environment variable exists only on this fork, introduced by #59 for the reader-side Direct/Compact switch. Upstream has no such variable: lance-format/lance main opens the fragment-reuse index compact-only, so there is no reader-side mode to keep the compaction side in step with, and the compaction knob itself has been consulted by commit_compaction and settable through the lance.compaction.index_remap_mode dataset config key since v10.0.0. There is nothing to propose.

Exit condition: this patch is glue for #59's environment variable and leaves the fork together with #59.

Label: permanent fork change.

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

Labels

bug Something isn't working 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