Pass unique context and cancel func to worker during compaction#8588
Pass unique context and cancel func to worker during compaction#8588anna-tran wants to merge 2 commits intothanos-io:mainfrom
Conversation
Signed-off-by: Anna Tran <trananna@amazon.com>
Signed-off-by: Anna Tran <trananna@amazon.com>
0782fdf to
3030034
Compare
GiedriusS
left a comment
There was a problem hiding this comment.
Why cannot whoever calls Plan() cancel the context when they need to cancel it?
This is also an option. We could make a new error |
Signed-off-by: Anna Tran <trananna@amazon.com>
bc1ed66 to
6543a18
Compare
GiedriusS
left a comment
There was a problem hiding this comment.
Could you show changes on the Cortex side? I don't get why we need to pass the cancel function.
|
I added a comment regarding how this would work in Cortex, and will update that with proposed code changes. |
6543a18 to
7591b1a
Compare
Signed-off-by: Anna Tran <trananna@amazon.com>
7591b1a to
f9c9564
Compare
Signed-off-by: Anna Tran <trananna@amazon.com>
Changes
This PR creates a new context for each compaction worker and also passes the cancel function for that worker's context. It introduces a new monitoring function in the lifecycle callback that allows implementations of the lifecycle to cancel the context if there is any issue with the compaction plan/process while the compaction is underway.
This allows a single compaction to be aborted/failed in case of an issue in the planning phase, and only affect that single compaction job.
The change will help to address this issue in Cortex: cortexproject/cortex#7135
Verification
make buildruns successfully.