Repository navigation
feat(lsm): require recorded index catch-up, as an explicit activation - #3911
Conversation
There was a problem hiding this comment.
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.
d164e70 to
1e4f99f
Compare
dc586ff to
a47f57b
Compare
491f6a3 to
8da5b52
Compare
There was a problem hiding this comment.
❌ 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.
| /// | ||
| /// 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<()> { |
There was a problem hiding this comment.
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.
|
@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 |
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.
5b0aad3 to
123d459
Compare
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 rowsfor that query.
catchup_requiredreads the manifest feature bit directly, and requires bothwords: 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, separatefrom
set_lsm_write_spec: a table carrying the bit retains every generationuntil 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. Lanceenforces the preconditions either way: the MemWAL index must exist, and the
table must not already carry
compacted_sstablesfrom before this protocol,since those numbers cannot be validated.
Still correct after the Lance rework
lance-format/lance#8481 replaced the transmitted
IndexCatchupAdvancewith aposition 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_watermarksunit tests carry the new argument. Coverageagainst a real dataset follows once #3922 lands and this can build.