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

Add Cleaner task to clean completed invocations #1845

Merged
merged 9 commits into from
Aug 16, 2024

Conversation

slinkydeveloper
Copy link
Contributor

Fix #1714, based on #1843

Copy link
Contributor

@tillrohrmann tillrohrmann left a comment

Choose a reason for hiding this comment

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

Thanks a lot for fixing the problem with cleaning up completed invocations @slinkydeveloper. The current solution halves the number of clean up messages needed for invocations that we retain. In the future we might be able to further reduce it by propagating only the time through Bifrost and then let every replica do the scanning themselves.

The changes look good to me. I had a few minor comments. +1 for merging after resolving them and making GHA pass.

crates/storage-api/src/invocation_status_table/mod.rs Outdated Show resolved Hide resolved
crates/storage-api/src/invocation_status_table/mod.rs Outdated Show resolved Hide resolved
crates/storage-api/src/invocation_status_table/mod.rs Outdated Show resolved Hide resolved
crates/worker/src/partition/cleaner.rs Outdated Show resolved Hide resolved
crates/worker/src/partition/cleaner.rs Show resolved Hide resolved
crates/worker/src/partition/cleaner.rs Show resolved Hide resolved
Expanded the data structure StatusTimestamps that tracks changes within the InvocationStatus. Because those timestamps are currently not agreed between replicas, the functions are marked unsafe and should really be used only in cases where those timestamps don't influence the deterministic business logic of the PP. Also only the NeoInvocationStatus stores those fields, the old invocation status will never fill those.

Now CompletedInvocation propagates the `CompletionRetention`. This field is filled with a `Duration::MAX` for the old invocation status, causing the addition to overflow (thus not causing the cleanup in the new cleaner task).

"Time is what the clock says" A. Einstein
Copy link
Contributor

@tillrohrmann tillrohrmann left a comment

Choose a reason for hiding this comment

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

Thanks for updating the PR @slinkydeveloper. The test looks good to me. I had a few minor questions. Please take a look.

crates/worker/src/partition/cleaner.rs Outdated Show resolved Hide resolved
crates/worker/src/partition/cleaner.rs Outdated Show resolved Hide resolved
crates/worker/src/partition/cleaner.rs Outdated Show resolved Hide resolved
crates/worker/src/partition/cleaner.rs Show resolved Hide resolved
crates/worker/src/partition/cleaner.rs Outdated Show resolved Hide resolved
crates/worker/src/partition/cleaner.rs Show resolved Hide resolved
Copy link
Contributor

@tillrohrmann tillrohrmann left a comment

Choose a reason for hiding this comment

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

Thanks for updating the PR @slinkydeveloper. I think the test could be a bit more robust and testing a non-zero retention duration but maybe this is a follow up.

Comment on lines +284 to +285
// By yielding once we let the cleaner task run, and perform the cleanup
tokio::task::yield_now().await;
Copy link
Contributor

Choose a reason for hiding this comment

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

What I don't like about this test is that it depends on the fact that Interval immediately triggers and that the task has been registered when we reach this point. Maybe it is what it is but if we had the clock used by the cleaner under our control, then we could make the test more robust.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think this is ok for the time being

@slinkydeveloper slinkydeveloper merged commit e8cc298 into restatedev:main Aug 16, 2024
8 checks passed
@slinkydeveloper slinkydeveloper deleted the issues/1714 branch August 16, 2024 14:06
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.

Action::ScheduleInvocationStatusCleanup can get lost on recoveries
2 participants