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
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ members = [
]

[workspace.package]
version = "0.34.3"
version = "0.34.4"


[workspace.lints.clippy]
Expand Down
2 changes: 1 addition & 1 deletion opsqueue/src/db/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ impl DBPools {
}

pub async fn periodically_checkpoint_wal(&self) {
const EXPLICIT_WAL_CHECK_INTERVAL: Duration = Duration::from_secs(1);
const EXPLICIT_WAL_CHECK_INTERVAL: Duration = Duration::from_millis(100);
let mut interval = tokio::time::interval(EXPLICIT_WAL_CHECK_INTERVAL);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I think you want to set the missed tick strategy, otherwise this will repeatedly issue checkpoints whenever the checkpoints takes too long. This will be exacerbated by the interval being shortened.

Suggested change
let mut interval = tokio::time::interval(EXPLICIT_WAL_CHECK_INTERVAL);
let mut interval = tokio::time::interval(EXPLICIT_WAL_CHECK_INTERVAL);
interval.set_missed_tick_behavior(tokio::time::MissedTickBehavior::Skip);

The default behaviour is "burst", i.e. fire all missed ticks right now. This is not what we want here. We don't actually rely on the number of checkpoints, we just want to fire them regularly.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Doing a checkpoint when there is (almost) nothing to checkpoint is (almost) free, though it will of course add to the congestion on the one writer DB connection.

Changing to Skip is a nice next step. I'll also add explicit checkpoints to the two write-heavy points of the app, in a follow-up PR.

loop {
let _ = self.perform_explicit_wal_checkpoint().await;
Expand Down
Loading