Repository navigation
Conversation
…_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]>
amunra
force-pushed
the
adam/compaction_default_remap_mode
branch
from
August 24, 2026 11:08
6d8a1ad to
a17ee65
Compare
ilya-zlobintsev
approved these changes
Aug 24, 2026
Member
|
I strongly prefer human-written PR descriptions, this description is way too long a 1.5 line change |
zehiko
approved these changes
Aug 24, 2026
Author
|
We should have merged it and didn't. It's been ported (and merged) into Customers off While technically a bug (an ommission), I'm closing it as the omission would manifest (if it ever does) as a perf issue, not a correctness issue. |
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.
Bug identified by #47, which is now merged; this PR targets
release-8.0.0directly and is a single commit on top of it.The bug
CompactionOptions::index_remap_modehardcodedDirectand was wired to nothing:So a deployment that moved its readers onto the compact reuse-remap form to bound memory still had every
compact_filescall that did not explicitly name a form build the per-rowHashMap<u64, Option<u64>>remap — 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.This is what
LANCE_FRAG_REUSE_REMAP_MODE=assert(compact)from #47 was built to surface, and it is the first thing it found.The fix
Both sides expand the same reuse payload, so they take the same setting:
CompactionOptions::default().index_remap_modenow comes fromdefault_frag_reuse_remap_mode().serde(default)points at the same function, so a serialized options struct that omits the field agrees with a freshly defaulted one instead of silently reverting toDirect.test_from_dataset_config_emptypinned the default toDirectliterally; it now pins it to the env-derived default, which is what the field actually promises.With
LANCE_FRAG_REUSE_REMAP_MODEunset the default is stillDirect, so this is not a behaviour change on its own — it only gives the existing env var reach over the writer.Open question for review
This gives a variable documented so far as reader-side (
ReadParams::frag_reuse_remap_mode) reach over compaction. The alternative is a separateLANCE_COMPACTION_REMAP_MODE. One variable was chosen because both sides expand the same payload and splitting them lets the pair drift back apart — but it is worth an explicit ack.Results
optimize::tests, env unsetoptimize::tests,assert(compact)lancelib, env unsetlancelib,assert(compact)assert(compact)All 12 remaining failures name the direct form on purpose, so nothing forgotten is left in the crate:
test_catch_up_...::case_1_direct,test_frag_reuse_remap_mode_end_to_end::case_1_direct, thecase_2arms of the btree/ivf_pq/inverted remap families, both arms oftest_shared_session_serves_both_forms);test_compact_form_costs_the_cache_far_less, which loops over both forms to compare cache growth;index::frag_reuse::tests, includingtest_default_mode_is_direct— that one asserts the unset-env contract, so it is supposed to fail when the env var is set.cargo fmt --allandcargo clippy -p lance --tests -- -D warningsare clean.🤖 Generated with Claude Code