mirror of
https://github.com/neondatabase/neon.git
synced 2026-01-03 19:42:55 +00:00
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:
@@ -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
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user