Skip to content

Conversation

saolyn
Copy link
Contributor

@saolyn saolyn commented Oct 31, 2023

What type of PR is this?

Feature

What does this PR do? Why is it needed?

To best manage and optimize the storage of data we need to be able to efficiently prune the old and unnecessary data. All data beyond the default slot retention period will be removed.

The actual retention policy has been implemented with a 2 epoch buffer such that the blobs are not readable after n epochs and they are pruned / deleted after n+2 epochs.

Which issues(s) does this PR fix?

Fixes #13108

Other notes for review

saolyn and others added 21 commits October 27, 2023 16:16
* Fix block proposals in the REST validator client

* fix graffiti test

* return empty graffiti

* fallback to old endpoints

* logs

* handle 404

* everything passes

* review from James

* log undecoded value

* test fixes and additions

---------

Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
* rearrange deadline

* naming
@saolyn saolyn closed this Oct 31, 2023
@saolyn saolyn reopened this Oct 31, 2023
@saolyn saolyn marked this pull request as ready for review November 5, 2023 09:01
// Prune prunes blobs in the base directory based on the retention epoch.
// It deletes blobs older than currentEpoch - (retentionEpoch+bufferEpochs).
// This is so that we keep a slight buffer and blobs are deleted after n+2 epochs.
func (bs *BlobStorage) Prune(cliCtx *cli.Context, currentSlot primitives.Slot) error {
Copy link
Member

Choose a reason for hiding this comment

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

I still think that having the cli.Context as an argument to the blob storage is a code smell.

If you don't want the caller to figure out the retention slot, can you initialize BlobStorage with the flag value?

if err != nil {
return nil, err
}
return &BlobStorage{fs: fs, retentionSlot: retentionSlot}, nil
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't you store the flag value instead of computing the retention slot? The retention slot will be something like current_slot - slots_to_keep which changes over time as current_slot advances.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch, should be fixed now

@prylabs-bulldozer prylabs-bulldozer bot merged commit f40b858 into develop Dec 5, 2023
@prylabs-bulldozer prylabs-bulldozer bot deleted the blob-filesystem-prune branch December 5, 2023 21:07
@saolyn saolyn mentioned this pull request Dec 12, 2023
4 tasks
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.

Prune Invalid Blob Sidecars from Temporary Storage and Database
5 participants