bug: merge_insert does not detect concurrent inserts of the same FixedSizeBinary primary key
Maintainers usually reply within 2 days
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 84/100
Research direction
Start with extract_key_value in rust/lance-table/src/format/key_existence.rs and compare its handling of FixedSizeBinary with Binary and LargeBinary. Reproduce the issue using the concurrency test pattern in merge_insert/tests/concurrency.rs, then confirm that concurrent inserts of the same fixed-size key produce a retryable conflict.
Written by the indexing model from the issue text.
Description
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://
- Dominant language
- Rust
- Stars
- 7.3k
- Forks
- 924
- Avg merge
- 3d 18h
- Merged PRs (30d)
- 575
Getting set up
Starts the project's dev container in your browser, under your own GitHub account.
- Ships a Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from lance-format/lance
-
bug: test_ann flakes because its IVF fixture leaves partitions with fewer than k rowsPossibly taken @lance-gatefixer claimed this today. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
lance-format/lance#10782 ·
Maintainers usually reply within 2 days
-
docs: approx_mode docs say it only affects RQ indexesPossibly taken @LuciferYang claimed this 1 day ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
lance-format/lance#10745 ·
Maintainers usually reply within 2 days
-
(feat): expose set_capacity of the cache to the session APIPossibly taken @hello-peter-tang claimed this 3 days ago. Openfeature performance
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
lance-format/lance#10137 ·
Maintainers usually reply within 2 days
-
Upgrade DataFusion for the unparser stack-overflow fixMay be free again A pull request for this issue was closed without being merged. Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
lance-format/lance#8225 ·
Maintainers usually reply within 2 days
-
enhancement
Difficulty 1/5 Under an hour Newbie friendliness 84/100
lance-format/lance#6425 · 2 comments ·
Maintainers usually reply within 2 days
All issues in lance-format/lance
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
Maintainers usually reply within 1 day
-
type: documentation
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
tauri-apps/tauri#16476 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
fish-shell/fish-shell#13084 · 1 comment ·
Maintainers usually reply within 2 days
-
provider testing
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
mishraprafful/multihull#234 ·
Maintainers usually reply within 1 day
-
comp-documentation
Difficulty 1/5 Under an hour Newbie friendliness 84/100
ClickHouse/ClickHouse#129829 ·
Maintainers usually reply within 1 day