Skip to content

Commit 2c0667f

Browse files
committed
Add support for managing a fixed number of retained snapshots
With this change, Restate can be configured to retain a set of recent snapshots, and automatically delete older snapshots that are no longer needed. Previously, older snapshots were no longer managed by Retate. This saves users from having to implement an external lifecycle policy. When explicit snapshot retention is specified, the reported Archived LSN will be that of the earliest retained snapshot. Together with the durability setting, this influences the automatic log trim behavior. When auto trim respects the Archived LSN, the latest partition snapshot reference can be (manually) updated to any snapshot within the retention window, e.g. to deal with snapshot corruption.
1 parent 00de3b0 commit 2c0667f

File tree

8 files changed

+873
-97
lines changed

8 files changed

+873
-97
lines changed

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/partition-store/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ rand = { workspace = true }
6868
serde_json = { workspace = true }
6969
tempfile = { workspace = true }
7070
tracing-subscriber = { workspace = true }
71+
tracing-test = { workspace = true }
7172

7273
[[bench]]
7374
name = "basic_benchmark"

crates/partition-store/src/snapshots.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,12 @@ impl Snapshots {
9494
let archived_lsn = repository
9595
.get_latest_archived_lsn(partition_id)
9696
.await
97-
.inspect_err(|err| warn!(?partition_id, "Unable to get latest archived LSN: {}", err))
97+
.inspect_err(|err| {
98+
warn!(
99+
?partition_id,
100+
"Unable to get archived LSN from snapshot repository: {}", err
101+
)
102+
})
98103
.ok()
99104
.unwrap_or(ArchivedLsn::None);
100105
db.note_archived_lsn(archived_lsn);

0 commit comments

Comments
 (0)