Repository navigation
Conversation
…ings DirectoryNamespace::list_table_versions ignored page_token when descending was set and never returned a continuation, so a newest-first history could not be paged. A descending page now returns the last (oldest) version it holds as the page token, and the next page lists the versions below it. The listing still stops early on lexically ordered V2 stores, so fetching the latest version reads at most limit + 1 manifests. Part of lance-format#11448.
Xuanwo
left a comment
There was a problem hiding this comment.
Technical blocker: the first bounded page can miss the newest committed version. I tested DirectoryNamespace::list_table_versions on an ordered object store with manifest names modeling an interrupted migration. Versions 1 and 10–18 used V2 names and the remaining versions through 20 used V1. Unbounded descending listing returned 20 through 1. With limit=1, the first page returned 18 and token 18, making both 20 and 19 unreachable.
Please keep the logical-version cursor, establish numeric order before limiting mixed histories, and use the short V2 lookup when that ordering is guaranteed. A regression comparing a complete bounded walk with the unbounded result would cover both the first page and subsequent boundaries.
The descending early stop trusted stream order whenever the first manifest listed had a V2 name. On a partly migrated table, V1 names such as 19.manifest or 2.manifest sort after every V2 name and can hold the newest versions, so a bounded page could skip them and its cursor made them unreachable. Before stopping early, list from just past the largest possible V2 name and stop at the first key that cannot be a V1 manifest. Any V1 manifest found there disables the early stop, so the listing is collected and sorted numerically. A table using only V2 names pays one short extra request.
|
Thanks @Xuanwo, you're right. A V2 first entry only proves no V1 name sorts before the V2 names. In your interrupted migration, Fixed in ff967a1. The cursor is still the logical version. Before the early stop is trusted, Cost: a table using only V2 names makes one extra short Regression test:
This also addresses the Gatekeeper finding. One note: |
Xuanwo
left a comment
There was a problem hiding this comment.
I verified the original interrupted migration on ff967a193: all 20 versions are reachable. The 84 repository tests and five additional probes passed.
One pagination blocker remains when a canonical V1 filename sorts between two V2 filenames. Let a = 1844674407370955161. With V1(a), V2(6), and V2(1), the unbounded descending listing returns [a, 6, 1]. Following every cursor with limit=1 returns [6, 1]. With limit=2 it returns [6, a, 6, 1]. All three filenames sort below the suffix seek, so an empty suffix cannot guarantee V2 ordering.
These versions are legal but far beyond ordinary sequential histories. I installed a predecessor with the manifest writer, published a through the namespace API, and deleted the predecessor. Namespace CAS then treated 6 as latest. The direct-open resolver's first-V2 behavior predates this change.
Please cover this interleaved layout by comparing the complete bounded walk with the unbounded numeric order. Can the early stop be limited to layouts guaranteed to be V2-only, with numeric sorting when a mixed layout is still possible?
The V1 probe added in the previous commit used list_with_offset, which backends without start-after pushdown (Hugging Face through OpenDAL) emulate by listing the whole directory. Every latest-version lookup on such a store read the full history again. Drop the probe. Like resolve_version_from_listing, take a V2 first entry to mean the table uses V2 names. Any V1 manifest the early stop meets while scanning, including one sorting between V2 names, still drops the early stop and the listing is sorted numerically.
|
Thanks @Xuanwo, and thanks for the interleaved case. Your two findings pull in opposite directions, so I want to lay out the trade-off and ask which direction you'd like.
Proving V2-only and keeping the latest-version lookup bounded can't both hold. The options I see:
I've pushed B in 72adfe1, since it keeps namespace listing consistent with how a dataset resolves its own latest version:
What B gives up: your earlier interrupted migration, with V2 for 1 and 10–18 and V1 for 19 and 20. If you'd rather have A or C, both are small changes on top of this. |
There was a problem hiding this comment.
Option B can also miss a commit after migration succeeds. I reproduced this on 14.0.3 with a memory-backed DirectoryNamespace. I left a writer idle at version 2, ran migrate_manifest_paths_v2() on a second handle, and verified that versions 1 and 2 both had V2 filenames. Only then did I call update_config() on the original handle. It committed 3.manifest. The full descending listing returned [3, 2, 1], while limit=1 and a freshly opened dataset both reported version 2. All operations were serial, as the released migration docs require.
Tracing 72adfe1e, the two V2 names fill the first page and its lookahead. The returned token is 2, so every subsequent page excludes version 3. Sorting only after a token is supplied (option C) cannot recover it either. Could you keep this three-version regression and assert that walking the public pages returns [3, 2, 1]? That checks the new pagination contract independently of the existing latest-version lookup.
Xuanwo
left a comment
There was a problem hiding this comment.
Thanks for laying out the trade-off. I agree with option B in 72adfe1e. Keep the same early-stop assumption as Dataset::open: on an ordered V2 history, use a single bounded LIST; if the scan encounters a V1 name, collect and sort the rest. On a table whose writers use a consistent naming scheme, walking every page should return exactly the unbounded descending history.
I'll follow up separately on the stale writer. Please add one note to the PR docs: if a handle opened before migration has written a V1 manifest after migration completed, stop using the stale handles, re-run migrate_manifest_paths_v2, and reopen the writers before resuming writes.
|
Thanks @Xuanwo. I added the stale-writer note to the PR description, along with a short summary of the option B behavior: one bounded |
There was a problem hiding this comment.
The added operating note clarifies that mixed layouts can recur after a successful migration through stale V1 writer handles. The accepted risk remains incomplete bounded histories, including omitted newest commits. Stop stale handles, finish or repeat migrate_manifest_paths_v2, and reopen writers before resuming writes.
The logical cursor and short ordered-V2 lookup remain acceptable for histories with a consistent naming scheme. The stale-writer defect is tracked separately in #11513, with a commit-path fix proposed in #11521; no writer changes are requested here.
Addresses the ascending LIST cost in #11448. Descending continuation is under review in #11469. For a bounded ascending continuation on ordered S3, check whether a V1 key could contribute to the requested interval, then seek to the corresponding V2 keys. Return the page directly only after finding every expected version and one lookahead row. A gap, a possible V1 overlap, or a change in decimal width falls back to the existing numeric scan. The logical page token survives deletion of its manifest. The regression compares a complete ascending walk with unbounded history when a V1 key sorts between V2 keys. It also checks bounded reads, duplicate manifests, and cleanup between pages. With 10,001 V2 manifests on Moto 5.2.6, the public Rust API returned every expected version, manifest path, size, eTag and timestamp. No query issued a manifest GET or HEAD. | Query | Upstream version-directory LISTs | This PR | | --- | ---: | ---: | | Latest version | 1 | 1 | | Full ascending history, unbounded | 11 | 11 | | Full ascending history, pages of 1,000 | 121 | 68 | | Full ascending history, pages of 100 | 1,111 | 260 | The three-version continuation consumed 102 entries on upstream and at most five with this patch. All 512 namespace unit tests passed. Rust formatting and Clippy passed in CI. The Java 25 job needs a maintainer rerun after Maven Central returned HTTP 429 while resolving the Maven JAR plugin. [Java job log](https://github.com/lance-format/lance/actions/runs/45667556579/job/139396945155)
Part of #11448 (item 2:
page_tokenfor descending listings).DirectoryNamespace::list_table_versionsignoredpage_tokenwhendescending = true, and never returned a continuation when more versions existed. A newest-first history therefore couldn't be paged.Changes:
list_descending_version_page: the newest-first counterpart oflist_ascending_version_page.limit + 1rows to tell whether another page follows.InvalidInput.list_versions_undernow delegates tolist_versions_below, which takes an optional exclusive upper bound.limit + 1kept manifests.descending = true, limit = 1(get_latest_version) stays a short read._versions/rescans for ascending pages) isn't addressed here.Tests: both extend existing tests.
test_list_table_versions_pagination_mixed_manifests_and_cleanup(mixed V1/V2 manifests, plus staging, backup and detached files) pages a descending history withlimit = 3. It checks the pages are[20, 12, 11],[10, 7, 5],[2], thatlimit = 1returns a continuation, and that a non-canonical token is rejected.test_list_versions_under_ordering_and_limitchecks bounded descending listings on both a lexically ordered store (early stop) and an unordered local store (sort path).Checks run locally:
cargo test -p lance-namespace-impls --lib -- version: 80 passed.cargo fmtpasses.Mixed manifest layouts: on a lexically ordered store, a V2 first entry is taken to mean the table uses V2 names, the same assumption
Dataset::openmakes. The descending listing then uses a single boundedLIST. If the scan meets a V1 manifest, it collects and sorts the rest numerically. On a table whose writers use a consistent naming scheme, walking every page returns exactly the unbounded descending history.