Skip to content

feat(commit): default unrecognized schemes to put-if-not-exists commit handler - #8773

Merged
Xuanwo merged 2 commits into
lance-format:mainfrom
farazshaikh:fs/default-put-if-not-exists-commit-handler
Nov 1, 2026
Merged

Xuanwo merged 2 commits into
lance-format:mainfrom
farazshaikh:fs/default-put-if-not-exists-commit-handler

Conversation

@farazshaikh

Copy link
Copy Markdown
Contributor

Summary

commit_handler_from_url resolves the commit handler from the URL scheme string. Recognized schemes (s3, gs, az, memory, file, ...) get ConditionalPutCommitHandler, but every other scheme fell through to UnsafeCommitHandler, which blind-writes the manifest with no create-if-not-exists guard. Concurrent writers to such a scheme can all target the same next version, overwrite each other, and report success while silently losing updates.

This changes the default for unrecognized schemes to ConditionalPutCommitHandler (put-if-not-exists).

Why

  • Most object stores (including out-of-tree providers registered at runtime through the ObjectStore registry added in feat(python): expose ObjectStoreProvider registration in pylance #8522) back onto storage that supports atomic create-if-not-exists.
  • With this default, concurrent commits to an unrecognized scheme fail loudly with a conflict instead of silently clobbering each other.
  • A store that genuinely lacks conditional-put support can still opt back into UnsafeCommitHandler via a caller-supplied commit handler.

Test

Extended test_commit_handler_from_url_conditional_put_schemes with a custom_scheme case asserting an unrecognized scheme now routes to ConditionalPutCommitHandler.

Context

Follow-up to #8522 per the review discussion. This is the first of two follow-ups; a subsequent change will let a provider declare its commit handler (e.g. put-if-not-exists vs unsafe) so selection is driven by the provider rather than a hardcoded scheme list.

@github-actions github-actions Bot added the enhancement New feature or request label Aug 26, 2026
lance-gatekeeper[bot]

This comment was marked as outdated.

@lance-gatekeeper lance-gatekeeper Bot added K-approved Latest Gatekeeper recommendation permits acceptance. K-risk Latest Gatekeeper recommendation includes a non-blocking risk. labels Aug 26, 2026
commit_handler_from_url fell through to UnsafeCommitHandler for any scheme
outside the hardcoded allowlist. Concurrent writers to such a scheme could all
target the same manifest version and blindly overwrite it, reporting success
while silently losing updates.

Default the fallback to ConditionalPutCommitHandler instead. Most object stores
(including out-of-tree providers registered at runtime via the ObjectStore
registry) back onto storage that supports atomic create-if-not-exists, so
concurrent commits now fail loudly with a conflict rather than clobbering each
other. A store that genuinely lacks conditional-put support can still opt back
into UnsafeCommitHandler via a caller-supplied commit handler.

Follow-up to lance-format#8522 (per review discussion). A subsequent change will let a
provider declare its commit handler explicitly.
@farazshaikh
farazshaikh force-pushed the fs/default-put-if-not-exists-commit-handler branch from 261b157 to acd37c4 Compare August 27, 2026 19:26
@lance-gatekeeper lance-gatekeeper Bot removed K-approved Latest Gatekeeper recommendation permits acceptance. K-risk Latest Gatekeeper recommendation includes a non-blocking risk. labels Aug 27, 2026
lance-gatekeeper[bot]

This comment was marked as outdated.

@lance-gatekeeper lance-gatekeeper Bot removed K-approved Latest Gatekeeper recommendation permits acceptance. K-risk Latest Gatekeeper recommendation includes a non-blocking risk. labels Nov 1, 2026

@lance-gatekeeper lance-gatekeeper Bot left a comment

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.

⚠️ Gate recommendation: approve with a non-blocking risk.

Unknown schemes now use conditional creation instead of unconditional manifest overwrites. Providers that honor PutMode::Create detect conflicts, while unsupported operations return errors; explicit caller handlers retain precedence. This implements the fallback change proposed in #8522.

Older Lance writers still overwrite manifests unconditionally for unknown schemes, so mixed-version concurrent writes remain unsafe. Quiesce writers during the upgrade or coordinate every writer through a shared lock. No further code change is requested here.

@lance-gatekeeper lance-gatekeeper Bot added K-approved Latest Gatekeeper recommendation permits acceptance. K-risk Latest Gatekeeper recommendation includes a non-blocking risk. labels Nov 1, 2026

@Xuanwo Xuanwo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The updated head includes current main, and the full applicable CI suite passes. The change preserves explicit commit handlers, all existing known-scheme routing, and the COS safeguard while defaulting unknown schemes to conditional creation. Providers must honor PutMode::Create; mixed-version concurrency remains unsafe until older writers are quiesced or coordinated through a shared lock.

@Xuanwo
Xuanwo merged commit 10ff0f3 into lance-format:main Nov 1, 2026
42 of 44 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request K-approved Latest Gatekeeper recommendation permits acceptance. K-risk Latest Gatekeeper recommendation includes a non-blocking risk.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants