-
Notifications
You must be signed in to change notification settings - Fork 232
Support more reliable async task retry to guarantee eventual execution (1/2) – Metastore Layer #1523
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
base: main
Are you sure you want to change the base?
Conversation
I don't understand how this PR enables isolation of task failures. This PR only reads the tasks from the metastore one at a time, so the only failure would be in loading the task. In a transactional database, the The PR description sounds like it intends to tackle task execution failure - is that right? If so, loading the tasks from the database isn't going to solve that problem. |
I think it could, just very lazily right @collado-mike? The next time the service restarts, we could retry any orphaned tasks. |
Sorry for the confusion — we actually have a second PR for this feature. I try to split two parts to make review easier :) This is the draft PR for second phase (still WIP): Regarding this PR’s changes in the metastore, the goal is to allow each task entity to be read and leased individually. This ensures that if an exception occurs while reading or leasing one task, it won’t affect others. This improvement was also noted in the TODO comment of the previous implementation. It’s not strictly required, but maybe a “nice-to-have” one for isolating failures. |
Fix #774
Context
Polaris uses async tasks to perform operations such as table and manifest file cleanup. These tasks are executed asynchronously in a separate thread within the same JVM, and retries are handled inline within the task execution. However, this mechanism does not guarantee eventual execution in the following cases:
Implementation Plan
Stage 1 (this PR):
Introduce per-task transactional leasing in the metastore layer via
loadTasks(...)
. This enables fine-grained compensation by allowing tasks to be leased and updated one at a time, avoiding the all-or-nothing semantics of bulk operations (which is also mentioned in TODO). This is important for retry scenarios, where we want to isolate failures and ensure that tasks are independently retried without affecting each other.Stage 2 (next PR):
Persist failed tasks and introduce a retry mechanism triggered during Polaris startup and via periodic background checks.