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

Refactor updating relation size cache on reads #7376

Merged
merged 1 commit into from
Apr 22, 2024
Merged

Conversation

hlinnaka
Copy link
Contributor

Instead of trusting that a request with latest == true means that the request LSN was at least last_record_lsn, remember explicitly when the relation cache was initialized.

Incidentally, this allows updating the relation size cache also on reads from read-only endpoints, when the endpoint is at a relatively recent LSN (more recent than the end of the timeline when the timeline was loaded in the pageserver).

Add a comment to wait_or_get_last_lsn() that it might be better to use an older LSN when possible. Note that doing that would be unsafe, without the relation cache changes in this commit!

@hlinnaka hlinnaka mentioned this pull request Apr 14, 2024
5 tasks
@hlinnaka
Copy link
Contributor Author

Alternatively, we could just stop updating the cache on reads. I don't believe it's significant to performance. Computes also cache relation sizes.

Copy link

github-actions bot commented Apr 14, 2024

2766 tests run: 2648 passed, 0 failed, 118 skipped (full report)


Code coverage* (full report)

  • functions: 28.1% (6461 of 23019 functions)
  • lines: 46.8% (45585 of 97396 lines)

* collected from Rust tests only


The comment gets automatically updated with the latest test results
ecb7801 at 2024-04-22T08:42:34.393Z :recycle:

@hlinnaka hlinnaka marked this pull request as ready for review April 18, 2024 21:13
@hlinnaka hlinnaka requested a review from a team as a code owner April 18, 2024 21:13
@hlinnaka hlinnaka requested a review from arpad-m April 18, 2024 21:13
@hlinnaka hlinnaka force-pushed the rel_size_cache-update branch 2 times, most recently from 6873f33 to 3c4d5b8 Compare April 18, 2024 21:27
@hlinnaka hlinnaka requested a review from VladLazar April 18, 2024 22:06
Copy link
Contributor

@VladLazar VladLazar left a comment

Choose a reason for hiding this comment

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

The change looks good to me. My only slight concern is about the cache being unbounded, but that was the case before as well.

pageserver/src/tenant/timeline.rs Show resolved Hide resolved
Instead of trusting that a request with latest == true means that the
request LSN was at least last_record_lsn, remember explicitly when the
relation cache was initialized.

Incidentally, this allows updating the relation size cache also on
reads from read-only endpoints, when the endpoint is at a relatively
recent LSN (more recent than the end of the timeline when the timeline
was loaded in the pageserver).

Add a comment to wait_or_get_last_lsn() that it might be better to use
an older LSN when possible. Note that doing that would be unsafe,
without the relation cache changes in this commit!
@hlinnaka hlinnaka merged commit e69ff3f into main Apr 22, 2024
52 of 53 checks passed
@hlinnaka hlinnaka deleted the rel_size_cache-update branch April 22, 2024 16:40
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