diff --git a/execution/executor-types/src/lib.rs b/execution/executor-types/src/lib.rs index 20e1fa1805163..87348bed18dae 100644 --- a/execution/executor-types/src/lib.rs +++ b/execution/executor-types/src/lib.rs @@ -270,7 +270,7 @@ pub trait TransactionReplayer: Send { verify_execution_mode: &VerifyExecutionMode, ) -> Result<()>; - fn commit(&self) -> Result; + fn commit(&self) -> Result; } /// A structure that holds relevant information about a chunk that was committed. diff --git a/execution/executor/src/chunk_executor.rs b/execution/executor/src/chunk_executor.rs index b751d8137c1a5..a72ffac3fe1e1 100644 --- a/execution/executor/src/chunk_executor.rs +++ b/execution/executor/src/chunk_executor.rs @@ -418,7 +418,7 @@ impl TransactionReplayer for ChunkExecutor { ) } - fn commit(&self) -> Result { + fn commit(&self) -> Result { let _guard = CONCURRENCY_GAUGE.concurrency_with(&["replayer", "commit"]); self.inner.read().as_ref().expect("not reset").commit() @@ -484,7 +484,7 @@ impl TransactionReplayer for ChunkExecutorInner { Ok(()) } - fn commit(&self) -> Result { + fn commit(&self) -> Result { let started = Instant::now(); let chunk = self.commit_chunk_impl()?; @@ -495,7 +495,11 @@ impl TransactionReplayer for ChunkExecutorInner { tps = num_committed as f64 / started.elapsed().as_secs_f64(), "TransactionReplayer::commit() OK" ); - Ok(chunk) + + Ok(chunk + .result_state + .current_version + .expect("Version must exist after commit.")) } } diff --git a/storage/backup/backup-cli/src/backup_types/transaction/restore.rs b/storage/backup/backup-cli/src/backup_types/transaction/restore.rs index 0b5c0ceb4dfd2..c1eadb5366ff4 100644 --- a/storage/backup/backup-cli/src/backup_types/transaction/restore.rs +++ b/storage/backup/backup-cli/src/backup_types/transaction/restore.rs @@ -629,8 +629,7 @@ impl TransactionRestoreBatchController { .with_label_values(&["commit_txn_chunk"]) .start_timer(); tokio::task::spawn_blocking(move || { - let committed_chunk = chunk_replayer.commit()?; - let v = committed_chunk.result_state.current_version.unwrap_or(0); + let v = chunk_replayer.commit()?; let total_replayed = v - first_version + 1; TRANSACTION_REPLAY_VERSION.set(v as i64); info!(