Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions rust/lance-core/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
12 changes: 6 additions & 6 deletions rust/lance/src/index/mem_wal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
);
}
Expand Down Expand Up @@ -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
);
}
Expand Down Expand Up @@ -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
);
}
Expand Down
4 changes: 2 additions & 2 deletions rust/lance/src/io/commit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
);
Expand All @@ -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,
);
Expand Down
33 changes: 16 additions & 17 deletions rust/lance/src/io/commit/conflict_resolver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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
);
}
Expand Down Expand Up @@ -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
);
}
Expand Down Expand Up @@ -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
);
}
Expand Down Expand Up @@ -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
);
}
Expand Down Expand Up @@ -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
);
}
Expand Down Expand Up @@ -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
);
}
Expand Down Expand Up @@ -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
);

Expand Down