Write data, deletion and index files with If-None-Match: *, so a store can refuse overwriting a committed file

Aperta
#10,513 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 2 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
45/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
rust
Ambito
databases

Direzione di ricerca

Start in rust/lance-io/src/object_writer.rs at the store.put call for data files; switch to put_opts with PutMode::Create. Read docs/src/format/table/blob.md for the immutability rule and object_store's PutMode docs. Done means new files use conditional writes and a moto test shows a 412 when the key exists.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Problem

A Lance table's committed files must not change while a protected snapshot references them (docs/src/format/table/blob.md, "Published Lance-owned payloads must remain immutable while protected snapshots reference them"). Lance relies on that and checks nothing: the manifest records a file's size and no content hash (DataFile.file_size_bytes, IndexFile.size_bytes).

A catalog that vends a scoped credential to a writer (the namespace spec's DescribeTable / DeclareTable vending) must grant PutObject on data/, _deletions/ and _indices/, and an IAM or session policy cannot tell a put that creates a key from one that replaces it. So any holder of a write credential can replace a committed file. Measured on pylance 13.0.0: a replacement of a different size breaks every read, and one of the same size is served silently.

S3 and S3-compatible stores can refuse it when the writer cooperates: a put naming If-None-Match: * over an existing key answers 412, and a bucket policy can require the header (s3:if-none-match, with the s3:ObjectCreationOperation exemption for multipart parts; AWS user guide, "Enforce conditional writes"). Lance sends the header only on _versions/*.manifest (measured against moto with pylance 13.0.0). Data files go through an unconditional put (rust/lance-io/src/object_writer.rs, store.put) or a multipart upload, so requiring the header would refuse every Lance write.

Proposal
  1. Write every new data file, blob sidecar, deletion file and index file with PutMode::Create (put_opts), since each name is minted fresh and a collision is a bug.
  2. Complete a multipart upload conditionally once object_store supports it (apache/arrow-rs-object-store#289, #863).
  3. Optionally expose a flag that refuses to write without the condition, so a deployment can rely on it.

With this, a store policy denying any put without If-None-Match makes overwriting a committed file impossible for every writer, the store arbitrating as it already does for manifests.

Context

Downstream we detect it instead: the catalog records each added file's ETag and size at commit, and a sweep re-reads them. That catches an overwrite after it happens; the condition above would prevent it.

Lingua principale
Rust
Stelle
7.3k
Fork
929
Merge medio
2g 22h
PR unite (30g)
572

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di lance-format/lance

Tutte le issue di lance-format/lance

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.