pageserver: work around #9185 in layer visibility calculation #9400
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
The layer visibility logic considers a layer visible if serving a read from the head LSN or a branch point would hit the layer. It presumes that an image layer is sufficient to prevent reads reaching a delta.
However, getpage logic doesn't quite match this expectation, and will sometimes read deltas even if an image layer is available: #9185
Closes: #9058
Summary of changes
update_layer_visibility
, use the start_lsn of the oldest InMemoryLayer as a read point, so that we will continue to regard delta layers as visible until they are covered by an image layer and that image layer doesn't intersect with an InMemoryLayer's LSN range.Because we only call update_layer_visibility after generating image layers or at tenant load, this means that such deltas will remain "visible" until the next time one of those things happens. This degrades the effectiveness of the layer visibility contribution to eviction and heatmap generation, but relieves us of the volume of misleading "became visible" log messages (#9058)
This code should be removed when #9185 is fixed.
Checklist before requesting a review
Checklist before merging