How Do I Handle Lance Table Concurrency Conflicts?
Lance tables use a Multi-Version Concurrency Control (MVCC) model. Each table version is represented by immutable dataset metadata (manifests) that references data fragments (data files), associated index files, and optional transaction files. A read operation targets a specific committed version, enabling snapshot reads. A write operation creates a new version by committing updated metadata, generating atomic, versioned updates at the table level and snapshot-isolation–style guarantees within a single table or dataset. In Lance, a transaction refers to any committed operation—such as a write, update, delete, or index creation—that results in a new immutable table version.
Lance Transaction Commit Process
- Construct a transaction based on a baseline version, for example, by appending new fragments or creating new index references. A transaction is essentially a set of changes applied to the baseline manifest.
- Write new files associated with the transaction—new fragments, deletion files, or index files—to storage. These files are immutable once written.
- Atomically commit the updated metadata by writing a new manifest file as the entry point for the new table version. If concurrent writes cause the atomic commit to fail, Lance initiates conflict detection, followed by retry or rebase.
Transaction Conflicts
When multiple transactions are based on the same base version, a conflict window occurs: each attempt competes to publish a different "next version" of the table by committing its own manifest. Lance detects this at commit time and applies conflict resolution logic, which may include merge, rebase, or retry depending on the operation type and compatibility rules. Otherwise, the commit fails with a conflict error.
- Lance transaction operation types
Table 1 Lance transaction operation types Transaction Name
Description
SQL/API (or N/A)
Append
Adds new data fragments without modifying existing data.
INSERT
Delete
Marks rows as deleted using a deletion vector.
N/A
Overwrite
Replaces the entire table with new data, schema, and configuration.
INSERT OVERWRITE, TRUNCATE
CreateIndex
Creates, replaces, or drops secondary indexes (vector, scalar, or full-text).
CREATE INDEX/DROP INDEX/REBUILD INDEX/OPTIMIZE INDEX
Rewrite
Reorganizes data without changing semantic content (e.g., compaction, deduplication, reordering).
N/A
Merge
Adds new columns, requiring updates across all fragments to include the new schema.
ADD COLUMN, ALTER COLUMN TYPE
Project
Removes or renames columns via metadata-only schema changes.
DROP COLUMN, ALTER COLUMN RENAME
Restore
Restores the table to a previous version.
N/A
ReserveFragments
Pre-allocates fragment IDs for future write operations.
N/A
Clone
Creates a shallow or deep copy of a table; shallow copies reference existing data via base paths.
N/A
Update
Modifies row values without adding or deleting rows.
UPDATE
UpdateConfig
Updates table or schema metadata without modifying data files.
ALTER SET/UNSET
DataReplacement
Replaces data in a specific column range with new data files.
N/A
UpdateMemWalState
Updates the state of the MemWAL (write-ahead log–based index).
N/A
UpdateBases
Adds new base paths to reference external data locations.
N/A
- Lance transaction conflict types
Table 2 Lance transaction conflict types Conflict Type
Description
Resolution Mechanism
Rebasable Conflict
Transaction can be transformed to incorporate concurrent changes while preserving intent.
Automatically rebased and retried at commit layer; fails if retry limit is exceeded.
Retryable Conflict
Transaction cannot be merged automatically.
Commit fails with non-retryable error.
Incompatible Conflict
Fundamental semantic conflict; retrying disallowed.
Commit fails with non-retryable error.
- Lance transaction conflict matrix:
Legend: √ indicates a mergeable conflict, × an unresolvable conflict, and ? means retry/rebase required.
Example:
When two Append transactions execute concurrently (i.e., both inserting data into the table), they represent a mergeable conflict. In this case, Lance attempts to merge both sets of appended fragments into a single consistent next version and retries the commit. If the merge succeeds within the retry limit, both transactions succeed without conflict. If retries are exhausted, the commit fails with a conflict error.
What is your overall rating for this page?
Thank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot
