Skip to content

Commit

Permalink
Correctly update LFC used_pages in case of LFC resize (#10128)
Browse files Browse the repository at this point in the history
## Problem

LFC used_pages statistic is not updated in case of LFC resize (shrinking
`neon.file_cache_size_limit`)

## Summary of changes

Update `lfc_ctl->used_pages` in `lfc_change_limit_hook`

Co-authored-by: Konstantin Knizhnik <[email protected]>
  • Loading branch information
knizhnik and Konstantin Knizhnik authored Dec 13, 2024
1 parent fcff752 commit eeabecd
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pgxn/neon/file_cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,10 @@ lfc_change_limit_hook(int newval, void *extra)
neon_log(LOG, "Failed to punch hole in file: %m");
#endif
/* We remove the old entry, and re-enter a hole to the hash table */
for (int i = 0; i < BLOCKS_PER_CHUNK; i++)
{
lfc_ctl->used_pages -= (victim->bitmap[i >> 5] >> (i & 31)) & 1;
}
hash_search_with_hash_value(lfc_hash, &victim->key, victim->hash, HASH_REMOVE, NULL);

memset(&holetag, 0, sizeof(holetag));
Expand Down

1 comment on commit eeabecd

@github-actions
Copy link

Choose a reason for hiding this comment

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

7095 tests run: 6798 passed, 0 failed, 297 skipped (full report)


Flaky tests (3)

Postgres 17

Postgres 16

Code coverage* (full report)

  • functions: 31.4% (8404 of 26778 functions)
  • lines: 48.1% (66648 of 138650 lines)

* collected from Rust tests only


The comment gets automatically updated with the latest test results
eeabecd at 2024-12-13T18:40:31.415Z :recycle:

Please sign in to comment.