This repository has been archived by the owner on Jan 11, 2024. It is now read-only.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes consensus-shipyard/ipc#180
Implements the
load_snapshot_chunk
ABCI method. It looks for the snapshot requested; if it exists it tries to load it from the disk.Notes
I did not build in any protection against the snapshot not being deleted between the time we find the record in memory and when we try to read it. I don't want to read it inside the STM transaction because that wouldn't guarantee that the pruning task doesn't commit while this one is running, so it's the same from that perspective, but its worse because it can re-read files if the transaction gets retried.
What would solve it if we updated the snapshot item with a timestamp of when it was last requested and did not delete if it was recent, but I'm not sure if it can't be abused.
Another option is to just mark it as being read right now, and update it again to release it when done.
I'm not sure if we tried to read the file while the directory is being deleted, then the delete would leave this and only this file in the directory, and we'd have a partial subnet that would cause problems further down the line. Will have to try.