Skip to content

Commit 76bf025

Browse files
committed
Addressed review comments
Signed-off-by: Marco Pracucci <marco@pracucci.com>
1 parent ae5be0c commit 76bf025

File tree

8 files changed

+9
-13
lines changed

8 files changed

+9
-13
lines changed

CHANGELOG.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
## master / unreleased
44

55
* [CHANGE] Blocks storage: compactor is now required when running a Cortex cluster with the blocks storage, because it also keeps the bucket index updated. #3583
6-
* [CHANGE] Blocks storage: block deletion marks are now stored in a per-tenant global markers/ location too, other than within the block location. The compactor, at startup, will copy deletion marks from the block location to the global location. This migration is required only once, so you can safely disable it via `-compactor.block-deletion-marks-migration-enabled=false` once the new compact has successfully started once in your cluster. #3583
6+
* [CHANGE] Blocks storage: block deletion marks are now stored in a per-tenant global markers/ location too, other than within the block location. The compactor, at startup, will copy deletion marks from the block location to the global location. This migration is required only once, so you can safely disable it via `-compactor.block-deletion-marks-migration-enabled=false` once new compactor has successfully started once in your cluster. #3583
77
* [ENHANCEMENT] Memberlist: add status page (`/memberlist`) with available details about memberlist-based KV store and memberlist cluster. It's also possible to view KV values in Go struct or JSON format, or download for inspection. #3575
88
* [ENHANCEMENT] Memberlist: client can now keep a size-bounded buffer with sent and received messages and display them in the admin UI (/memberlist) for troubleshooting. #3581
99
* [ENHANCEMENT] Compactor: exported the following metrics.
10-
* [ENHANCEMENT] Blocks storage: introduced a per-tenant bucket index, periodically updated by the compactor, used to avoid full bucket scanning done by queriers and store-gateways. The bucket index is updated by the compactor every `-compactor.cleanup-interval`. #3553 #3555 #3561 #3583
10+
* [ENHANCEMENT] Blocks storage: introduced a per-tenant bucket index, periodically updated by the compactor, used to avoid full bucket scanning done by queriers and store-gateways. The bucket index is updated by the compactor during blocks cleanup, on every `-compactor.cleanup-interval`. #3553 #3555 #3561 #3583
1111
* [ENHANCEMENT] Compactor: exported the following metrics. #3583
1212
* `cortex_bucket_blocks_count`: Total number of blocks per tenant in the bucket. Includes blocks marked for deletion.
1313
* `cortex_bucket_blocks_marked_for_deletion_count`: Total number of blocks per tenant marked for deletion in the bucket.

docs/blocks-storage/compactor.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,7 @@ compactor:
139139
# blocks will be marked for deletion and compactor component will permanently
140140
# delete blocks marked for deletion from the bucket. If 0, blocks will be
141141
# deleted straight away. Note that deleting blocks immediately can cause query
142-
# failures, if store gateway still has the block loaded, or compactor is
143-
# ignoring the deletion because it's compacting the block at the same time.
142+
# failures.
144143
# CLI flag: -compactor.deletion-delay
145144
[deletion_delay: <duration> | default = 12h]
146145

docs/configuration/config-file-reference.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4009,8 +4009,7 @@ The `compactor_config` configures the compactor for the blocks storage.
40094009
# blocks will be marked for deletion and compactor component will permanently
40104010
# delete blocks marked for deletion from the bucket. If 0, blocks will be
40114011
# deleted straight away. Note that deleting blocks immediately can cause query
4012-
# failures, if store gateway still has the block loaded, or compactor is
4013-
# ignoring the deletion because it's compacting the block at the same time.
4012+
# failures.
40144013
# CLI flag: -compactor.deletion-delay
40154014
[deletion_delay: <duration> | default = 12h]
40164015

pkg/compactor/blocks_cleaner.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ type BlocksCleanerConfig struct {
2626
DeletionDelay time.Duration
2727
CleanupInterval time.Duration
2828
CleanupConcurrency int
29-
BlockDeletionMarksMigrationEnabled bool // TODO Remove in Cortex 1.8.0 and document that upgrading to 1.7.0 before 1.8.0 is required.
29+
BlockDeletionMarksMigrationEnabled bool // TODO Discuss whether we should remove it in Cortex 1.8.0 and document that upgrading to 1.7.0 before 1.8.0 is required.
3030
}
3131

3232
type BlocksCleaner struct {

pkg/compactor/compactor.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,7 @@ func (cfg *Config) RegisterFlags(f *flag.FlagSet) {
8787
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.")
8888
f.DurationVar(&cfg.DeletionDelay, "compactor.deletion-delay", 12*time.Hour, "Time before a block marked for deletion is deleted from bucket. "+
8989
"If not 0, blocks will be marked for deletion and compactor component will permanently delete blocks marked for deletion from the bucket. "+
90-
"If 0, blocks will be deleted straight away. Note that deleting blocks immediately can cause query failures, "+
91-
"if store gateway still has the block loaded, or compactor is ignoring the deletion because it's compacting the block at the same time.")
90+
"If 0, blocks will be deleted straight away. Note that deleting blocks immediately can cause query failures.")
9291
f.BoolVar(&cfg.BlockDeletionMarksMigrationEnabled, "compactor.block-deletion-marks-migration-enabled", true, "When enabled, at compactor startup the bucket will be scanned and all found deletion marks inside the block location will be copied to the markers global location too. This option can (and should) be safely disabled as soon as the compactor has successfully run at least once.")
9392

9493
f.Var(&cfg.EnabledTenants, "compactor.enabled-tenants", "Comma separated list of tenants that can be compacted. If specified, only these tenants will be compacted by compactor, otherwise all tenants can be compacted. Subject to sharding.")

pkg/storage/tsdb/bucketindex/index.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ type Index struct {
4343
UpdatedAt int64 `json:"updated_at"`
4444
}
4545

46-
// RemoveBlock from the index.
46+
// RemoveBlock removes block and its deletion mark (if any) from index.
4747
func (idx *Index) RemoveBlock(id ulid.ULID) {
4848
for i := 0; i < len(idx.Blocks); i++ {
4949
if idx.Blocks[i].ID == id {

pkg/storage/tsdb/bucketindex/markers.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ func MigrateBlockDeletionMarksToGlobalLocation(ctx context.Context, bkt objstore
7878
// Upload it to the global markers location.
7979
uploadErr := userBucket.Upload(ctx, BlockDeletionMarkFilepath(blockID), reader)
8080
if closeErr := reader.Close(); closeErr != nil {
81-
errs.Add(uploadErr)
81+
errs.Add(closeErr)
8282
}
8383
if uploadErr != nil {
8484
errs.Add(uploadErr)

pkg/storage/tsdb/bucketindex/storage.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,7 @@ func ReadIndex(ctx context.Context, bkt objstore.Bucket, userID string, logger l
5050
return index, nil
5151
}
5252

53-
// WriteIndex generates the bucket index and writes it to the storage. If the old index is not
54-
// passed in input, then the bucket index will be generated from scratch.
53+
// WriteIndex uploads the provided index to the storage.
5554
func WriteIndex(ctx context.Context, bkt objstore.Bucket, userID string, idx *Index) error {
5655
bkt = bucket.NewUserBucketClient(userID, bkt)
5756

0 commit comments

Comments
 (0)