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
6 changes: 3 additions & 3 deletions core/mvcc/database/checkpoint_state_machine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -728,7 +728,7 @@ impl<Clock: LogicalClock> CheckpointStateMachine<Clock> {

self.mvstore
.storage
.on_checkpoint_start(self.durable_txid_max_new);
.on_checkpoint_start(self.durable_txid_max_new)?;

if self.write_set.is_empty() && self.index_write_set.is_empty() {
// Nothing to checkpoint, skip pager txn and go straight to WAL checkpoint.
Expand Down Expand Up @@ -1519,15 +1519,15 @@ impl<Clock: LogicalClock> StateTransition for CheckpointStateMachine<Clock> {
Err(ref err) => {
self.mvstore
.storage
.on_checkpoint_end(self.durable_txid_max_new, Err(err.clone()));
.on_checkpoint_end(self.durable_txid_max_new, Err(err.clone()))?;
tracing::debug!("Error in checkpoint state machine: {err}");
self.cleanup_after_external_io_error();
res
}
Ok(TransitionResult::Done(ref result)) => {
self.mvstore
.storage
.on_checkpoint_end(self.durable_txid_max_new, Ok(result));
.on_checkpoint_end(self.durable_txid_max_new, Ok(result))?;
res
}
Ok(result) => Ok(result),
Expand Down
12 changes: 10 additions & 2 deletions core/mvcc/persistent_storage/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,19 @@ pub trait DurableStorage: Send + Sync + Debug {
/// Called when a checkpoint begins, before any rows are written to the B-tree.
/// `durable_txid_max` is the transaction watermark that will be durably persisted
/// once the checkpoint completes.
fn on_checkpoint_start(&self, _durable_txid_max: u64) {}
fn on_checkpoint_start(&self, _durable_txid_max: u64) -> Result<()> {
Ok(())
}

/// Called after the checkpoint has fully completed: rows are flushed, WAL is
/// truncated, and the logical log is reset.
fn on_checkpoint_end(&self, _durable_txid_max: u64, _result: Result<&CheckpointResult>) {}
fn on_checkpoint_end(
&self,
_durable_txid_max: u64,
_result: Result<&CheckpointResult>,
) -> Result<()> {
Ok(())
}
}

pub struct Storage {
Expand Down
Loading