Skip to content

Commit e6379cd

Browse files
committed
fix ooo blocks shipping
Signed-off-by: Ben Ye <benye@amazon.com>
1 parent d650f1f commit e6379cd

File tree

9 files changed

+396
-86
lines changed

9 files changed

+396
-86
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
* [BUGFIX] Query Frontend: Fix bug of failing to cancel downstream request context in query frontend v2 mode (query scheduler enabled). #5447
5757
* [BUGFIX] Alertmanager: Remove the user id from state replication key metric label value. #5453
5858
* [BUGFIX] Compactor: Avoid cleaner concurrency issues checking global markers before all blocks. #5457
59+
* [BUGFIX] Ingester: Allow shipper to upload compacted blocks when out of order samples is enabled. #5416
5960

6061
## 1.15.1 2023-04-26
6162

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ require (
5353
github.com/stretchr/testify v1.8.4
5454
github.com/thanos-io/objstore v0.0.0-20230713070940-eb01c83b89a4
5555
github.com/thanos-io/promql-engine v0.0.0-20230526105742-791d78b260ea
56-
github.com/thanos-io/thanos v0.31.1-0.20230717161853-6fda58a6291f
56+
github.com/thanos-io/thanos v0.31.1-0.20230720163710-cdba35b2c377
5757
github.com/uber/jaeger-client-go v2.30.0+incompatible
5858
github.com/weaveworks/common v0.0.0-20221201103051-7c2720a9024d
5959
go.etcd.io/etcd/api/v3 v3.5.8

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1164,8 +1164,8 @@ github.com/thanos-io/objstore v0.0.0-20230713070940-eb01c83b89a4 h1:SYs56N3zGaE8
11641164
github.com/thanos-io/objstore v0.0.0-20230713070940-eb01c83b89a4/go.mod h1:Vc+D0zxX8fT7VOe8Gj0J6vzw0kcTrMCEgE140wCz1c0=
11651165
github.com/thanos-io/promql-engine v0.0.0-20230526105742-791d78b260ea h1:kzK8sBn2+mo3NAxP+XjAjAqr1hwfxxFUy5CybaBkjAI=
11661166
github.com/thanos-io/promql-engine v0.0.0-20230526105742-791d78b260ea/go.mod h1:eIgPaXWgOhNAv6CPPrgu09r0AtT7byBTZy+7WkX0D18=
1167-
github.com/thanos-io/thanos v0.31.1-0.20230717161853-6fda58a6291f h1:gQbMvTAd6HXPmMgd2W9/TF5Pe37++A7oa5vYT4LQPEA=
1168-
github.com/thanos-io/thanos v0.31.1-0.20230717161853-6fda58a6291f/go.mod h1:PGAlwITP7IvWQXra3VbWomRqz8xrSlAR3ee6Z8k4No0=
1167+
github.com/thanos-io/thanos v0.31.1-0.20230720163710-cdba35b2c377 h1:foFRUzRdQl68twPQmUCZo1kyVJ+Um2FH1TjqysBsUGc=
1168+
github.com/thanos-io/thanos v0.31.1-0.20230720163710-cdba35b2c377/go.mod h1:PGAlwITP7IvWQXra3VbWomRqz8xrSlAR3ee6Z8k4No0=
11691169
github.com/themihai/gomemcache v0.0.0-20180902122335-24332e2d58ab h1:7ZR3hmisBWw77ZpO1/o86g+JV3VKlk3d48jopJxzTjU=
11701170
github.com/themihai/gomemcache v0.0.0-20180902122335-24332e2d58ab/go.mod h1:eheTFp954zcWZXCU8d0AT76ftsQOTo4DTqkN/h3k1MY=
11711171
github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk=

pkg/ingester/ingester.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1968,6 +1968,7 @@ func (i *Ingester) createTSDB(userID string) (*userTSDB, error) {
19681968
if maxExemplarsForUser > 0 {
19691969
enableExemplars = true
19701970
}
1971+
oooTimeWindow := time.Duration(i.limits.OutOfOrderTimeWindow(userID)).Milliseconds()
19711972
// Create a new user database
19721973
db, err := tsdb.Open(udir, userLogger, tsdbPromReg, &tsdb.Options{
19731974
RetentionDuration: i.cfg.BlocksStorageConfig.TSDB.Retention.Milliseconds(),
@@ -1985,7 +1986,7 @@ func (i *Ingester) createTSDB(userID string) (*userTSDB, error) {
19851986
MaxExemplars: maxExemplarsForUser,
19861987
HeadChunksWriteQueueSize: i.cfg.BlocksStorageConfig.TSDB.HeadChunksWriteQueueSize,
19871988
EnableMemorySnapshotOnShutdown: i.cfg.BlocksStorageConfig.TSDB.MemorySnapshotOnShutdown,
1988-
OutOfOrderTimeWindow: time.Duration(i.limits.OutOfOrderTimeWindow(userID)).Milliseconds(),
1989+
OutOfOrderTimeWindow: oooTimeWindow,
19891990
OutOfOrderCapMax: i.cfg.BlocksStorageConfig.TSDB.OutOfOrderCapMax,
19901991
}, nil)
19911992
if err != nil {
@@ -2038,8 +2039,10 @@ func (i *Ingester) createTSDB(userID string) (*userTSDB, error) {
20382039
bucket.NewUserBucketClient(userID, i.TSDBState.bucket, i.limits),
20392040
func() labels.Labels { return l },
20402041
metadata.ReceiveSource,
2041-
false, // No need to upload compacted blocks. Cortex compactor takes care of that.
2042-
true, // Allow out of order uploads. It's fine in Cortex's context.
2042+
func() bool {
2043+
return time.Duration(i.limits.OutOfOrderTimeWindow(userID)).Milliseconds() > 0
2044+
}, // No need to upload compacted blocks unless out of order samples is enabled.
2045+
true, // Allow out of order uploads. It's fine in Cortex's context.
20432046
metadata.NoneFunc,
20442047
)
20452048

vendor/github.com/thanos-io/thanos/pkg/shipper/shipper.go

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

0 commit comments

Comments
 (0)