fix(core): bound Context point-read memory and defer payload loading - #243
Merged
Merged
Conversation
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.
Summary
Context.get(...)and partial updates currently list the entire context before locating a record; updates also materialize every record's payload. Replace these reads with filtered LSM scans that process identity and lifecycle fields in chunks of at most 256 candidates, retain one selected identity, and load only that record's requested payload after visibility and uniqueness checks finish.idandsupersedes_id, sharing one WAL snapshot across all scans. Preserve lifecycle visibility, lazy payload defaults, deterministic external-id lookup, ambiguous-update errors, and legacy schemas.The 256-row bound applies to candidate bookkeeping and supersession predicates, not total process memory: Arrow batches, Lance internals, and the selected record's payload still consume memory. Large histories require a supersession scan per candidate chunk; scans without suitable indexes are not constant-time.
Testing
cargo fmt --all -- --check— passed.cargo clippy --workspace --all-targets -- -D warnings— passed.cargo test -p lance-context-core --lib store::tests:: -- --skip validate_uniqueness_against_large_store— 142 passed, 3 benchmark tests ignored.cargo test --workspace --all-targets— passed, including the large-store uniqueness test.