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

Introduced lock file to shuffle sharding grouper #4805

Merged

Conversation

alexqyle
Copy link
Contributor

@alexqyle alexqyle commented Jul 28, 2022

What this PR does:

  • Introduced lock file for every blocks are under compaction while using shuffle sharding grouper. The content of lock file is simply a timestamp when the lock file is updated by heart beat process while under compaction. The lock file will make sure blocks are under compaction will not be picked up by other compactor at the same time which fixed Add shuffle-sharding for the compactor #4433 (comment)
  • Grouper will return the first group with all blocks not having a lock file or timestamp inside lock file is more than 5 minutes old. This replaced the logic using group hash to determine which compactor should own which group. After this change, every compactor can compact groups that belong to the tenant assigned to the compactor and the blocks in the group are not locked.
  • Incoming groups are still sorted in the same way that smallest range, oldest min time first. The reason only first group would return is that big tenant compaction would not block compaction for other tenant for a long period of time.

Checklist

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

@alexqyle alexqyle force-pushed the lock-file-for-cortex-compactor branch from 682fd23 to 248eab1 Compare July 28, 2022 01:23
@alexqyle alexqyle marked this pull request as ready for review July 28, 2022 01:28
@pull-request-size pull-request-size bot added size/XL and removed size/L labels Aug 2, 2022
alexqyle and others added 10 commits August 2, 2022 10:43
Signed-off-by: Alex Le <leqiyue@amazon.com>
* let redis cache logs log with context

Signed-off-by: Mengmeng Yang <mengmengyang616@gmail.com>

* fix import

Signed-off-by: Mengmeng Yang <mengmengyang616@gmail.com>
Signed-off-by: Alex Le <leqiyue@amazon.com>
* DoBatch preference to 4xx if error

Signed-off-by: Daniel Blando <ddeluigg@amazon.com>

* Fix comment

Signed-off-by: Daniel Blando <ddeluigg@amazon.com>
Signed-off-by: Alex Le <leqiyue@amazon.com>
Signed-off-by: Alex Le <leqiyue@amazon.com>
Signed-off-by: Alex Le <leqiyue@amazon.com>
… up group that is locked by other compactor

Signed-off-by: Alex Le <leqiyue@amazon.com>
Signed-off-by: Alan Protasio <approtas@amazon.com>
Signed-off-by: Alex Le <leqiyue@amazon.com>
Signed-off-by: Daniel Blando <ddeluigg@amazon.com>
Signed-off-by: Xiaochao Dong (@damnever) <the.xcdong@gmail.com>
Signed-off-by: Alex Le <leqiyue@amazon.com>
…ce in documents (cortexproject#4809)

* Grafana Cloud uses Mimir, for of Cortex, now

Signed-off-by: Alvin Lin <alvinlin123@gmail.com>

* Improve doc

Signed-off-by: Alvin Lin <alvinlin@amazon.com>
Signed-off-by: Alex Le <leqiyue@amazon.com>
@alexqyle alexqyle force-pushed the lock-file-for-cortex-compactor branch from 9089ea3 to d6d9349 Compare August 2, 2022 17:50
Signed-off-by: Alex Le <emoc1989@gmail.com>
pkg/compactor/shuffle_sharding_grouper.go Outdated Show resolved Hide resolved
pkg/compactor/shuffle_sharding_grouper.go Outdated Show resolved Hide resolved
pkg/compactor/shuffle_sharding_grouper.go Outdated Show resolved Hide resolved
pkg/compactor/shuffle_sharding_grouper.go Outdated Show resolved Hide resolved
pkg/compactor/shuffle_sharding_planner.go Outdated Show resolved Hide resolved
…block lock metrics.

Signed-off-by: Alex Le <leqiyue@amazon.com>
pkg/compactor/block_locker.go Outdated Show resolved Hide resolved
pkg/compactor/block_locker.go Outdated Show resolved Hide resolved
pkg/compactor/shuffle_sharding_planner.go Outdated Show resolved Hide resolved
pkg/compactor/shuffle_sharding_grouper.go Outdated Show resolved Hide resolved
alexqyle and others added 3 commits August 4, 2022 15:23
…make sure blocks are locked by current compactor

Signed-off-by: Alex Le <leqiyue@amazon.com>
Signed-off-by: Alex Le <leqiyue@amazon.com>
Signed-off-by: Alex Le <emoc1989@gmail.com>
Signed-off-by: Alan Protasio <approtas@amazon.com>
@alanprot
Copy link
Member

This is amazing overall! Just added a few nits!

Signed-off-by: Alex Le <leqiyue@amazon.com>
Signed-off-by: Alex Le <leqiyue@amazon.com>
Signed-off-by: Alex Le <leqiyue@amazon.com>
@alanprot alanprot merged commit 546d044 into cortexproject:master Sep 3, 2022
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.

7 participants