mirror of
https://github.com/neondatabase/neon.git
synced 2026-05-27 01:50:38 +00:00
Prevent flip-flop of standby_horizon by ignoring 0 LSN and resetting it after each GC iteration
This commit is contained in:
@@ -631,6 +631,25 @@ impl PageServerHandler {
|
||||
span,
|
||||
)
|
||||
}
|
||||
PagestreamFeMessage::GetLatestPage(old_req) => {
|
||||
let req = PagestreamGetPageRequest {
|
||||
horizon: if old_req.latest {
|
||||
Lsn::MAX
|
||||
} else {
|
||||
old_req.lsn
|
||||
},
|
||||
lsn: old_req.lsn,
|
||||
rel: old_req.rel,
|
||||
blkno: old_req.blkno,
|
||||
};
|
||||
let span = tracing::info_span!("handle_get_page_at_lsn_request", rel = %req.rel, blkno = %req.blkno, req_lsn = %req.lsn);
|
||||
(
|
||||
self.handle_get_page_at_lsn_request(tenant_id, timeline_id, &req, &ctx)
|
||||
.instrument(span.clone())
|
||||
.await,
|
||||
span,
|
||||
)
|
||||
}
|
||||
PagestreamFeMessage::GetPage(req) => {
|
||||
// shard_id is filled in by the handler
|
||||
let span = tracing::info_span!("handle_get_page_at_lsn_request", rel = %req.rel, blkno = %req.blkno, req_lsn = %req.lsn);
|
||||
|
||||
@@ -4209,6 +4209,9 @@ impl Timeline {
|
||||
new_gc_cutoff
|
||||
};
|
||||
|
||||
// Reset standby horizon to ignore it if it is not updated till next GC
|
||||
self.standby_horizon.store(Lsn::INVALID);
|
||||
|
||||
let res = self
|
||||
.gc_timeline(horizon_cutoff, pitr_cutoff, retain_lsns, new_gc_cutoff)
|
||||
.instrument(
|
||||
|
||||
@@ -553,9 +553,12 @@ impl ConnectionManagerState {
|
||||
fn register_timeline_update(&mut self, timeline_update: SafekeeperTimelineInfo) {
|
||||
WALRECEIVER_BROKER_UPDATES.inc();
|
||||
|
||||
self.timeline
|
||||
.standby_horizon
|
||||
.store(Lsn(timeline_update.standby_horizon));
|
||||
if timeline_update.standby_horizon != 0 {
|
||||
// ignore reports from safekeepers mnot connected to replicas
|
||||
self.timeline
|
||||
.standby_horizon
|
||||
.store(Lsn(timeline_update.standby_horizon));
|
||||
}
|
||||
|
||||
let new_safekeeper_id = NodeId(timeline_update.safekeeper_id);
|
||||
let old_entry = self.wal_stream_candidates.insert(
|
||||
|
||||
Reference in New Issue
Block a user