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

feat(pruner): ring #9230

Closed
wants to merge 3 commits into from
Closed

feat(pruner): ring #9230

wants to merge 3 commits into from

Conversation

shekhirin
Copy link
Collaborator

No description provided.

Comment on lines 180 to 199
// Prune static file segments first
for segment in self.static_file_segments() {
let result = self.prune_segment(
provider,
tip_block_number,
limiter,
&*segment,
PrunePurpose::StaticFile,
)?;
match result {
ControlFlow::Continue(output) => {
progress = output.progress;

if output.pruned > 0 {
limiter.increment_deleted_entries_count_by(output.pruned);
pruned += output.pruned;
stats.insert(segment.segment(), (output.progress, output.pruned));
}
}
ControlFlow::LimitReached => break,
Copy link
Member

Choose a reason for hiding this comment

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

static file segments will always be first, that doesn't tackle the problem in a safe way that's tolerant to all kinds of user defined prune configs. for that static files need to be flat with other segments in the ring abstraction.

Comment on lines 219 to 229
match result? {
ControlFlow::Continue(output) => {
progress = output.progress;

if output.pruned > 0 {
limiter.increment_deleted_entries_count_by(output.pruned);
pruned += output.pruned;
stats.insert(segment_name, (output.progress, output.pruned));
}
}
} else {
debug!(target: "pruner", segment = ?segment.segment(), ?purpose, "Nothing to prune for the segment");
ControlFlow::LimitReached => break,
Copy link
Member

Choose a reason for hiding this comment

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

this will loop until time limit reached, even when there are no segments to prune, a waste of resources

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

when the limit is reached, this

if limiter.is_limit_reached() {
return Ok(ControlFlow::LimitReached)
}
will be triggered and we will do break in the match clause you commented on

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

ah wait, you described a different issue, why it will loop if there are no segments?

&*segment,
PrunePurpose::User,
);
pruned_segments.push(segment);
Copy link
Member

Choose a reason for hiding this comment

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

I see the indirection here, this is how you avoid looping until timeout if all segments are empty.

a segment should only be added to pruned if it didn't quit because limit is reached. otherwise can occur that some segment is unfortunate to get the position which tends to time out, just when it started, since we don't prune random ranges on each prune job.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

a segment should only be added to pruned if it didn't quit because limit is reached

then we will prune the segment until completion, no? and it defeats the purpose of the ring

Copy link
Member

Choose a reason for hiding this comment

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

it won't defeat its purpose, ring still ensures all segments are pruned till completion, not only same first few

another safe way would be to start with a random segment each prune job

@emhane emhane added the S-blocked This cannot more forward until something else changes label Jul 3, 2024
@emhane
Copy link
Member

emhane commented Jul 3, 2024

blocked by #8746

@shekhirin shekhirin closed this Jul 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-blocked This cannot more forward until something else changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants