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: fix vectored read path delta layer index traversal #7001

Merged
merged 7 commits into from
Mar 5, 2024

Conversation

VladLazar
Copy link
Contributor

@VladLazar VladLazar commented Mar 4, 2024

Problem

Last weeks enablement of vectored get generated a number of panics.
From them, I diagnosed two issues in the delta layer index traversal logic

  1. The key >= range.start && lsn >= lsn_range.start
    was too aggressive. Lsns are not monotonically increasing in the delta
    layer index (keys are though), so we cannot assert on them.
  2. Lsns greater or equal to lsn_range.end were not skipped. This
    caused the query to consider records newer than the request Lsn.

Summary of changes

  • Fix the issues mentioned above inline
  • Refactor the layer traversal logic to make it unit testable
  • Add unit test which reproduces the failure modes listed above.

Reviewing

I've applied the fixes before doing the refactoring and adding the new test,
so it might be easier to go by commit.

Closes #6978

Checklist before requesting a review

  • I have performed a self-review of my code.
  • If it is a core feature, I have added thorough tests.
  • Do we need to implement analytics? if so did you add the relevant metrics to the dashboard?
  • If this PR requires public announcement, mark it with /release-notes label and add several sentences in this section.

Checklist before merging

  • Do not forget to reformat commit message to not include the above checklist

There were two issues with it.
1. The `key >= range.start && lsn >= lsn_range.start`
was too aggressive. Lsns are not monotonically increasing in the delta
layer index (keys are though), so we cannot assert on them.
2. Lsns greater or equal to `lsn_range.end` were not skipped. This
caused the query to consider records newer than the request Lsn.
@VladLazar VladLazar changed the title Vlad/vectored get fixes pageserver: fix vectored read path delta layer index traversal Mar 4, 2024
Copy link

github-actions bot commented Mar 4, 2024

2484 tests run: 2361 passed, 0 failed, 123 skipped (full report)


Flaky tests (2)

Postgres 15

  • test_secondary_downloads: release
  • test_vm_bit_clear_on_heap_lock: debug

Code coverage* (full report)

  • functions: 28.8% (6969 of 24209 functions)
  • lines: 47.4% (42795 of 90373 lines)

* collected from Rust tests only


The comment gets automatically updated with the latest test results
9036ded at 2024-03-05T12:17:23.029Z :recycle:

@VladLazar VladLazar marked this pull request as ready for review March 4, 2024 13:58
@VladLazar VladLazar requested a review from a team as a code owner March 4, 2024 13:58
Copy link
Member

@koivunej koivunej left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some comments before I forget to post them, I don't see anything critical.

pageserver/src/tenant/disk_btree.rs Show resolved Hide resolved
pageserver/src/tenant/disk_btree.rs Show resolved Hide resolved
pageserver/src/tenant/storage_layer/delta_layer.rs Outdated Show resolved Hide resolved
pageserver/src/tenant/storage_layer/image_layer.rs Outdated Show resolved Hide resolved
pageserver/src/tenant/storage_layer/image_layer.rs Outdated Show resolved Hide resolved
pageserver/src/tenant/storage_layer/delta_layer.rs Outdated Show resolved Hide resolved
pageserver/src/tenant/storage_layer/delta_layer.rs Outdated Show resolved Hide resolved
pageserver/src/tenant/storage_layer/delta_layer.rs Outdated Show resolved Hide resolved
pageserver/src/tenant/storage_layer/delta_layer.rs Outdated Show resolved Hide resolved
Copy link
Contributor

@problame problame left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, a stream!

And a nice test, love it!

pageserver/src/tenant/storage_layer/image_layer.rs Outdated Show resolved Hide resolved
pageserver/src/tenant/storage_layer/image_layer.rs Outdated Show resolved Hide resolved
pageserver/src/tenant/storage_layer/delta_layer.rs Outdated Show resolved Hide resolved
pageserver/src/tenant/storage_layer/delta_layer.rs Outdated Show resolved Hide resolved
@VladLazar VladLazar merged commit 9dec65b into main Mar 5, 2024
53 checks passed
@VladLazar VladLazar deleted the vlad/vectored-get-fixes branch March 5, 2024 13:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Image mismatch for key assertion
3 participants