Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pageserver: work around #9185 in layer visibility calculation #9400

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions pageserver/src/tenant/storage_layer/inmemory_layer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,10 @@ impl InMemoryLayer {
self.end_lsn.get().copied().unwrap_or(Lsn::MAX)
}

pub(crate) fn start_lsn(&self) -> Lsn {
self.start_lsn
}

pub(crate) fn get_lsn_range(&self) -> Range<Lsn> {
self.start_lsn..self.end_lsn_or_max()
}
Expand Down
15 changes: 15 additions & 0 deletions pageserver/src/tenant/timeline/compaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -646,6 +646,21 @@ impl Timeline {
readable_points.push(*child_lsn);
}
readable_points.push(head_lsn);

// The Timeline get page process will walk all InMemoryLayers before it starts walking historic
// layers. That means it might fail to see image layers that overlap with the LSN range of
// InMemoryLayers, so there is a de-facto read point at the start_lsn of the oldest InMemoryLayer.
//
// This behavior in the getpage path is considered a but, and including InMemoryLayer's start_lsn here
// is a workaround. See https://github.com/neondatabase/neon/issues/9185
if let Some(oldest_inmemory_layer) = layer_map.frozen_layers.front() {
readable_points.push(oldest_inmemory_layer.start_lsn())
} else if let Some(open_layer) = layer_map.open_layer.as_ref() {
readable_points.push(open_layer.start_lsn());
}

readable_points.sort();

readable_points
};

Expand Down
Loading