safekeeper: check for non-consecutive writes in safekeeper.rs

wal_storage.rs already checks this, but since this is a quite legit scenario
check it at safekeeper.rs (consensus level) as well.

ref https://github.com/neondatabase/neon/issues/8212

This is a take 2; previous PR #8640 had been reverted because interplay
with another change broke test_last_log_term_switch.
This commit is contained in:
Arseny Sher
2024-08-07 19:26:06 +03:00
committed by Arseny Sher
parent 83dd7f559c
commit c7187be8a1
3 changed files with 113 additions and 23 deletions

View File

@@ -175,6 +175,10 @@ impl DiskWALStorage {
}
impl wal_storage::Storage for DiskWALStorage {
// Last written LSN.
fn write_lsn(&self) -> Lsn {
self.write_lsn
}
/// LSN of last durably stored WAL record.
fn flush_lsn(&self) -> Lsn {
self.flush_record_lsn