Skip to content

refactor(engine): rename refresh() to checkout_latest() to match lance - #110

Merged
prrao87 merged 2 commits into
feat/persist-csrfrom
refactor/checkout-latest
Nov 2, 2026
Merged

prrao87 merged 2 commits into
feat/persist-csrfrom
refactor/checkout-latest

Conversation

@prrao87

@prrao87 prrao87 commented Nov 2, 2026 •

Copy link
Copy Markdown
Member

Why

Lance moves a dataset to its newest version with checkout_latest() and has no refresh(). CypherEngine.refresh() does the same job for every Lance dataset the engine reads, so its name made lance-csr look different from Lance where it isn't. With the new name the engine pairs with Lance the same way Lance's own calls pair up:

Job Lance lance-csr
Move to the newest version of the data LanceDataset.checkout_latest() CypherEngine.checkout_latest()
Rebuild indexes to cover new data optimize_indices() optimize_csr()

This is stacked on #109 (base feat/persist-csr), since both change the same CSR guide pages. Retarget it to main once #109 merges.

What changed

  • checkout_latest() replaces refresh() on CypherEngine, in Python and Rust, with the same behaviour.
  • refresh() stays as a deprecated alias for a release. In Python it warns with DeprecationWarning and then calls checkout_latest(); in Rust it's marked #[deprecated].
  • The guides, READMEs, docstrings, examples, tests and benchmark scripts use the new name. The Lance datasets page has a short "Formerly refresh()" note, and its anchor is now #checkout-latest. The lance_snapshot_refresh.py example is renamed lance_snapshots.py.
  • The internals pages and Rust doc comments say checkout_latest() too; "Indexes and refresh" is now "Indexes and updates". The only mention of refresh() left in the docs is the note about the old name. Benchmark output keys like refresh_ms stay, so old results remain comparable.

User impact. Existing code keeps working. Calls to refresh() now warn with DeprecationWarning in Python and a deprecation warning in Rust, so code that turns warnings into errors (pytest's error::DeprecationWarning, for example) needs refresh() changed to checkout_latest().

Validation

  • cargo fmt --all --check, cargo clippy --workspace --all-targets -- -D warnings and cargo test --workspace pass.
  • make test (1673 passed) and make lint pass. A new test checks that refresh() warns and still moves the engine to the latest version; with DeprecationWarning treated as an error in the test config, any leftover refresh() call in the suite would fail.
  • The strict Zensical build, docs/check_snippets.py and typos pass, and the renamed example runs.
  • No benchmark runs: the change renames a method and doesn't touch planning, execution or the CSR.
  • CI is pending.

🤖 Generated with Claude Code

Lance moves a dataset to its newest version with checkout_latest() and
has no refresh(). CypherEngine.refresh() does the same for every dataset
the engine reads, so it is now checkout_latest(), in Rust and Python,
which also pairs it with optimize_csr() the way Lance pairs
checkout_latest() with optimize_indices().

refresh() stays as a deprecated alias: Python warns with
DeprecationWarning, and Rust marks it #[deprecated]. Docs, examples,
tests and benchmarks use the new name, and the lance_snapshot_refresh.py
example is now lance_snapshots.py.
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

Deploying lance-csr with  Cloudflare Pages  Cloudflare Pages

Latest commit: 4500e39
Status: ✅  Deploy successful!
Preview URL: https://e69eaaef.lance-csr.pages.dev
Branch Preview URL: https://refactor-checkout-latest.lance-csr.pages.dev

View logs

@prrao87
prrao87 marked this pull request as ready for review November 2, 2026 17:34
@prrao87
prrao87 merged commit 36200df into feat/persist-csr Nov 2, 2026
8 checks passed
@prrao87
prrao87 deleted the refactor/checkout-latest branch November 2, 2026 17:49
prrao87 added a commit that referenced this pull request Nov 2, 2026
#109)

* feat(csr): store the csr inside each lance dataset with persist_csr

Engines rebuild every CSR from a full scan of the relationship tables at
start-up. With persist_csr=True, each full build of a Lance relationship
dataset is written to <dataset>/_lance_csr/<version>.arrow, a zstd
compressed Arrow IPC file, and later engines load it instead of building.
Changes since the stored version apply as a delta under the usual 25%
threshold, read from the file's recorded fragments, so this survives
compaction and cleanup_old_versions(). Unusable files are rebuilt, and
failed writes fall back to an ordinary build.

delete_stored_csr() removes the stored files. csr_stats() reports
update "loaded" for a CSR read from a file. CsrIndex now keeps its arrays
as Arrow buffers, and Rust gains EngineOptions and
CypherEngine::with_options.

On GDC SF1 read lazily, engine start goes from 1.55 s to 0.58 s, the
files take 150 MiB, and query times are unchanged.

* perf(csr): pack edge rows in blocks and store the csr packed

Each CSR slot held its edge row as a raw 64-bit Lance row address.
Edge rows are now packed in blocks of 128 values, each stored as its
offset from the block's minimum in as few bits as the block needs, with
every position still directly readable. On GDC SF1 that cuts the CSR's
arrays from 613 to 419 MiB, and the whole in-memory CSR from 926 to
732 MiB. Plain hops never unpack edge rows.

Neighbours stay a plain array: packing them too slowed lookup-heavy
queries (custom Q30 by about 22%) for a smaller saving.

Stored CSR files now hold the arrays as they sit in memory (format 2,
still zstd compressed), so a load only decompresses and checks them:
134 MiB at SF1, and engine start drops from 0.58 to 0.46 s.

The CSR guide now contrasts refresh() and optimize_csr() in a table,
and its memory figures are measured rather than estimated.

* docs(csr): correct the peak memory units in the storing cost table

* docs: trim the readme and link the benchmark repositories

* docs(csr): name the optimize_csr() section after what it does

* docs(csr): lead with the two ways to keep the csr current

* docs(csr): explain why the csr falls behind and what each call does

* refactor(engine): rename refresh() to checkout_latest() to match lance (#110)

* refactor(engine): rename refresh() to checkout_latest() to match lance

Lance moves a dataset to its newest version with checkout_latest() and
has no refresh(). CypherEngine.refresh() does the same for every dataset
the engine reads, so it is now checkout_latest(), in Rust and Python,
which also pairs it with optimize_csr() the way Lance pairs
checkout_latest() with optimize_indices().

refresh() stays as a deprecated alias: Python warns with
DeprecationWarning, and Rust marks it #[deprecated]. Docs, examples,
tests and benchmarks use the new name, and the lance_snapshot_refresh.py
example is now lance_snapshots.py.

* docs: say checkout_latest() follows lance and optimize_csr() rebuilds the csr

* docs(csr): rewrite keeping the csr current for newcomers

Explain what checkout_latest() and optimize_csr() do and why before how, drop the remaining refresh wording, and add the what-and-why-first rule to the docs style guide.
prrao87 added a commit that referenced this pull request Nov 7, 2026
* refactor!: remove the deprecated refresh()

checkout_latest() replaced refresh() two releases ago, and refresh() has
warned with DeprecationWarning since. Remove it from the Rust engine, the
Python bindings, the type stub and the Python CypherEngine, along with its
deprecation test and docs note, and have the wheel check call
checkout_latest().

* docs: describe checkout_latest() instead of refresh

Drop the remaining refresh wording now that refresh() is gone: the
internals pages and their nav entry ("Indexes and updates"), Rust doc
comments, test names and the micro-benchmarks, whose output keys become
checkout_ms, checkout_unchanged_ms and checkout_after_append_ms. Most of
the docs change was written after #110 merged and never reached main.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant