Compactor scheduler: cleanup executor#14629
Merged
andyasp merged 7 commits intofeature/compactor-schedulerfrom Mar 11, 2026
Merged
Compactor scheduler: cleanup executor#14629andyasp merged 7 commits intofeature/compactor-schedulerfrom
andyasp merged 7 commits intofeature/compactor-schedulerfrom
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Autofix Details
Bugbot Autofix prepared a fix for the issue found in the latest run.
- ✅ Fixed: Unused
compactorCfgfield onschedulerExecutorstruct- Removed the unused
compactorCfgfield fromschedulerExecutorand its redundant initialization to eliminate dead code.
- Removed the unused
Or push these changes by commenting:
@cursor push fe83948996
Preview (fe83948996)
diff --git a/pkg/compactor/executor.go b/pkg/compactor/executor.go
--- a/pkg/compactor/executor.go
+++ b/pkg/compactor/executor.go
@@ -139,7 +139,6 @@
// schedulerExecutor requests compaction jobs from an external scheduler.
type schedulerExecutor struct {
- compactorCfg Config
cfg SchedulerClientConfig
logger log.Logger
schedulerClient compactorschedulerpb.CompactorSchedulerClient
@@ -151,7 +150,6 @@
func newSchedulerExecutor(cfg Config, logger log.Logger, invalidClusterValidation *prometheus.CounterVec) (*schedulerExecutor, error) {
executor := &schedulerExecutor{
- compactorCfg: cfg,
cfg: cfg.SchedulerClientConfig,
logger: logger,
invalidClusterValidation: invalidClusterValidation,
Contributor
|
💻 Deploy preview deleted (Compactor scheduler: cleanup executor). |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix prepared a fix for the issue found in the latest run.
- ✅ Fixed: Error message references wrong flag names
- Updated the scheduler endpoint validation error text to reference the actual flags
compactor.scheduler-client.endpointandcompactor.scheduler-client.enabled.
- Updated the scheduler endpoint validation error text to reference the actual flags
Or push these changes by commenting:
@cursor push 97d56fef3b
Preview (97d56fef3b)
diff --git a/pkg/compactor/executor.go b/pkg/compactor/executor.go
--- a/pkg/compactor/executor.go
+++ b/pkg/compactor/executor.go
@@ -79,7 +79,7 @@
}
var (
- errInvalidSchedulerEndpoint = fmt.Errorf("invalid compactor.scheduler-client.scheduler-endpoint, required when scheduler-worker.enabled is true")
+ errInvalidSchedulerEndpoint = fmt.Errorf("invalid compactor.scheduler-client.endpoint, required when compactor.scheduler-client.enabled is true")
errInvalidSchedulerUpdateInterval = fmt.Errorf("invalid compactor.scheduler-client.update-interval, interval must be positive")
errInvalidSchedulerLeasingMinBackoff = fmt.Errorf("invalid compactor.scheduler-client.leasing-min-backoff, must be positive")
errInvalidSchedulerLeasingMaxBackoff = fmt.Errorf("invalid compactor.scheduler-client.leasing-max-backoff, must be greater than min backoff")
npazosmendez
approved these changes
Mar 11, 2026
pkg/compactor/executor.go
Outdated
Comment on lines
+499
to
+503
| // Note: The syncer isn't used in single job execution (only during full BucketCompactor.Compact), but we construct it rather than pass nil to guard against future changes | ||
| syncer, err := newMetaSyncer(userLogger, reg, userBucket, fetcher, NewShardAwareDeduplicateFilter(), c.blocksMarkedForDeletion) | ||
| if err != nil { | ||
| return compactorschedulerpb.UPDATE_TYPE_REASSIGN, errors.Wrap(err, "failed to create syncer") | ||
| } |
Contributor
There was a problem hiding this comment.
What if BucketCompactor.Compact took the syncer as an argument instead? I feel like I'm missing something
Contributor
Author
There was a problem hiding this comment.
Oh wow, that works and removes that entirely now. Thanks!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

What this PR does
I was originally preparing a PR to merge executor code into
main, but kept finding issues so this is a cleanup PR for the feature branch.ExecutorRetryMinBackoffandExecutorRetryMaxBackoffwere only used for backing off on updates. Renamed and added validation that was missing for them.BucketCompactorthe syncer (c.sy) was nearly only used inCompact(which compacts for all users) so I was considering passingnilfor it instead of constructing one when executing single compaction jobs. There was one odd usage that used it for a metric. That usage was unnecessary though becausec.sy.metrics.blocksMarkedForDeletionis the exact sameCounterasc.metrics.blocksMarkedForDeletion, so I removed a layer of the indirection. I didn't end up usingnilfor the syncer for safety against refactors, but kept this change.syncDirwas being set in the metadata fetcher (which it callscacheDir) which caches metadata on disk. We don't want to use that in the scheduler mode because any compactor can work on any user so it's far less effective. The plan is to introduce remote cache handling later.metaSyncerto retrieve block metadata specified by an addedblockIDsargument, but it was a poor fit. It mismatched the other "full sync + filter" usage and adding an argument broke the semantics of MetaFetcher'sfetchsingleflight usage (I thinkexcludeMarkedForDeletionmay also be a bug, but I'll verify that later):To fix this I changed it to use
MetaFetcherdirectly and rewroteFetchRequestedMetasto callloadMetaon its own. There is still a useless to us in-memory cache check thatloadMetadoes, but that may be the place where we can put in future remote cache changes so I let it slide here.Which issue(s) this PR fixes or relates to
Checklist
CHANGELOG.mdupdated - the order of entries should be[CHANGE],[FEATURE],[ENHANCEMENT],[BUGFIX]. If changelog entry is not needed, please add thechangelog-not-neededlabel to the PR.about-versioning.mdupdated with experimental features.Note
Medium Risk
Touches compactor scheduling/metadata-fetch paths and renames scheduler-related flags, which could break existing scheduler-mode deployments or alter job execution behavior; changes are mostly refactors but affect runtime configuration and control flow.
Overview
Refactors compactor scheduler mode by moving all scheduler client settings into a new
SchedulerClientConfig(compactor.scheduler-client.*flags), adding stricter validation/backoff options, and updating the compactor to switch modes based onscheduler-client.enabled.Simplifies
BucketCompactorby no longer storing ametaSynceron the struct (it’s now passed intoCompact), removes the unusedSyncRequestedMetaspath, and updates scheduler job execution to fetch requested block metas directly viaMetaFetcher.FetchRequestedMetas(with filters applied) instead of reusing the full-sync singleflight path.Updates generated config/help/docs/defaults to drop the old
planning_mode/compactor.scheduler.*/executor retry flags and to point cluster-validation wiring at the new scheduler client gRPC config.Written by Cursor Bugbot for commit 1e34584. This will update automatically on new commits. Configure here.