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

Remember last written LSN when it is first requested #410

Merged
merged 2 commits into from
Apr 10, 2024

Conversation

knizhnik
Copy link

@knizhnik knizhnik commented Apr 8, 2024

See https://neondb.slack.com/archives/C03QLRH7PPD/p1712529369520409

In case of statements CREATE TABLE AS SELECT... or INSERT FROM SELECT... we are fetching data from source table and storing it in destination table. It cause problems with prefetch last-written-lsn is known for the pages of source table
(which for example happens after compute restart). In this case we get get global value of last-written-lsn which is changed frequently as far as we are writing pages of destination table. As a result request-isn for the prefetch and request-let when this page is actually needed are different and we got exported prefetch request. So it actually disarms prefetch.

Proposed simple patch stores last-written LSN for the page when it is not found. So next time we will request last-written LSN for this page, we will get the same value (certainly if the page was not changed).

@knizhnik knizhnik merged commit 261497d into REL_16_STABLE_neon Apr 10, 2024
@knizhnik knizhnik deleted the remember_last_written_lsn_v16 branch April 10, 2024 18:06
tristan957 pushed a commit that referenced this pull request May 10, 2024
* Remember last written LSN when it is first requested

* Return updated LSN in SetLastWrittenLSN

---------

Co-authored-by: Konstantin Knizhnik <knizhnik@neon.tech>
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.

2 participants