From 449d09928779e160898483736a4b1a18c7d28247 Mon Sep 17 00:00:00 2001 From: Will Jones Date: Tue, 24 Feb 2026 14:22:52 -0800 Subject: [PATCH 1/2] feat: introduce IncompatibleTransaction error --- rust/lance-core/src/error.rs | 5 +++ rust/lance/src/io/commit.rs | 4 +-- rust/lance/src/io/commit/conflict_resolver.rs | 33 +++++++++---------- 3 files changed, 23 insertions(+), 19 deletions(-) diff --git a/rust/lance-core/src/error.rs b/rust/lance-core/src/error.rs index fe943e03a1d..299af774fe3 100644 --- a/rust/lance-core/src/error.rs +++ b/rust/lance-core/src/error.rs @@ -51,6 +51,11 @@ pub enum Error { source: BoxedError, location: Location, }, + #[snafu(display("Incompatible transaction: {source}, {location}"))] + IncompatibleTransaction { + source: BoxedError, + location: Location, + }, #[snafu(display("Retryable commit conflict for version {version}: {source}, {location}"))] RetryableCommitConflict { version: u64, diff --git a/rust/lance/src/io/commit.rs b/rust/lance/src/io/commit.rs index 2ce599453b8..922060b2f73 100644 --- a/rust/lance/src/io/commit.rs +++ b/rust/lance/src/io/commit.rs @@ -1513,7 +1513,7 @@ mod tests { if result.is_err() { first_operation_failed = true; assert!( - matches!(&result, &Err(Error::CommitConflict { .. })), + matches!(&result, &Err(Error::IncompatibleTransaction { .. })), "{:?}", result, ); @@ -1523,7 +1523,7 @@ mod tests { true => assert!(result.is_ok(), "{:?}", result), false => { assert!( - matches!(&result, &Err(Error::CommitConflict { .. })), + matches!(&result, &Err(Error::IncompatibleTransaction { .. })), "{:?}", result, ); diff --git a/rust/lance/src/io/commit/conflict_resolver.rs b/rust/lance/src/io/commit/conflict_resolver.rs index bb6f9aae866..703afbb17e6 100644 --- a/rust/lance/src/io/commit/conflict_resolver.rs +++ b/rust/lance/src/io/commit/conflict_resolver.rs @@ -178,8 +178,7 @@ impl<'a> TransactionRebase<'a> { other_version: u64, location: Location, ) -> Error { - Error::CommitConflict { - version: other_version, + Error::IncompatibleTransaction { source: format!( "This {} transaction is incompatible with concurrent transaction {} at version {}.", self.transaction.operation, other_transaction.operation, other_version @@ -2731,7 +2730,7 @@ mod tests { NotCompatible => { let result = rebase.check_txn(other, 1); assert!( - matches!(result, Err(Error::CommitConflict { .. })), + matches!(result, Err(Error::IncompatibleTransaction { .. })), "Transaction {:?} should be {:?} with {:?}, but was: {:?}", operation, expected_conflict, @@ -2826,8 +2825,8 @@ mod tests { .unwrap(); let result = rebase.check_txn(&txn2, 2); assert!( - matches!(result, Err(Error::CommitConflict { .. })), - "Expected CommitConflict error for duplicate name, got {:?}", + matches!(result, Err(Error::IncompatibleTransaction { .. })), + "Expected IncompatibleTransaction error for duplicate name, got {:?}", result ); } @@ -2867,8 +2866,8 @@ mod tests { .unwrap(); let result = rebase.check_txn(&txn2, 2); assert!( - matches!(result, Err(Error::CommitConflict { .. })), - "Expected CommitConflict error for duplicate path, got {:?}", + matches!(result, Err(Error::IncompatibleTransaction { .. })), + "Expected IncompatibleTransaction error for duplicate path, got {:?}", result ); } @@ -2908,8 +2907,8 @@ mod tests { .unwrap(); let result = rebase.check_txn(&txn2, 2); assert!( - matches!(result, Err(Error::CommitConflict { .. })), - "Expected CommitConflict error for duplicate ID, got {:?}", + matches!(result, Err(Error::IncompatibleTransaction { .. })), + "Expected IncompatibleTransaction error for duplicate ID, got {:?}", result ); } @@ -3007,8 +3006,8 @@ mod tests { .unwrap(); let result = rebase.check_txn(&txn2, 2); assert!( - matches!(result, Err(Error::CommitConflict { .. })), - "Expected CommitConflict error, got {:?}", + matches!(result, Err(Error::IncompatibleTransaction { .. })), + "Expected IncompatibleTransaction error, got {:?}", result ); } @@ -3299,8 +3298,8 @@ mod tests { let result = rebase.check_txn(&committed_txn, 1); assert!( - matches!(result, Err(Error::CommitConflict { .. })), - "Expected non-retryable CommitConflict for lower generation, got {:?}", + matches!(result, Err(Error::IncompatibleTransaction { .. })), + "Expected non-retryable IncompatibleTransaction for lower generation, got {:?}", result ); } @@ -3337,8 +3336,8 @@ mod tests { let result = rebase.check_txn(&committed_txn, 1); assert!( - matches!(result, Err(Error::CommitConflict { .. })), - "Expected non-retryable CommitConflict for equal generation, got {:?}", + matches!(result, Err(Error::IncompatibleTransaction { .. })), + "Expected non-retryable IncompatibleTransaction for equal generation, got {:?}", result ); } @@ -3465,8 +3464,8 @@ mod tests { let result = rebase.check_txn(&committed_txn, 1); assert!( - matches!(result, Err(Error::CommitConflict { .. })), - "Expected non-retryable CommitConflict when UpdateMemWalState generation is lower than CreateIndex, got {:?}", + matches!(result, Err(Error::IncompatibleTransaction { .. })), + "Expected non-retryable IncompatibleTransaction when UpdateMemWalState generation is lower than CreateIndex, got {:?}", result ); From 938ab572df963ffb36b75e7fd2729e221127a0ca Mon Sep 17 00:00:00 2001 From: Will Jones Date: Tue, 24 Feb 2026 14:50:59 -0800 Subject: [PATCH 2/2] some more test fixes --- rust/lance/src/index/mem_wal.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/rust/lance/src/index/mem_wal.rs b/rust/lance/src/index/mem_wal.rs index 6bc596dd42c..de8c68164dd 100644 --- a/rust/lance/src/index/mem_wal.rs +++ b/rust/lance/src/index/mem_wal.rs @@ -189,8 +189,8 @@ mod tests { let result = CommitBuilder::new(Arc::new(dataset)).execute(txn2).await; assert!( - matches!(result, Err(crate::Error::CommitConflict { .. })), - "Expected non-retryable CommitConflict for lower generation, got {:?}", + matches!(result, Err(crate::Error::IncompatibleTransaction { .. })), + "Expected non-retryable IncompatibleTransaction for lower generation, got {:?}", result ); } @@ -225,8 +225,8 @@ mod tests { let result = CommitBuilder::new(Arc::new(dataset)).execute(txn2).await; assert!( - matches!(result, Err(crate::Error::CommitConflict { .. })), - "Expected non-retryable CommitConflict for equal generation, got {:?}", + matches!(result, Err(crate::Error::IncompatibleTransaction { .. })), + "Expected non-retryable IncompatibleTransaction for equal generation, got {:?}", result ); } @@ -418,8 +418,8 @@ mod tests { let result = CommitBuilder::new(Arc::new(dataset)).execute(txn2).await; assert!( - matches!(result, Err(crate::Error::CommitConflict { .. })), - "Expected non-retryable CommitConflict when UpdateMemWalState generation is lower than CreateIndex, got {:?}", + matches!(result, Err(crate::Error::IncompatibleTransaction { .. })), + "Expected non-retryable IncompatibleTransaction when UpdateMemWalState generation is lower than CreateIndex, got {:?}", result ); }