bug: merge_insert does not detect concurrent inserts of the same FixedSizeBinary primary key

Chiusa Adatta ai principianti
#10,811 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 2 giorni

@lance-gatefixer ci sta già lavorando.

Dal 6/11/2026.

  • #10813 di @lance-gatefixer — aperta

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
84/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
rust
Ambito
databases

Direzione di ricerca

Inizia con extract_key_value in rust/lance-table/src/format/key_existence.rs e confronta la gestione di FixedSizeBinary con quella di Binary e LargeBinary. Riproduci il problema usando lo schema del test di concorrenza in merge_insert/tests/concurrency.rs, quindi conferma che gli inserimenti simultanei della stessa chiave di dimensione fissa producono un conflitto che può essere ritentato.

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

Descrizione

bug
Description

A declared primary key of type FixedSizeBinary (for example a 32-byte content hash) is never added to a merge_insert's inserted_rows_filter. Two writers that insert the same new key against one version therefore both commit, and the key ends up duplicated. Binary and LargeBinary keys are detected correctly.

Root cause: extract_key_value in rust/lance-table/src/format/key_existence.rs has no FixedSizeBinary arm and falls through to _ => return None. The key is skipped, the transaction carries an empty Bloom filter, and check_update_txn in the conflict resolver finds no intersection. This happens on both the indexed path (after #10606) and the v2 path, because both build the filter through this function.

Mapping the type to KeyValue::Binary, as Binary and LargeBinary already are, fixes it. I have a patch with tests and can open a PR if that's welcome.

Steps to reproduce

This reproduces on main at 9b311133d and on v15.0.0-beta.12. Test, in the style of merge_insert/tests/concurrency.rs:

// schema: id FixedSizeBinary(32) with lance-schema:unenforced-primary-key=true, value UInt32
// 1. create a dataset with key [1; 32]; optionally create a BTree index on id
// 2. from the same dataset version, stage two merge_inserts of key [5; 32]
//    (when_matched DoNothing, when_not_matched InsertAll) via execute_uncommitted_batches
// 3. commit the first staged transaction, then the second with CommitBuilder
// 4. the second commit succeeds and the dataset holds two rows with key [5; 32]

The same test with id declared as Binary gets a retryable conflict on the second commit, as expected.

Expected behavior

The second commit is refused with a retryable conflict, the same as for Binary, Utf8 and integer keys.

Lance version

15.0.0-beta.12; also main at 9b311133d

Language binding

Rust

Environment

macOS (arm64), local filesystem and memory://

Lingua principale
Rust
Stelle
7.3k
Fork
924
Merge medio
3g 12h
PR unite (30g)
539

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.