Skip to content

Commit

Permalink
trivial: remove ExecutedChunk from TransactionReplayer interface
Browse files Browse the repository at this point in the history
  • Loading branch information
msmouse committed Oct 9, 2024
1 parent 6ac4241 commit 3bc0a0f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion execution/executor-types/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ pub trait TransactionReplayer: Send {
verify_execution_mode: &VerifyExecutionMode,
) -> Result<()>;

fn commit(&self) -> Result<ExecutedChunk>;
fn commit(&self) -> Result<Version>;
}

/// A structure that holds relevant information about a chunk that was committed.
Expand Down
10 changes: 7 additions & 3 deletions execution/executor/src/chunk_executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ impl<V: VMExecutor> TransactionReplayer for ChunkExecutor<V> {
)
}

fn commit(&self) -> Result<ExecutedChunk> {
fn commit(&self) -> Result<Version> {
let _guard = CONCURRENCY_GAUGE.concurrency_with(&["replayer", "commit"]);

self.inner.read().as_ref().expect("not reset").commit()
Expand Down Expand Up @@ -484,7 +484,7 @@ impl<V: VMExecutor> TransactionReplayer for ChunkExecutorInner<V> {
Ok(())
}

fn commit(&self) -> Result<ExecutedChunk> {
fn commit(&self) -> Result<Version> {
let started = Instant::now();

let chunk = self.commit_chunk_impl()?;
Expand All @@ -495,7 +495,11 @@ impl<V: VMExecutor> TransactionReplayer for ChunkExecutorInner<V> {
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."))
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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!(
Expand Down

0 comments on commit 3bc0a0f

Please sign in to comment.