Revert "safekeeper: check for non-consecutive writes in safekeeper.rs" (#8771)

Reverts neondatabase/neon#8640

This broke `test_last_log_term_switch` via a merge race of some kind.
This commit is contained in:
John Spray
2024-08-20 12:34:53 +01:00
committed by GitHub
parent c96593b473
commit 02a28c01ca
3 changed files with 0 additions and 37 deletions

View File

@@ -875,29 +875,6 @@ where
return Ok(Some(AcceptorProposerMessage::AppendResponse(resp)));
}
// Disallow any non-sequential writes, which can result in gaps or
// overwrites. If we need to move the pointer, ProposerElected message
// should have truncated WAL first accordingly. Note that the first
// condition (WAL rewrite) is quite expected in real world; it happens
// when walproposer reconnects to safekeeper and writes some more data
// while first connection still gets some packets later. It might be
// better to not log this as error! above.
let write_lsn = self.wal_store.write_lsn();
if write_lsn > msg.h.begin_lsn {
bail!(
"append request rewrites WAL written before, write_lsn={}, msg lsn={}",
write_lsn,
msg.h.begin_lsn
);
}
if write_lsn < msg.h.begin_lsn && write_lsn != Lsn(0) {
bail!(
"append request creates gap in written WAL, write_lsn={}, msg lsn={}",
write_lsn,
msg.h.begin_lsn,
);
}
// Now we know that we are in the same term as the proposer,
// processing the message.
@@ -1028,10 +1005,6 @@ mod tests {
#[async_trait::async_trait]
impl wal_storage::Storage for DummyWalStore {
fn write_lsn(&self) -> Lsn {
self.lsn
}
fn flush_lsn(&self) -> Lsn {
self.lsn
}

View File

@@ -37,8 +37,6 @@ use utils::{id::TenantTimelineId, lsn::Lsn};
#[async_trait::async_trait]
pub trait Storage {
// Last written LSN.
fn write_lsn(&self) -> Lsn;
/// LSN of last durably stored WAL record.
fn flush_lsn(&self) -> Lsn;
@@ -329,10 +327,6 @@ impl PhysicalStorage {
#[async_trait::async_trait]
impl Storage for PhysicalStorage {
// Last written LSN.
fn write_lsn(&self) -> Lsn {
self.write_lsn
}
/// flush_lsn returns LSN of last durably stored WAL record.
fn flush_lsn(&self) -> Lsn {
self.flush_record_lsn

View File

@@ -177,10 +177,6 @@ impl DiskWALStorage {
#[async_trait::async_trait]
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