-
Notifications
You must be signed in to change notification settings - Fork 831
Cleaner would delete bucket index when there is no block in bucket store #6577
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
Conversation
… block in bucket store Signed-off-by: Alex Le <[email protected]>
Signed-off-by: Alex Le <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
return err | ||
if idx.IsEmpty() && len(partials) == 0 { | ||
level.Info(userLogger).Log("msg", "deleting bucket index since it is empty") | ||
if err := bucketindex.DeleteIndex(ctx, c.bucketClient, userID, c.cfgProvider); err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unrelated to this PR. Do we need to handle AccessDenied
error in bucketindex.DeleteIndex
and bucketindex.DeleteIndexSyncStatus
?
I see they only handle object not found
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cortex itself cannot handle AccessDenied
. Once it happens, cleaner should fail the process and enduser should take some action on it.
begin = time.Now() | ||
if err := bucketindex.WriteIndex(ctx, c.bucketClient, userID, c.cfgProvider, idx); err != nil { | ||
return err | ||
if idx.IsEmpty() && len(partials) == 0 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the bucket index is empty but we have partial blocks, we are going to still write the index. Are we waiting for cleaner to clean up partial blocks and eventually we will delete the empty bucket index?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's right. If there are partial blocks, we need cleaner to delete those first. Bucket index file should be deleted if it is the only file in bucket store for a tenant.
Signed-off-by: Alex Le <[email protected]>
What this PR does:
If there is bucket index file but no blocks in bucket store for one user, cleaner would keep running cleaning logic and update empty bucket index for such user. With this PR, cleaner would delete bucket index and its sync status file if there is no block in bucket store to prevent such dangling user exists in bucket store.
Which issue(s) this PR fixes:
Checklist
CHANGELOG.md
updated - the order of entries should be[CHANGE]
,[FEATURE]
,[ENHANCEMENT]
,[BUGFIX]