Skip to content

feat(lsm): require recorded index catch-up, as an explicit activation - #3911

Merged
xuanyu-z merged 5 commits into
mainfrom
feat/memwal-catchup-activation
Aug 14, 2026
Merged

xuanyu-z merged 5 commits into
mainfrom
feat/memwal-catchup-activation

Conversation

@xuanyu-z

@xuanyu-z xuanyu-z commented Aug 10, 2026 •

Copy link
Copy Markdown
Contributor

Stacked on #3780. Blocked only on #3922 (lance → v11.0.0-beta.6), so CI
stays red until that lands.

Missing coverage must mean "not known to be covered"

#3780 caps the SSTable exclusion watermark at an index's recorded catch-up when
there is one, and silently ignores the case where there is none. On a table that
requires catch-up, an absent entry means the index is not known to hold the
compacted rows — and the LSM base arm reads base through the index
(fast_search, no brute-force tail), so dropping that SSTable loses those rows
for that query.

Some(caught_up) => watermark = watermark.min(caught_up),
None if catchup_required => watermark = 0,   // retain everything
None => {}

catchup_required reads the manifest feature bit directly, and requires both
words: a half-set manifest is treated as legacy, which is the conservative side.
Without the bit the field is not maintained at all, so absence carries no
information and behaviour is unchanged.

Activation, as a table-level entry point

Table::require_mem_wal_index_catchup() performs the one-way switch, separate
from set_lsm_write_spec: a table carrying the bit retains every generation
until something records catch-up, so it has to follow the deployment of whatever
repairs coverage, not the creation of the table.

This is a convenience, not the only path — a writer holding the dataset calls
the equivalent on DatasetMemWalExt, which is what the WAL pod does. Lance
enforces the preconditions either way: the MemWAL index must exist, and the
table must not already carry compacted_sstables from before this protocol,
since those numbers cannot be validated.

Still correct after the Lance rework

lance-format/lance#8481 replaced the transmitted IndexCatchupAdvance with a
position derived at commit time from the version a transaction read. That
changed how a writer earns coverage; it did not change what a reader may
conclude from its absence. The rule here, and the field it reads, are unchanged.

Tests

Existing exclusion_watermarks unit tests carry the new argument. Coverage
against a real dataset follows once #3922 lands and this can build.

@github-actions github-actions Bot added enhancement New feature or request Rust Rust related issues labels Aug 10, 2026
@xuanyu-z
xuanyu-z changed the base branch from main to feat/memwal-multi-index-lsm-coverage-pr August 12, 2026 06:09
@xuanyu-z
xuanyu-z marked this pull request as ready for review August 12, 2026 06:15

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude Code Review

This repository is configured for manual code reviews. Comment @claude review for a one-time review, or @claude review always to subscribe this PR to a review on every future push.

Tip: disable this comment in your organization's Code Review settings.

lancedb-gatekeeper[bot]

This comment was marked as outdated.

@lancedb-gatekeeper lancedb-gatekeeper Bot added the K-changes Latest Gatekeeper recommendation requests changes. label Aug 12, 2026
@xuanyu-z
xuanyu-z force-pushed the feat/memwal-catchup-activation branch from d164e70 to 1e4f99f Compare August 12, 2026 16:19
@github-actions github-actions Bot added the Python Python SDK label Aug 12, 2026
@lancedb-gatekeeper lancedb-gatekeeper Bot removed the K-changes Latest Gatekeeper recommendation requests changes. label Aug 12, 2026
lancedb-gatekeeper[bot]

This comment was marked as outdated.

@lancedb-gatekeeper lancedb-gatekeeper Bot added K-changes Latest Gatekeeper recommendation requests changes. and removed K-changes Latest Gatekeeper recommendation requests changes. labels Aug 12, 2026
lancedb-gatekeeper[bot]

This comment was marked as outdated.

@lancedb-gatekeeper lancedb-gatekeeper Bot added the K-changes Latest Gatekeeper recommendation requests changes. label Aug 12, 2026
@xuanyu-z
xuanyu-z force-pushed the feat/memwal-multi-index-lsm-coverage-pr branch from dc586ff to a47f57b Compare August 12, 2026 19:13
@xuanyu-z
xuanyu-z force-pushed the feat/memwal-catchup-activation branch from 491f6a3 to 8da5b52 Compare August 12, 2026 19:13
@lancedb-gatekeeper lancedb-gatekeeper Bot removed the K-changes Latest Gatekeeper recommendation requests changes. label Aug 12, 2026
lancedb-gatekeeper[bot]

This comment was marked as outdated.

@lancedb-gatekeeper lancedb-gatekeeper Bot added K-changes Latest Gatekeeper recommendation requests changes. and removed K-changes Latest Gatekeeper recommendation requests changes. labels Aug 12, 2026
lancedb-gatekeeper[bot]

This comment was marked as outdated.

@lancedb-gatekeeper lancedb-gatekeeper Bot added K-changes Latest Gatekeeper recommendation requests changes. and removed K-changes Latest Gatekeeper recommendation requests changes. labels Aug 12, 2026

@lancedb-gatekeeper lancedb-gatekeeper Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❌ Gate recommendation: request changes.

One acceptance gap remains: the newly exposed one-way catch-up protocol is not verified at its activation boundary. Add focused table-level coverage of the supported and rejected state transitions so the public contract is evidence-backed.

Comment thread rust/lancedb/src/table.rs
///
/// Errors if no spec is set, or if the table already records SSTable
/// compaction progress from before this protocol.
pub async fn require_mem_wal_index_catchup(&self) -> Result<()> {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This public one-way activation boundary still has no coverage. The current tests exercise only the watermark calculation; none calls Table::require_mem_wal_index_catchup to prove that it successfully sets the protocol flag or rejects the two documented invalid states (no LSM write spec and pre-existing compaction progress). That leaves the new feature activation/error contract unverified, contrary to the repository requirement that features ship with tests. Please add focused tests that invoke this API and assert the successful flag transition plus both errors. This is the current projection of the earlier coverage finding.

@lancedb-gatekeeper lancedb-gatekeeper Bot added the K-changes Latest Gatekeeper recommendation requests changes. label Aug 13, 2026
Base automatically changed from feat/memwal-multi-index-lsm-coverage-pr to main August 13, 2026 17:23
@lancedb-gatekeeper lancedb-gatekeeper Bot added K-changes Latest Gatekeeper recommendation requests changes. and removed K-changes Latest Gatekeeper recommendation requests changes. labels Aug 13, 2026
@hamersaw

Copy link
Copy Markdown
Member

@xuanyu-z overall looks great! My only question is on making this the default in the future. When we decide to make that switch do we just set this flag on set_lsm_write_spec and deprecate the function? I guess, what is stopping us from doing that right now? I think before we merge we should have this story figured out.

@lancedb-gatekeeper lancedb-gatekeeper Bot added K-changes Latest Gatekeeper recommendation requests changes. and removed K-changes Latest Gatekeeper recommendation requests changes. labels Aug 13, 2026
Absence of a catch-up entry now means the index is not known to hold the
compacted rows, so the SSTable stays readable rather than being dropped. The
base arm is index-only, so dropping it loses the rows for that query. Without
the feature bit the field is not maintained at all and absence still carries
no information.

Activation is its own API, deliberately not part of set_lsm_write_spec. A
table carrying the bit retains every generation until something records
catch-up, so turning it on before remote maintenance owns the repair would
strand readers on SSTables the WAL pod has already trimmed.

Requires lance #8263 for requires_mem_wal_index_catchup /
require_mem_wal_index_catchup, so this does not build until the lance
dependency moves off v10.1.0-beta.1.
The Dataset predicate this called never landed upstream -- only the activation
half did -- so this could not build against any released Lance. Both the
manifest accessor and the flag constant are public, so the check is made here
instead, which removes the dependency on an API that does not exist.
The third argument landed inside to_string() at four call sites, so the test
target has not compiled since it was added -- the library builds, which is why
the dependent workspace never noticed.

With them compiling again, the mode they exist to check had no coverage: every
case passed false. A missing catch-up entry on a table that requires it now
asserts that nothing is excluded, on its own and alongside an index that has
caught up, which is the rule that keeps an indexed query from silently losing
rows.
@xuanyu-z
xuanyu-z force-pushed the feat/memwal-catchup-activation branch from 5b0aad3 to 123d459 Compare August 14, 2026 12:44
@lancedb-gatekeeper lancedb-gatekeeper Bot removed the K-changes Latest Gatekeeper recommendation requests changes. label Aug 14, 2026
@xuanyu-z
xuanyu-z merged commit 4148dfe into main Aug 14, 2026
30 checks passed
@xuanyu-z
xuanyu-z deleted the feat/memwal-catchup-activation branch August 14, 2026 13:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request Python Python SDK Rust Rust related issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants