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

Implement partition compaction planner #6469

Merged

Conversation

alexqyle
Copy link
Contributor

@alexqyle alexqyle commented Dec 31, 2024

What this PR does:

PartitionCompactionPlanner is generally similar as ShuffleShardingPlanner. It checks visit marker for the partition is about to be compacted. If the visit marker is legit, PartitionCompactionPlanner would validate all blocks in the partition then pass it onto compaction.

Which issue(s) this PR fixes:
NA

Checklist

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

Signed-off-by: Alex Le <leqiyue@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>
Signed-off-by: Alex Le <leqiyue@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>
Signed-off-by: Alex Le <leqiyue@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>
Signed-off-by: Alex Le <leqiyue@amazon.com>
Signed-off-by: Alex Le <leqiyue@amazon.com>
@CharlieTLe
Copy link
Member

@danielblando, could you help review?

Copy link
Contributor

@danielblando danielblando left a comment

Choose a reason for hiding this comment

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

Sorry for the delay. Forgot to come back to the PR

pkg/compactor/compactor.go Outdated Show resolved Hide resolved
pkg/compactor/partition_compaction_planner.go Outdated Show resolved Hide resolved
pkg/compactor/partition_compaction_planner.go Show resolved Hide resolved
pkg/compactor/partition_compaction_planner.go Show resolved Hide resolved
Signed-off-by: Alex Le <leqiyue@amazon.com>
@@ -174,6 +175,10 @@ func newCompactorMetricsWithLabels(reg prometheus.Registerer, commonLabels []str
Name: "cortex_compactor_group_partition_count",
Help: "Number of partitions for each compaction group.",
}, compactionLabels)
m.compactionsNotPlanned = promauto.With(reg).NewCounterVec(prometheus.CounterOpts{
Name: "cortex_compactor_group_compactions_not_planned",
Help: "Total number of group compaction not planned due to non-critical error (ie. group is currently visited by other compactor).",
Copy link
Contributor

Choose a reason for hiding this comment

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

This metric is a bit confusing to me. Non-critical error... Is it recommended for users to alarm on this metric?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated description and use this metric for not planned case due to error

Signed-off-by: Alex Le <leqiyue@amazon.com>
Signed-off-by: Alex Le <leqiyue@amazon.com>
Copy link
Contributor

@danielblando danielblando left a comment

Choose a reason for hiding this comment

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

Thanks

@danielblando danielblando merged commit 68a2993 into cortexproject:master Jan 14, 2025
17 checks passed
@alexqyle alexqyle deleted the partition-compaction-planner branch January 14, 2025 21:27
alexqyle added a commit to alexqyle/cortex that referenced this pull request Jan 31, 2025
* Implement partition compaction grouper

Signed-off-by: Alex Le <leqiyue@amazon.com>

* fix comment

Signed-off-by: Alex Le <leqiyue@amazon.com>

* replace level 1 compaction limits with ingestion replication factor

Signed-off-by: Alex Le <leqiyue@amazon.com>

* fix doc

Signed-off-by: Alex Le <leqiyue@amazon.com>

* update compaction_visit_marker_timeout default value

Signed-off-by: Alex Le <leqiyue@amazon.com>

* update default value for compactor_partition_index_size_limit_in_bytes

Signed-off-by: Alex Le <leqiyue@amazon.com>

* refactor code

Signed-off-by: Alex Le <leqiyue@amazon.com>

* address comments and refactor

Signed-off-by: Alex Le <leqiyue@amazon.com>

* address comment

Signed-off-by: Alex Le <leqiyue@amazon.com>

* address comment

Signed-off-by: Alex Le <leqiyue@amazon.com>

* update config name

Signed-off-by: Alex Le <leqiyue@amazon.com>

* Implement partition compaction planner

Signed-off-by: Alex Le <leqiyue@amazon.com>

* fix after rebase

Signed-off-by: Alex Le <leqiyue@amazon.com>

* addressed comments

Signed-off-by: Alex Le <leqiyue@amazon.com>

* updated doc and refactored metric

Signed-off-by: Alex Le <leqiyue@amazon.com>

* fix test

Signed-off-by: Alex Le <leqiyue@amazon.com>

---------

Signed-off-by: Alex Le <leqiyue@amazon.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants