Skip to content

Commit 0e1afae

Browse files
authored
Compactor: let an in-flight compaction finish on shutdown (#7973)
* Compactor: let an in-flight compaction finish on shutdown Add -compactor.compaction-drain-timeout. When set, shutdown no longer cancels a compaction that is already running. Compactions run under a context detached from the service context, cancelled once the drain timeout has passed after shutdown is requested. The compactor stops picking up further tenants as soon as shutdown is requested. Thanos's BucketCompactor keeps taking groups off its queue and repeats whole compaction passes until no work is left, and only sees cancellation through the calls it makes. A detached context alone would therefore keep compacting the tenant's backlog until the timeout cut it mid-merge. Two gates stop that. The planner returns an empty plan for every group not yet planned when shutdown is requested, which thanos treats as a group with nothing to do. The grouper returns no groups on later passes. Under the partitioning strategy, building a group writes a visit marker claiming its partition, so without the grouper gate a draining compactor would claim partitions it never compacts and other compactors would skip them until the marker timed out. Defaults to 0, which keeps the current behaviour of cancelling the running compaction immediately. Signed-off-by: Alex Le <leqiyue@amazon.com> * Compactor: reference the PR number in the CHANGELOG entry Signed-off-by: Alex Le <leqiyue@amazon.com> * Compactor: use go.uber.org/atomic in the shutdown drain tests Signed-off-by: Alex Le <leqiyue@amazon.com> * Compactor: build the TSDB compactor and bucket client with the drain context The TSDB compactor keeps the context it is built with and checks it while merging, so building it in starting() with the service context aborted the merge at shutdown even with a drain timeout set. Only the block download and upload, which use the context thanos passes down, were protected. Create the drain context in starting() and pass it to both the blocks compactor factory and the bucket client factory. The GCS bucket client builds its token source with that context, and for credential types other than service account keys a token refresh sends its request with it, so a refresh during the drain would otherwise fail. The test mock now records the context its factory was given, so a test can assert the merge context survives shutdown. Signed-off-by: Alex Le <leqiyue@amazon.com> * Compactor: stay in the ring and stop retrying while draining The ring subservices were started with the service context, so the lifecycler left the ring as soon as shutdown started, while the compaction was still draining. With the default sharding strategy, which has no visit markers, another compactor then took over the tenant and compacted the same blocks. Start them with the compaction context instead. stopping() already stops them explicitly, so the instance now leaves the ring once the drain ends. A compaction that failed with a retriable error during the drain was retried on the compaction context. The retry built no groups because of the shutdown gate and returned nil, so the failure was reported as a success. Stop retrying once shutdown has been requested and handle the last error as when retries run out. Signed-off-by: Alex Le <leqiyue@amazon.com> --------- Signed-off-by: Alex Le <leqiyue@amazon.com>
1 parent 82f1538 commit 0e1afae

7 files changed

Lines changed: 589 additions & 23 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
* [FEATURE] Distributor: Add experimental OTLP metrics ingestion over gRPC (`opentelemetry.proto.collector.metrics.v1.MetricsService/Export`) on the gRPC server port. Enable it with `-distributor.otlp.grpc-enabled`. The tenant is read from the `X-Scope-OrgID` gRPC metadata, and the request size is limited by `-server.grpc-max-recv-msg-size-bytes`. #7873
99
* [FEATURE] Storage: Add support for Alibaba Cloud OSS as a backend for blocks, ruler, and alertmanager storage. Configured via `-<prefix>.oss.*` flags with `backend: oss`. #7907
1010
* [ENHANCEMENT] Compactor: Add `-compactor.block-ranges-compaction-delay` to configure the compaction group graceful period per `-compactor.block-ranges` entry, matched by position. A larger block range can now be held back until its sub-ranges have settled, instead of every range sharing one period derived from `-compactor.cleanup-interval`. Leaving it empty, and any range without an entry, keeps the current behaviour of twice `-compactor.cleanup-interval`. The delay is a lower bound: groups only become eligible on a compaction run, so the effective wait can be up to `-compactor.compaction-interval` longer. Only used by the partitioning compaction strategy. #7916
11+
* [ENHANCEMENT] Compactor: Add `-compactor.compaction-drain-timeout`. When set, a compaction that is already running when shutdown is requested is allowed to finish, for up to this duration, instead of being cancelled. The compactor stops planning new compaction groups and stops picking up further tenants as soon as shutdown is requested. Defaults to 0, which cancels the running compaction immediately and discards the work it has done so far. #7973
1112
* [ENHANCEMENT] Ring: Add the `cortex_ring_member_zonal_ownership_percent{name, member, zone}` metric, reporting the fraction of its own zone's token space owned by each ring member. With zone-aware replication a write is routed within a single zone, so the existing `cortex_ring_member_ownership_percent`, which is computed over the merged token list of all zones, does not reflect the hash range a member actually serves. Reported when ring detailed metrics and zone awareness are both enabled. #7910
1213
* [ENHANCEMENT] Ingester: Add experimental `-ingester.use-ring-ownership-for-limits` (requires zone-aware replication). It converts global series and metadata limits to per-ingester limits using the ingester's actual share of each tenant's hash space within its zone, instead of an equal share, which throttles tenants early on an unbalanced ring. Shares ignore `-distributor.extend-writes`, so a tenant can be throttled early while an instance is JOINING, LEAVING or PENDING. Exposes `cortex_ingester_ring_ownership_share{user}` and `cortex_ingester_ring_ownership_computations_total`. #7954 #7961
1314
* [ENHANCEMENT] Distributor: Support partial write for Prometheus Remote Write 2.0 requests. Invalid series are now skipped and reported together in the `400` response instead of rejecting the whole batch, the valid ones are written, and the `X-Prometheus-Remote-Write-*-Written` response headers are set even when a `400` is returned. #7761

‎docs/blocks-storage/compactor.md‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,17 @@ compactor:
144144
# CLI flag: -compactor.compaction-concurrency
145145
[compaction_concurrency: <int> | default = 1]
146146

147+
# How long to let a compaction that is already running finish once shutdown
148+
# has been requested, before cancelling it. As soon as shutdown is requested
149+
# the compactor stops planning new compaction groups and stops picking up
150+
# further tenants, regardless of this setting. 0 cancels the running
151+
# compaction immediately, discarding the work it has done so far. A compaction
152+
# is only allowed to finish if the process is given at least this long to
153+
# terminate, so this value should be below the deployment's termination grace
154+
# period.
155+
# CLI flag: -compactor.compaction-drain-timeout
156+
[compaction_drain_timeout: <duration> | default = 0s]
157+
147158
# How frequently compactor should run blocks cleanup and maintenance, as well
148159
# as update the bucket index.
149160
# CLI flag: -compactor.cleanup-interval

‎docs/configuration/config-file-reference.md‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3146,6 +3146,16 @@ The `compactor_config` configures the compactor for the blocks storage.
31463146
# CLI flag: -compactor.compaction-concurrency
31473147
[compaction_concurrency: <int> | default = 1]
31483148
3149+
# How long to let a compaction that is already running finish once shutdown has
3150+
# been requested, before cancelling it. As soon as shutdown is requested the
3151+
# compactor stops planning new compaction groups and stops picking up further
3152+
# tenants, regardless of this setting. 0 cancels the running compaction
3153+
# immediately, discarding the work it has done so far. A compaction is only
3154+
# allowed to finish if the process is given at least this long to terminate, so
3155+
# this value should be below the deployment's termination grace period.
3156+
# CLI flag: -compactor.compaction-drain-timeout
3157+
[compaction_drain_timeout: <duration> | default = 0s]
3158+
31493159
# How frequently compactor should run blocks cleanup and maintenance, as well as
31503160
# update the bucket index.
31513161
# CLI flag: -compactor.cleanup-interval

‎pkg/compactor/compactor.go‎

Lines changed: 99 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ var (
6060
supportedShardingStrategies = []string{util.ShardingStrategyDefault, util.ShardingStrategyShuffle}
6161
errInvalidShardingStrategy = errors.New("invalid sharding strategy")
6262
errInvalidBlockMergeFanIn = errors.New("invalid block merge fan-in, the value must not be negative")
63+
errInvalidCompactionDrainTimeout = errors.New("invalid compaction drain timeout, the value must not be negative")
6364
errInvalidTenantShardSize = errors.New("invalid tenant shard size, the value must be greater than 0")
6465
supportedCompactionStrategies = []string{util.CompactionStrategyDefault, util.CompactionStrategyPartitioning}
6566
errInvalidCompactionStrategy = errors.New("invalid compaction strategy")
@@ -269,6 +270,7 @@ type Config struct {
269270
CompactionInterval time.Duration `yaml:"compaction_interval"`
270271
CompactionRetries int `yaml:"compaction_retries"`
271272
CompactionConcurrency int `yaml:"compaction_concurrency"`
273+
CompactionDrainTimeout time.Duration `yaml:"compaction_drain_timeout"`
272274
CleanupInterval time.Duration `yaml:"cleanup_interval"`
273275
CleanupConcurrency int `yaml:"cleanup_concurrency"`
274276
DeletionDelay time.Duration `yaml:"deletion_delay"`
@@ -333,6 +335,7 @@ func (cfg *Config) RegisterFlags(f *flag.FlagSet) {
333335
f.DurationVar(&cfg.CompactionInterval, "compactor.compaction-interval", time.Hour, "The frequency at which the compaction runs")
334336
f.IntVar(&cfg.CompactionRetries, "compactor.compaction-retries", 3, "How many times to retry a failed compaction within a single compaction run.")
335337
f.IntVar(&cfg.CompactionConcurrency, "compactor.compaction-concurrency", 1, "Max number of concurrent compactions running.")
338+
f.DurationVar(&cfg.CompactionDrainTimeout, "compactor.compaction-drain-timeout", 0, "How long to let a compaction that is already running finish once shutdown has been requested, before cancelling it. As soon as shutdown is requested the compactor stops planning new compaction groups and stops picking up further tenants, regardless of this setting. 0 cancels the running compaction immediately, discarding the work it has done so far. A compaction is only allowed to finish if the process is given at least this long to terminate, so this value should be below the deployment's termination grace period.")
336339
f.DurationVar(&cfg.CleanupInterval, "compactor.cleanup-interval", 15*time.Minute, "How frequently compactor should run blocks cleanup and maintenance, as well as update the bucket index.")
337340
f.IntVar(&cfg.CleanupConcurrency, "compactor.cleanup-concurrency", 20, "Max number of tenants for which blocks cleanup and maintenance should run concurrently.")
338341
f.BoolVar(&cfg.ShardingEnabled, "compactor.sharding-enabled", false, "Shard tenants across multiple compactor instances. Sharding is required if you run multiple compactor instances, in order to coordinate compactions and avoid race conditions leading to the same tenant blocks simultaneously compacted by different instances.")
@@ -391,6 +394,10 @@ func (cfg *Config) Validate(limits validation.Limits) error {
391394
return errInvalidBlockMergeFanIn
392395
}
393396

397+
if cfg.CompactionDrainTimeout < 0 {
398+
return errInvalidCompactionDrainTimeout
399+
}
400+
394401
// Make sure a valid sharding strategy is being used
395402
if !slices.Contains(supportedShardingStrategies, cfg.ShardingStrategy) {
396403
return errInvalidShardingStrategy
@@ -459,6 +466,9 @@ type Compactor struct {
459466
// Client used to run operations on the bucket storing blocks.
460467
bucketClient objstore.InstrumentedBucket
461468

469+
compactionCtx context.Context
470+
cancelCompaction context.CancelFunc
471+
462472
// Ring used for sharding compactions.
463473
ringLifecycler *ring.Lifecycler
464474
ring *ring.Ring
@@ -657,23 +667,30 @@ func newCompactor(
657667
}
658668

659669
// Start the compactor.
660-
func (c *Compactor) starting(ctx context.Context) error {
670+
func (c *Compactor) starting(ctx context.Context) (err error) {
661671
begin := time.Now()
662672
defer func() {
663673
c.CompactorStartDurationSeconds.Set(time.Since(begin).Seconds())
664674
level.Info(c.logger).Log("msg", "compactor started", "duration", time.Since(begin), "duration_ms", time.Since(begin).Milliseconds())
665675
}()
666676

667-
var err error
677+
// The TSDB compactor, the GCS token source and the ring lifecycler keep the
678+
// context they are started with, so all three use the compaction context.
679+
c.compactionCtx, c.cancelCompaction = compactionContext(ctx, c.compactorCfg.CompactionDrainTimeout)
680+
defer func() {
681+
if err != nil {
682+
c.cancelCompaction()
683+
}
684+
}()
668685

669686
// Create bucket client.
670-
c.bucketClient, err = c.bucketClientFactory(ctx)
687+
c.bucketClient, err = c.bucketClientFactory(c.compactionCtx)
671688
if err != nil {
672689
return errors.Wrap(err, "failed to create bucket client")
673690
}
674691

675692
// Create blocks compactor dependencies.
676-
c.blocksCompactor, c.blocksPlannerFactory, err = c.blocksCompactorFactory(ctx, c.compactorCfg, c.logger, c.registerer)
693+
c.blocksCompactor, c.blocksPlannerFactory, err = c.blocksCompactorFactory(c.compactionCtx, c.compactorCfg, c.logger, c.registerer)
677694
if err != nil {
678695
return errors.Wrap(err, "failed to initialize compactor dependencies")
679696
}
@@ -728,7 +745,7 @@ func (c *Compactor) starting(ctx context.Context) error {
728745
c.ringSubservicesWatcher = services.NewFailureWatcher()
729746
c.ringSubservicesWatcher.WatchManager(c.ringSubservices)
730747

731-
err = services.StartManagerAndAwaitHealthy(ctx, c.ringSubservices)
748+
err = services.StartManagerAndAwaitHealthy(c.compactionCtx, c.ringSubservices)
732749
}
733750

734751
if err != nil {
@@ -800,6 +817,7 @@ func (c *Compactor) stopping(_ error) error {
800817
defer func() {
801818
level.Info(c.logger).Log("msg", "compactor stopped", "duration", time.Since(begin), "duration_ms", time.Since(begin).Milliseconds())
802819
}()
820+
defer c.cancelCompaction()
803821

804822
ctx := context.Background()
805823

@@ -810,6 +828,29 @@ func (c *Compactor) stopping(_ error) error {
810828
return nil
811829
}
812830

831+
// compactionContext detaches from ctx so an in-flight compaction can finish
832+
// after shutdown, for up to drainTimeout. Zero returns ctx itself.
833+
func compactionContext(ctx context.Context, drainTimeout time.Duration) (context.Context, context.CancelFunc) {
834+
if drainTimeout <= 0 {
835+
return ctx, func() {}
836+
}
837+
838+
compactionCtx, cancel := context.WithCancel(context.WithoutCancel(ctx))
839+
go func() {
840+
select {
841+
case <-ctx.Done():
842+
select {
843+
case <-time.After(drainTimeout):
844+
case <-compactionCtx.Done():
845+
}
846+
case <-compactionCtx.Done():
847+
}
848+
cancel()
849+
}()
850+
851+
return compactionCtx, cancel
852+
}
853+
813854
func (c *Compactor) running(ctx context.Context) error {
814855
// Ensure an initial cleanup occurred as first thing when running compactor.
815856
if err := services.StartAndAwaitRunning(ctx, c.blocksCleaner); err != nil {
@@ -828,7 +869,7 @@ func (c *Compactor) running(ctx context.Context) error {
828869
return ctx.Err()
829870
case <-time.After(time.Duration(rand.Int63n(int64(float64(c.compactorCfg.CompactionInterval) * 0.1)))):
830871
}
831-
c.compactUsers(ctx)
872+
c.compactUsers(ctx, c.compactionCtx)
832873

833874
ticker := time.NewTicker(c.compactorCfg.CompactionInterval)
834875
defer ticker.Stop()
@@ -839,7 +880,7 @@ func (c *Compactor) running(ctx context.Context) error {
839880
// Insert jitter right before compaction starts, so that there will always
840881
// have jitter even compaction time is longer than CompactionInterval
841882
time.Sleep(time.Duration(rand.Int63n(int64(float64(c.compactorCfg.CompactionInterval) * 0.1))))
842-
c.compactUsers(ctx)
883+
c.compactUsers(ctx, c.compactionCtx)
843884
case <-ctx.Done():
844885
return nil
845886
case err := <-c.ringSubservicesWatcher.Chan():
@@ -848,7 +889,9 @@ func (c *Compactor) running(ctx context.Context) error {
848889
}
849890
}
850891

851-
func (c *Compactor) compactUsers(ctx context.Context) {
892+
// ctx decides whether another tenant is picked up; compactionCtx runs the
893+
// compaction and can outlive ctx by -compactor.compaction-drain-timeout.
894+
func (c *Compactor) compactUsers(ctx, compactionCtx context.Context) {
852895
succeeded := false
853896
interrupted := false
854897
compactionErrorCount := 0
@@ -934,9 +977,9 @@ func (c *Compactor) compactUsers(ctx context.Context) {
934977

935978
level.Info(c.logger).Log("msg", "starting compaction of user blocks", "user", userID)
936979

937-
if err = c.compactUserWithRetries(ctx, userID); err != nil {
980+
if err = c.compactUserWithRetries(compactionCtx, ctx, userID); err != nil {
938981
// TODO: patch thanos error types to support errors.Is(err, context.Canceled) here
939-
if ctx.Err() != nil && ctx.Err() == context.Canceled {
982+
if compactionCtx.Err() != nil && compactionCtx.Err() == context.Canceled {
940983
interrupted = true
941984
level.Info(c.logger).Log("msg", "interrupting compaction of user blocks", "user", userID)
942985
return
@@ -981,7 +1024,7 @@ func (c *Compactor) compactUsers(ctx context.Context) {
9811024
succeeded = true
9821025
}
9831026

984-
func (c *Compactor) compactUserWithRetries(ctx context.Context, userID string) error {
1027+
func (c *Compactor) compactUserWithRetries(ctx, shutdownCtx context.Context, userID string) error {
9851028
var lastErr error
9861029

9871030
retries := backoff.New(ctx, backoff.Config{
@@ -991,7 +1034,7 @@ func (c *Compactor) compactUserWithRetries(ctx context.Context, userID string) e
9911034
})
9921035

9931036
for retries.Ongoing() {
994-
lastErr = c.compactUser(ctx, userID)
1037+
lastErr = c.compactUser(ctx, shutdownCtx, userID)
9951038
if lastErr == nil {
9961039
return nil
9971040
}
@@ -1010,6 +1053,12 @@ func (c *Compactor) compactUserWithRetries(ctx context.Context, userID string) e
10101053
}
10111054
c.compactorMetrics.compactionErrorsCount.WithLabelValues(userID, retriableError).Inc()
10121055

1056+
// Break rather than return, so lastErr is handled as when retries run
1057+
// out: a completed or visited partition is not counted as a failure.
1058+
if shutdownCtx.Err() != nil {
1059+
break
1060+
}
1061+
10131062
retries.Wait()
10141063
}
10151064

@@ -1021,7 +1070,35 @@ func (c *Compactor) compactUserWithRetries(ctx context.Context, userID string) e
10211070
return lastErr
10221071
}
10231072

1024-
func (c *Compactor) compactUser(ctx context.Context, userID string) error {
1073+
// shutdownGatedGrouper stops building new groups at shutdown. Under the
1074+
// partitioning strategy, building a group claims its partition in the bucket.
1075+
type shutdownGatedGrouper struct {
1076+
shutdownCtx context.Context
1077+
grouper compact.Grouper
1078+
}
1079+
1080+
func (g *shutdownGatedGrouper) Groups(blocks map[ulid.ULID]*metadata.Meta) ([]*compact.Group, error) {
1081+
if g.shutdownCtx.Err() != nil {
1082+
return nil, nil
1083+
}
1084+
return g.grouper.Groups(blocks)
1085+
}
1086+
1087+
// shutdownGatedPlanner stops planning groups already queued at shutdown. An
1088+
// empty plan is a group with nothing to do and does not ask for a rerun.
1089+
type shutdownGatedPlanner struct {
1090+
shutdownCtx context.Context
1091+
planner compact.Planner
1092+
}
1093+
1094+
func (p *shutdownGatedPlanner) Plan(ctx context.Context, metasByMinTime []*metadata.Meta, errChan chan error, extensions any) ([]*metadata.Meta, error) {
1095+
if p.shutdownCtx.Err() != nil {
1096+
return nil, nil
1097+
}
1098+
return p.planner.Plan(ctx, metasByMinTime, errChan, extensions)
1099+
}
1100+
1101+
func (c *Compactor) compactUser(ctx, shutdownCtx context.Context, userID string) error {
10251102
bucket := newParquetFilteredBucket(bucket.NewUserBucketClient(userID, c.bucketClient, c.limits))
10261103

10271104
reg := prometheus.NewRegistry()
@@ -1116,11 +1193,18 @@ func (c *Compactor) compactUser(ctx context.Context, userID string) error {
11161193

11171194
currentCtx, cancel := context.WithCancel(ctx)
11181195
defer cancel()
1196+
1197+
planner := c.blocksPlannerFactory(currentCtx, bucket, ulogger, c.compactorCfg, noCompactMarkerFilter, c.ringLifecycler, userID, c.blockVisitMarkerReadFailed, c.blockVisitMarkerWriteFailed, c.compactorMetrics, ignoreDeletionMarkFilter)
1198+
grouper := c.blocksGrouperFactory(currentCtx, c.compactorCfg, bucket, ulogger, c.BlocksMarkedForNoCompaction, c.blockVisitMarkerReadFailed, c.blockVisitMarkerWriteFailed, syncerMetrics, c.compactorMetrics, c.ring, c.ringLifecycler, c.limits, userID, noCompactMarkerFilter, c.ingestionReplicationFactor)
1199+
if c.compactorCfg.CompactionDrainTimeout > 0 {
1200+
planner = &shutdownGatedPlanner{shutdownCtx: shutdownCtx, planner: planner}
1201+
grouper = &shutdownGatedGrouper{shutdownCtx: shutdownCtx, grouper: grouper}
1202+
}
11191203
compactor, err := compact.NewBucketCompactorWithCheckerAndCallback(
11201204
ulogger,
11211205
syncer,
1122-
c.blocksGrouperFactory(currentCtx, c.compactorCfg, bucket, ulogger, c.BlocksMarkedForNoCompaction, c.blockVisitMarkerReadFailed, c.blockVisitMarkerWriteFailed, syncerMetrics, c.compactorMetrics, c.ring, c.ringLifecycler, c.limits, userID, noCompactMarkerFilter, c.ingestionReplicationFactor),
1123-
c.blocksPlannerFactory(currentCtx, bucket, ulogger, c.compactorCfg, noCompactMarkerFilter, c.ringLifecycler, userID, c.blockVisitMarkerReadFailed, c.blockVisitMarkerWriteFailed, c.compactorMetrics, ignoreDeletionMarkFilter),
1206+
grouper,
1207+
planner,
11241208
c.blocksCompactor,
11251209
c.blockDeletableCheckerFactory(currentCtx, bucket, ulogger),
11261210
c.compactionLifecycleCallbackFactory(currentCtx, bucket, ulogger, c.compactorCfg.MetaSyncConcurrency, c.compactorCfg.BlockMergeFanIn, c.compactDirForUser(userID), userID, c.compactorMetrics),

‎pkg/compactor/compactor_paritioning_test.go‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1630,7 +1630,7 @@ func TestPartitionCompactor_DeleteLocalSyncFiles(t *testing.T) {
16301630

16311631
// Run a compaction cycle on the first compactor: it is alone in the ring, so
16321632
// it owns (and syncs) all the users.
1633-
c1.compactUsers(context.Background())
1633+
c1.compactUsers(context.Background(), context.Background())
16341634
require.Equal(t, numUsers, len(c1.listTenantsWithMetaSyncDirectories()))
16351635

16361636
require.NoError(t, os.Mkdir(c1.metaSyncDirForUser("new-user"), 0600))
@@ -1660,14 +1660,14 @@ func TestPartitionCompactor_DeleteLocalSyncFiles(t *testing.T) {
16601660

16611661
// Run a compaction cycle on the second compactor: with pinned tokens it owns
16621662
// exactly half of the users and creates a meta-sync directory for each of them.
1663-
c2.compactUsers(context.Background())
1663+
c2.compactUsers(context.Background(), context.Background())
16641664

16651665
// Let's check how many users second compactor has.
16661666
c2Users := len(c2.listTenantsWithMetaSyncDirectories())
16671667
require.Equal(t, numUsers/2, c2Users)
16681668

16691669
// Force new compaction cycle on first compactor. It will run the cleanup of un-owned users at the end of compaction cycle.
1670-
c1.compactUsers(context.Background())
1670+
c1.compactUsers(context.Background(), context.Background())
16711671
c1Users := len(c1.listTenantsWithMetaSyncDirectories())
16721672

16731673
// Now compactor 1 should have cleaned the sync files of the users it no longer

0 commit comments

Comments
 (0)