Skip to content

fix: recover from stale cached manifest size on read#7542

Merged
wkalt merged 1 commit into
lance-format:mainfrom
wkalt:fix/manifest-read-retry
Jul 1, 2026
Merged

fix: recover from stale cached manifest size on read#7542
wkalt merged 1 commit into
lance-format:mainfrom
wkalt:fix/manifest-read-retry

Conversation

@wkalt

@wkalt wkalt commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

ManifestLocation caches a file size to skip a metadata call, but it can lag the real object under concurrent commits. read_manifest already retries without the cached size; the open path did not, so a stale size surfaced as a spurious "file size is too small" error.

Apply the same fallback in load_manifest and read_manifest_indexes, and guard read_message's length-prefix slice against a truncated read.

@github-actions github-actions Bot added A-encoding Encoding, IO, file reader/writer bug Something isn't working labels Jun 30, 2026
Comment thread rust/lance-table/src/io/manifest.rs Outdated
Comment on lines +118 to +119
// A cached size can be stale; if the index read fails with it, retry
// with the true size.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

note: the only way this can happen AFAIK is the table has been deleted and re-created between the LIST call to get the latest location and then reading the manifest.

Comment thread rust/lance-table/src/io/manifest.rs Outdated
let section =
match read_index_section(object_store, &location.path, location.size, *pos).await {
Ok(section) => section,
Err(_) if location.size.is_some() => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

suggestion: it would be nice to match on the "file size is too small" error.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

updated

@codecov

codecov Bot commented Jun 30, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 89.28571% with 3 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
rust/lance-table/src/io/manifest.rs 81.81% 0 Missing and 2 partials ⚠️
rust/lance-io/src/utils.rs 75.00% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

Resolving the latest version records the manifest size from the listing
so the read can skip a metadata call. If the table is dropped and
recreated between that listing and the read, the path points at a
different object and the cached size no longer matches. read_manifest
already retries without the cached size when it looks wrong; the open
path did not, so a stale size surfaced as a spurious "file size is too
small" error.

Apply the same fallback in load_manifest and read_manifest_indexes, and
guard read_message against slicing a truncated buffer so the retry has a
clean error to match on.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@wkalt
wkalt force-pushed the fix/manifest-read-retry branch from 6dfed32 to 7382c96 Compare July 1, 2026 00:02
@wkalt
wkalt merged commit 876ad93 into lance-format:main Jul 1, 2026
30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-encoding Encoding, IO, file reader/writer bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants