Skip to content
Open
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
7 changes: 5 additions & 2 deletions rust/lance/src/io/commit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1371,7 +1371,6 @@ pub(crate) async fn commit_transaction(
// has not necessarily. So for anything involving writing, use `object_store`.
let read_version = transaction.read_version;
let mut target_version = read_version + 1;
let original_dataset = dataset.clone();

// read_version sometimes defaults to zero for overwrite.
// If num_retries is zero, we are in "strict overwrite" mode.
Expand All @@ -1388,6 +1387,9 @@ pub(crate) async fn commit_transaction(
dataset.clone()
};

// `dataset` advances past the read version inside the retry loop.
let read_version_dataset = dataset.clone();

let mut transaction = transaction.clone();

let num_attempts = std::cmp::max(commit_config.num_retries, 1);
Expand Down Expand Up @@ -1418,7 +1420,8 @@ pub(crate) async fn commit_transaction(
// started at exact same time better.

let mut rebase =
TransactionRebase::try_new(&original_dataset, transaction, affected_rows).await?;
TransactionRebase::try_new(&read_version_dataset, transaction, affected_rows)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wishful thinking nit: it might be nice to rename this field in TransactionRebase to read_version_dataset also.

.await?;

for (other_version, other_transaction) in other_transactions.iter() {
rebase.check_txn(other_transaction, *other_version)?;
Expand Down
Loading
Loading