Skip to content

Commit 8a28c73

Browse files
committed
return Result from Logical Log callbacks
1 parent e4d22f8 commit 8a28c73

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

core/mvcc/database/checkpoint_state_machine.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -728,7 +728,7 @@ impl<Clock: LogicalClock> CheckpointStateMachine<Clock> {
728728

729729
self.mvstore
730730
.storage
731-
.on_checkpoint_start(self.durable_txid_max_new);
731+
.on_checkpoint_start(self.durable_txid_max_new)?;
732732

733733
if self.write_set.is_empty() && self.index_write_set.is_empty() {
734734
// Nothing to checkpoint, skip pager txn and go straight to WAL checkpoint.
@@ -1519,15 +1519,15 @@ impl<Clock: LogicalClock> StateTransition for CheckpointStateMachine<Clock> {
15191519
Err(ref err) => {
15201520
self.mvstore
15211521
.storage
1522-
.on_checkpoint_end(self.durable_txid_max_new, Err(err.clone()));
1522+
.on_checkpoint_end(self.durable_txid_max_new, Err(err.clone()))?;
15231523
tracing::debug!("Error in checkpoint state machine: {err}");
15241524
self.cleanup_after_external_io_error();
15251525
res
15261526
}
15271527
Ok(TransitionResult::Done(ref result)) => {
15281528
self.mvstore
15291529
.storage
1530-
.on_checkpoint_end(self.durable_txid_max_new, Ok(result));
1530+
.on_checkpoint_end(self.durable_txid_max_new, Ok(result))?;
15311531
res
15321532
}
15331533
Ok(result) => Ok(result),

core/mvcc/persistent_storage/mod.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,19 @@ pub trait DurableStorage: Send + Sync + Debug {
5252
/// Called when a checkpoint begins, before any rows are written to the B-tree.
5353
/// `durable_txid_max` is the transaction watermark that will be durably persisted
5454
/// once the checkpoint completes.
55-
fn on_checkpoint_start(&self, _durable_txid_max: u64) {}
55+
fn on_checkpoint_start(&self, _durable_txid_max: u64) -> Result<()> {
56+
Ok(())
57+
}
5658

5759
/// Called after the checkpoint has fully completed: rows are flushed, WAL is
5860
/// truncated, and the logical log is reset.
59-
fn on_checkpoint_end(&self, _durable_txid_max: u64, _result: Result<&CheckpointResult>) {}
61+
fn on_checkpoint_end(
62+
&self,
63+
_durable_txid_max: u64,
64+
_result: Result<&CheckpointResult>,
65+
) -> Result<()> {
66+
Ok(())
67+
}
6068
}
6169

6270
pub struct Storage {

0 commit comments

Comments
 (0)