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

irmin-pack: clear LRU when reloading RO #2200

Merged
merged 2 commits into from
Feb 28, 2023
Merged

Conversation

metanivek
Copy link
Member

Currently, when a RO instance calls reload, the LRU is not cleared. We have seen some issues in octez that we think is caused by this behavior. See #2171.

When opening that issue, I originally made the assumption we did not have what we needed to "smartly" clear the LRU for RO instances, but I had an idea upon second consideration. During reload, we only reopen the prefix if the generation changes so we can use that as our signal to clear the LRU. With some refactoring, that is what this PR does.

In order to clear the LRU when reload is called, this is a general refactor to move clearing of the LRU to happen when the prefix is reopened. This covers both a swap after a GC and when reload is called for a RO instance.

I added some new tests to verify the LRU has cleared for both a GC and a reload (and importantly it is not cleared if a GC has not occurred). They are a bit indirect by testing hits to the LRU, but get the job done. Open to other suggestions though!


This PR is to address #2171, but we shouldn't close that issue until this fix is merged to main. The reason this PR is targeted at 3.5 is that we will likely release this as a 3.5.2 release (for downstream octez usage), then we will forward port to main. It is unclear if we will also need to do a 3.6.1 release.

@metanivek metanivek requested a review from art-w February 24, 2023 20:00
In order to clear the LRU when a reload is called, this is a general
refactor to move clearing of the LRU to happen when the prefix is
reopened. This covers both a swap after a GC and when reload is called
for a RO instance.
@metanivek metanivek merged commit 5d394b8 into mirage:3.5 Feb 28, 2023
@metanivek metanivek deleted the ro_purge_lru branch February 28, 2023 18:02
metanivek added a commit to metanivek/opam-repository that referenced this pull request Feb 28, 2023
…ils, irmin-test, irmin-pack, irmin-mirage, irmin-mirage-graphql, irmin-mirage-git, irmin-http, irmin-graphql, irmin-git, irmin-fs, irmin-containers, irmin-cli, irmin-chunk and irmin-bench (3.5.2)

CHANGES:

### Fixed

- **irmin-pack**
  - Clear LRU when calling `reload` after a GC (mirage/irmin#2200, @metanivek)
metanivek added a commit to metanivek/opam-repository that referenced this pull request Mar 7, 2023
…ils, irmin-test, irmin-pack, irmin-mirage, irmin-mirage-graphql, irmin-mirage-git, irmin-http, irmin-graphql, irmin-git, irmin-fs, irmin-containers, irmin-cli, irmin-chunk and irmin-bench (3.6.1)

CHANGES:

### Fixed

- **irmin-pack**
  - Clear LRU when calling `reload` after a GC (mirage/irmin#2200, @metanivek)
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