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

Check for invalid down link while prefetching B-Tree leave pages for index-only scan #9867

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

knizhnik
Copy link
Contributor

Problem

See #9866

Index-only scan prefetch implementation doesn't take in account that down link may be invalid

Summary of changes

Check that downlink is valid block number

Correspondent Postgres PRs:
neondatabase/postgres#534
neondatabase/postgres#535
neondatabase/postgres#536
neondatabase/postgres#537

@knizhnik knizhnik requested a review from a team as a code owner November 24, 2024 18:56
@bayandin bayandin linked an issue Nov 24, 2024 that may be closed by this pull request
Copy link

github-actions bot commented Nov 24, 2024

5607 tests run: 5370 passed, 1 failed, 236 skipped (full report)


Failures on Postgres 17

# Run all failed tests locally:
scripts/pytest -vv -n $(nproc) -k "test_scrubber_physical_gc_ancestors[debug-pg17-None]"

Test coverage report is not available

The comment gets automatically updated with the latest test results
c8c6902 at 2024-11-25T07:52:43.337Z :recycle:

@hlinnaka
Copy link
Contributor

Please add a test case for this

@MMeent
Copy link
Contributor

MMeent commented Nov 25, 2024

I don't think I understand how a downlink can contain InvalidBlockNumber, could you refer me to code which generates that?

@MMeent
Copy link
Contributor

MMeent commented Nov 25, 2024

I think you have a mistaken understanding of the issue. In the issue you've linked the calculated value for skip is sometimes negative. That's bad, because we use that to read from the prefetch_blocks array, which thus causes out-of-bounds reads in that array, which finally would be the cause for InvalidBlockNumber results from that access.

I think you'll have to fix the skip calculation instead of papering over the invalid results from that skip calculation.

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.

Index prefetch attemtps to prefetch invalid blocks
3 participants