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

Implementing Bucket index sync status file #5446

Merged
merged 4 commits into from
Jul 11, 2023

Conversation

alanprot
Copy link
Member

@alanprot alanprot commented Jul 7, 2023

What this PR does:

This PR introduce a new file to be saved together with the bucket index with the status of the last sync (bucket index update).

The bucket sync status is used on ingesters/queriers/storegateways/compactors to halt any operation for a given tenant if the bucket index could not be updated due CMK errors.

Which issue(s) this PR fixes:
Fixes #

Checklist

  • Tests updated
  • Documentation added
  • CHANGELOG.md updated - the order of entries should be [CHANGE], [FEATURE], [ENHANCEMENT], [BUGFIX]

@alanprot alanprot force-pushed the bucket-index-sync-status branch 2 times, most recently from d8b1794 to a4334c5 Compare July 7, 2023 22:43
@pull-request-size pull-request-size bot added size/XL and removed size/L labels Jul 7, 2023
Signed-off-by: Alan Protasio <[email protected]>
Signed-off-by: Alan Protasio <[email protected]>
@alanprot alanprot marked this pull request as ready for review July 8, 2023 00:08
idxs.Status = bucketindex.CustomerManagedKeyError
// Making the tenant non queryable until 3x the cleanup interval to give time to compactors and storegateways
// to reload the bucket index in case the key access is re-granted
idxs.NonQueryableUntil = time.Now().Add(3 * c.cfg.CleanupInterval).Unix()
Copy link
Member

Choose a reason for hiding this comment

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

Nit: can we extract the magic number 3 to some meaningfully name constant?

Copy link
Member Author

Choose a reason for hiding this comment

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

done

if idxs, err := bucketindex.ReadSyncStatus(ctx, i.TSDBState.bucket, userID, logutil.WithContext(ctx, i.logger)); err == nil {
// Skip blocks shipping if the bucket index failed to sync due to CMK errors.
if idxs.Status == bucketindex.CustomerManagedKeyError {
level.Info(logutil.WithContext(ctx, i.logger)).Log("msg", "skipping shipping blocks due CustomerManagedKeyError", "user", userID)
Copy link
Member

@alvinlin123 alvinlin123 Jul 11, 2023

Choose a reason for hiding this comment

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

Should this be a warn rather than info?

Copy link
Member Author

Choose a reason for hiding this comment

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

done

@alvinlin123
Copy link
Member

looks good to me, thanks!

@alvinlin123 alvinlin123 merged commit 2c37922 into cortexproject:master Jul 11, 2023
qinxx108 pushed a commit to qinxx108/cortex that referenced this pull request Jul 13, 2023
* Implementing Bucket index sync status

Signed-off-by: Alan Protasio <[email protected]>

* fixing bug when returning from cache

Signed-off-by: Alan Protasio <[email protected]>

* Addressing some comments

Signed-off-by: Alan Protasio <[email protected]>

* Changelog

Signed-off-by: Alan Protasio <[email protected]>

---------

Signed-off-by: Alan Protasio <[email protected]>
Signed-off-by: Yijie Qin <[email protected]>
alvinlin123 pushed a commit that referenced this pull request Jul 13, 2023
* Implementing Bucket index sync status file (#5446)

* Implementing Bucket index sync status

Signed-off-by: Alan Protasio <[email protected]>

* fixing bug when returning from cache

Signed-off-by: Alan Protasio <[email protected]>

* Addressing some comments

Signed-off-by: Alan Protasio <[email protected]>

* Changelog

Signed-off-by: Alan Protasio <[email protected]>

---------

Signed-off-by: Alan Protasio <[email protected]>
Signed-off-by: Yijie Qin <[email protected]>

* Implementing multi level index cache (#5451)

Signed-off-by: Yijie Qin <[email protected]>

* remove the user from am state replication key

Signed-off-by: Yijie Qin <[email protected]>

* expose the key label

Signed-off-by: Yijie Qin <[email protected]>

* add Changelog

Signed-off-by: Yijie Qin <[email protected]>

* fix comments

Signed-off-by: Yijie Qin <[email protected]>

* change to use type

Signed-off-by: Yijie Qin <[email protected]>

* address comment

Signed-off-by: Yijie Qin <[email protected]>

* fix comment

Signed-off-by: Yijie Qin <[email protected]>

* use type instead of key

Signed-off-by: Yijie Qin <[email protected]>

---------

Signed-off-by: Alan Protasio <[email protected]>
Signed-off-by: Yijie Qin <[email protected]>
Co-authored-by: Alan Protasio <[email protected]>
@alanprot alanprot deleted the bucket-index-sync-status branch August 16, 2023 21:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants