Skip to content

Commit 2575a0a

Browse files
authored
Update/thanos blocks (#4787)
* go mod Signed-off-by: alanprot <[email protected]> * Adding compactor.blocks-fetch-concurrency Signed-off-by: alanprot <[email protected]> * Docs Signed-off-by: alanprot <[email protected]> * Changelog Signed-off-by: alanprot <[email protected]> * Fix test Signed-off-by: Alan Protasio <[email protected]> * Update thanos to fix the race condition Signed-off-by: alanprot <[email protected]>
1 parent e8e5432 commit 2575a0a

File tree

15 files changed

+218
-175
lines changed

15 files changed

+218
-175
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
## master / unreleased
44
* [FEATURE] Compactor: Added `-compactor.block-files-concurrency` allowing to configure number of go routines for download/upload block files during compaction. #4784
55
* [ENHANCEMENT] Querier/Ruler: Retry store-gateway in case of unexpected failure, instead of failing the query. #4532
6+
* [FEATURE] Compactor: Added -compactor.blocks-fetch-concurrency` allowing to configure number of go routines for blocks during compaction. #4787
67

78
## 1.13.0 2022-07-14
89
* [CHANGE] Changed default for `-ingester.min-ready-duration` from 1 minute to 15 seconds. #4539

docs/blocks-storage/compactor.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,11 @@ compactor:
157157
# CLI flag: -compactor.block-files-concurrency
158158
[block_files_concurrency: <int> | default = 10]
159159

160+
# Number of goroutines to use when fetching blocks from object storage when
161+
# compacting.
162+
# CLI flag: -compactor.blocks-fetch-concurrency
163+
[blocks_fetch_concurrency: <int> | default = 3]
164+
160165
# When enabled, at compactor startup the bucket will be scanned and all found
161166
# deletion marks inside the block location will be copied to the markers
162167
# global location too. This option can (and should) be safely disabled as soon

docs/configuration/config-file-reference.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5322,6 +5322,11 @@ The `compactor_config` configures the compactor for the blocks storage.
53225322
# CLI flag: -compactor.block-files-concurrency
53235323
[block_files_concurrency: <int> | default = 10]
53245324
5325+
# Number of goroutines to use when fetching blocks from object storage when
5326+
# compacting.
5327+
# CLI flag: -compactor.blocks-fetch-concurrency
5328+
[blocks_fetch_concurrency: <int> | default = 3]
5329+
53255330
# When enabled, at compactor startup the bucket will be scanned and all found
53265331
# deletion marks inside the block location will be copied to the markers global
53275332
# location too. This option can (and should) be safely disabled as soon as the

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ require (
3939
github.com/hashicorp/memberlist v0.3.1
4040
github.com/json-iterator/go v1.1.12
4141
github.com/lib/pq v1.3.0
42-
github.com/minio/minio-go/v7 v7.0.30
42+
github.com/minio/minio-go/v7 v7.0.32-0.20220706200439-ef3e45ed9cdb
4343
github.com/mitchellh/go-wordwrap v1.0.0
4444
github.com/ncw/swift v1.0.52
4545
github.com/oklog/ulid v1.3.1
@@ -56,7 +56,7 @@ require (
5656
github.com/sony/gobreaker v0.4.1
5757
github.com/spf13/afero v1.6.0
5858
github.com/stretchr/testify v1.7.2
59-
github.com/thanos-io/thanos v0.27.0-rc.0.0.20220712060227-ca4fe82d74f6
59+
github.com/thanos-io/thanos v0.27.0-rc.0.0.20220715025542-84880ea6d7f8
6060
github.com/uber/jaeger-client-go v2.30.0+incompatible
6161
github.com/weaveworks/common v0.0.0-20210913144402-035033b78a78
6262
go.etcd.io/bbolt v1.3.6

go.sum

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1551,8 +1551,8 @@ github.com/minio/minio-go/v6 v6.0.44/go.mod h1:qD0lajrGW49lKZLtXKtCB4X/qkMf0a5tB
15511551
github.com/minio/minio-go/v6 v6.0.56/go.mod h1:KQMM+/44DSlSGSQWSfRrAZ12FVMmpWNuX37i2AX0jfI=
15521552
github.com/minio/minio-go/v7 v7.0.2/go.mod h1:dJ80Mv2HeGkYLH1sqS/ksz07ON6csH3S6JUMSQ2zAns=
15531553
github.com/minio/minio-go/v7 v7.0.10/go.mod h1:td4gW1ldOsj1PbSNS+WYK43j+P1XVhX/8W8awaYlBFo=
1554-
github.com/minio/minio-go/v7 v7.0.30 h1:Re+qlwA+LB3mgFGYbztVPzlEjKtGzRVV5Sk38np858k=
1555-
github.com/minio/minio-go/v7 v7.0.30/go.mod h1:/sjRKkKIA75CKh1iu8E3qBy7ktBmCCDGII0zbXGwbUk=
1554+
github.com/minio/minio-go/v7 v7.0.32-0.20220706200439-ef3e45ed9cdb h1:J7jRWqlD+K3Tp4YbLWcyBKiHoNRy49JR5HA4RetFrAY=
1555+
github.com/minio/minio-go/v7 v7.0.32-0.20220706200439-ef3e45ed9cdb/go.mod h1:/sjRKkKIA75CKh1iu8E3qBy7ktBmCCDGII0zbXGwbUk=
15561556
github.com/minio/sha256-simd v0.1.1/go.mod h1:B5e1o+1/KgNmWrSQK08Y6Z1Vb5pwIktudl0J58iy0KM=
15571557
github.com/minio/sha256-simd v1.0.0 h1:v1ta+49hkWZyvaKwrQB8elexRqm6Y0aMLjCNsrYxo6g=
15581558
github.com/minio/sha256-simd v1.0.0/go.mod h1:OuYzVNI5vcoYIAmbIvHPl3N3jUzVedXbKy5RFepssQM=
@@ -2040,8 +2040,8 @@ github.com/thanos-io/thanos v0.13.1-0.20210224074000-659446cab117/go.mod h1:kdqF
20402040
github.com/thanos-io/thanos v0.13.1-0.20210226164558-03dace0a1aa1/go.mod h1:gMCy4oCteKTT7VuXVvXLTPGzzjovX1VPE5p+HgL1hyU=
20412041
github.com/thanos-io/thanos v0.13.1-0.20210401085038-d7dff0c84d17/go.mod h1:zU8KqE+6A+HksK4wiep8e/3UvCZLm+Wrw9AqZGaAm9k=
20422042
github.com/thanos-io/thanos v0.22.0/go.mod h1:SZDWz3phcUcBr4MYFoPFRvl+Z9Nbi45HlwQlwSZSt+Q=
2043-
github.com/thanos-io/thanos v0.27.0-rc.0.0.20220712060227-ca4fe82d74f6 h1:6jxorvQx1sk912ykRj29pizu8U480zKmjZb7HnQe+hM=
2044-
github.com/thanos-io/thanos v0.27.0-rc.0.0.20220712060227-ca4fe82d74f6/go.mod h1:sklyj/ttQrL8iY3g/pQEAdIhayKW4HvOpbA7TEYK0Xs=
2043+
github.com/thanos-io/thanos v0.27.0-rc.0.0.20220715025542-84880ea6d7f8 h1:kdpa2sXUyxQy3KAk00T+4R9rZFCX5vfdwFmf+TWk5BE=
2044+
github.com/thanos-io/thanos v0.27.0-rc.0.0.20220715025542-84880ea6d7f8/go.mod h1:Ga4NVtqoPVGjZmKiu5Wz2x6V9o4ohdeV9ZAcztvH13M=
20452045
github.com/themihai/gomemcache v0.0.0-20180902122335-24332e2d58ab h1:7ZR3hmisBWw77ZpO1/o86g+JV3VKlk3d48jopJxzTjU=
20462046
github.com/themihai/gomemcache v0.0.0-20180902122335-24332e2d58ab/go.mod h1:eheTFp954zcWZXCU8d0AT76ftsQOTo4DTqkN/h3k1MY=
20472047
github.com/tidwall/pretty v0.0.0-20180105212114-65a9db5fad51/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk=

pkg/compactor/compactor.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,8 @@ var (
6464
garbageCollectedBlocks,
6565
blocksMarkedForNoCompaction,
6666
metadata.NoneFunc,
67-
cfg.BlockFilesConcurrency)
67+
cfg.BlockFilesConcurrency,
68+
cfg.BlocksFetchConcurrency)
6869
}
6970

7071
ShuffleShardingGrouperFactory = func(ctx context.Context, cfg Config, bkt objstore.Bucket, logger log.Logger, reg prometheus.Registerer, blocksMarkedForDeletion, blocksMarkedForNoCompaction, garbageCollectedBlocks prometheus.Counter, remainingPlannedCompactions prometheus.Gauge, ring *ring.Ring, ringLifecycle *ring.Lifecycler, limits Limits, userID string) compact.Grouper {
@@ -84,7 +85,8 @@ var (
8485
ringLifecycle.Addr,
8586
limits,
8687
userID,
87-
cfg.BlockFilesConcurrency)
88+
cfg.BlockFilesConcurrency,
89+
cfg.BlocksFetchConcurrency)
8890
}
8991

9092
DefaultBlocksCompactorFactory = func(ctx context.Context, cfg Config, logger log.Logger, reg prometheus.Registerer) (compact.Compactor, PlannerFactory, error) {
@@ -166,6 +168,7 @@ type Config struct {
166168
TenantCleanupDelay time.Duration `yaml:"tenant_cleanup_delay"`
167169
SkipBlocksWithOutOfOrderChunksEnabled bool `yaml:"skip_blocks_with_out_of_order_chunks_enabled"`
168170
BlockFilesConcurrency int `yaml:"block_files_concurrency"`
171+
BlocksFetchConcurrency int `yaml:"blocks_fetch_concurrency"`
169172

170173
// Whether the migration of block deletion marks to the global markers location is enabled.
171174
BlockDeletionMarksMigrationEnabled bool `yaml:"block_deletion_marks_migration_enabled"`
@@ -216,6 +219,7 @@ func (cfg *Config) RegisterFlags(f *flag.FlagSet) {
216219
f.BoolVar(&cfg.BlockDeletionMarksMigrationEnabled, "compactor.block-deletion-marks-migration-enabled", false, "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.")
217220
f.BoolVar(&cfg.SkipBlocksWithOutOfOrderChunksEnabled, "compactor.skip-blocks-with-out-of-order-chunks-enabled", false, "When enabled, mark blocks containing index with out-of-order chunks for no compact instead of halting the compaction.")
218221
f.IntVar(&cfg.BlockFilesConcurrency, "compactor.block-files-concurrency", 10, "Number of goroutines to use when fetching/uploading block files from object storage.")
222+
f.IntVar(&cfg.BlocksFetchConcurrency, "compactor.blocks-fetch-concurrency", 3, "Number of goroutines to use when fetching blocks from object storage when compacting.")
219223

220224
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.")
221225
f.Var(&cfg.DisabledTenants, "compactor.disabled-tenants", "Comma separated list of tenants that cannot be compacted by this compactor. If specified, and compactor would normally pick given tenant for compaction (via -compactor.enabled-tenants or sharding), it will be ignored instead.")

pkg/compactor/shuffle_sharding_grouper.go

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ type ShuffleShardingGrouper struct {
4141
limits Limits
4242
userID string
4343
blockFilesConcurrency int
44+
blocksFetchConcurrency int
4445

4546
ring ring.ReadRing
4647
ringLifecyclerAddr string
@@ -63,6 +64,7 @@ func NewShuffleShardingGrouper(
6364
limits Limits,
6465
userID string,
6566
blockFilesConcurrency int,
67+
blocksFetchConcurrency int,
6668
) *ShuffleShardingGrouper {
6769
if logger == nil {
6870
logger = log.NewNopLogger()
@@ -100,12 +102,13 @@ func NewShuffleShardingGrouper(
100102
Name: "thanos_compact_group_vertical_compactions_total",
101103
Help: "Total number of group compaction attempts that resulted in a new block based on overlapping blocks.",
102104
}, []string{"group"}),
103-
compactorCfg: compactorCfg,
104-
ring: ring,
105-
ringLifecyclerAddr: ringLifecyclerAddr,
106-
limits: limits,
107-
userID: userID,
108-
blockFilesConcurrency: blockFilesConcurrency,
105+
compactorCfg: compactorCfg,
106+
ring: ring,
107+
ringLifecyclerAddr: ringLifecyclerAddr,
108+
limits: limits,
109+
userID: userID,
110+
blockFilesConcurrency: blockFilesConcurrency,
111+
blocksFetchConcurrency: blocksFetchConcurrency,
109112
}
110113
}
111114

@@ -184,6 +187,7 @@ func (g *ShuffleShardingGrouper) Groups(blocks map[ulid.ULID]*metadata.Meta) (re
184187
g.blocksMarkedForNoCompact,
185188
g.hashFunc,
186189
g.blockFilesConcurrency,
190+
g.blocksFetchConcurrency,
187191
)
188192
if err != nil {
189193
return nil, errors.Wrap(err, "create compaction group")

pkg/compactor/shuffle_sharding_grouper_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,8 @@ func TestShuffleShardingGrouper_Groups(t *testing.T) {
241241
"test-addr",
242242
overrides,
243243
"",
244-
10)
244+
10,
245+
3)
245246
actual, err := g.Groups(testData.blocks)
246247
require.NoError(t, err)
247248
require.Len(t, actual, len(testData.expected))

vendor/github.com/minio/minio-go/v7/api-put-object-streaming.go

Lines changed: 20 additions & 30 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/minio/minio-go/v7/api.go

Lines changed: 3 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)