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

Maintain number of used pages for LFC #9088

Merged
merged 1 commit into from
Sep 23, 2024
Merged

Maintain number of used pages for LFC #9088

merged 1 commit into from
Sep 23, 2024

Conversation

knizhnik
Copy link
Contributor

Problem

LFC cache entry is chunk (right now size of chunk is 1Mb). LFC statistics shows number of chunks, but not number of used pages. And autoscaling team wants to know how sparse LFC is:
https://neondb.slack.com/archives/C04DGM6SMTM/p1726782793595969
It is possible to obtain it from the view select count(*) from local_cache.
Nut it is expensive operation, enumerating all entries in LFC under lock.

Summary of changes

This PR added "file_cache_used_pages" to neon_lfc_stats view:

 select * from neon_lfc_stats;
        lfc_key        | lfc_value 
-----------------------+-----------
 file_cache_misses     |   3139029
 file_cache_hits       |   4098394
 file_cache_used       |      1024
 file_cache_writes     |   3173728
 file_cache_size       |      1024
 file_cache_used_pages |     25689
(6 rows)

Please notice that this PR doesn't change neon extension API, so no need to create new version of Neon extension.

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

@knizhnik knizhnik requested review from a team as code owners September 21, 2024 12:09
Copy link

github-actions bot commented Sep 21, 2024

4977 tests run: 4813 passed, 0 failed, 164 skipped (full report)


Flaky tests (5)

Postgres 17

Postgres 16

Postgres 14

Code coverage* (full report)

  • functions: 32.1% (7447 of 23213 functions)
  • lines: 49.9% (59953 of 120174 lines)

* collected from Rust tests only


The comment gets automatically updated with the latest test results
93b4f50 at 2024-09-23T18:52:41.935Z :recycle:

@knizhnik knizhnik merged commit 1c5d6e5 into main Sep 23, 2024
152 checks passed
@knizhnik knizhnik deleted the lfc_used_pages branch September 23, 2024 19:05
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