Skip to content

Commit

Permalink
Revert "receive: upload compacted blocks if OOO enabled (#6974)"
Browse files Browse the repository at this point in the history
This reverts commit 7b8eb86.

Proper way to handle this is to disable vertical compaction. I am trying
to add this functionality here:
prometheus/prometheus#13393

Signed-off-by: Giedrius Statkevičius <giedrius.statkevicius@vinted.com>
  • Loading branch information
GiedriusS committed Jan 12, 2024
1 parent 7794d78 commit 7f70a35
Show file tree
Hide file tree
Showing 6 changed files with 1 addition and 25 deletions.
6 changes: 0 additions & 6 deletions cmd/thanos/receive.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,6 @@ func runReceive(
// Has this thanos receive instance been configured to ingest metrics into a local TSDB?
enableIngestion := receiveMode == receive.IngestorOnly || receiveMode == receive.RouterIngestor

isOOOEnabled := tsdbOpts.OutOfOrderTimeWindow > 0

upload := len(confContentYaml) > 0
if enableIngestion {
if upload {
Expand All @@ -178,9 +176,6 @@ func runReceive(
"Compaction needs to be disabled (tsdb.min-block-duration = tsdb.max-block-duration)", tsdbOpts.MaxBlockDuration, tsdbOpts.MinBlockDuration)
}
level.Warn(logger).Log("msg", "flag to ignore min/max block duration flags differing is being used. If the upload of a 2h block fails and a tsdb compaction happens that block may be missing from your Thanos bucket storage.")
if isOOOEnabled {
level.Warn(logger).Log("msg", "out-of-order support is also enabled which means that Receiver will now upload compacted blocks to not lose any data. Vertical compaction needs to be enabled on Compactor! See https://github.com/prometheus/prometheus/issues/13112")
}
}
// The background shipper continuously scans the data directory and uploads
// new blocks to object storage service.
Expand Down Expand Up @@ -218,7 +213,6 @@ func runReceive(
conf.tenantLabelName,
bkt,
conf.allowOutOfOrderUpload,
isOOOEnabled,
hashFunc,
)
writer := receive.NewWriter(log.With(logger, "component", "receive-writer"), dbs, &receive.WriterOptions{
Expand Down
1 change: 0 additions & 1 deletion pkg/receive/handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -966,7 +966,6 @@ func benchmarkHandlerMultiTSDBReceiveRemoteWrite(b testutil.TB) {
"tenant_id",
nil,
false,
false,
metadata.NoneFunc,
)
defer func() { testutil.Ok(b, m.Close()) }()
Expand Down
6 changes: 1 addition & 5 deletions pkg/receive/multitsdb.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ type MultiTSDB struct {
allowOutOfOrderUpload bool
hashFunc metadata.HashFunc
hashringConfigs []HashringConfig
uploadCompactedBlocks bool
}

// NewMultiTSDB creates new MultiTSDB.
Expand All @@ -75,7 +74,6 @@ func NewMultiTSDB(
tenantLabelName string,
bucket objstore.Bucket,
allowOutOfOrderUpload bool,
allowCompactedUpload bool,
hashFunc metadata.HashFunc,
) *MultiTSDB {
if l == nil {
Expand All @@ -93,7 +91,6 @@ func NewMultiTSDB(
tenantLabelName: tenantLabelName,
bucket: bucket,
allowOutOfOrderUpload: allowOutOfOrderUpload,
uploadCompactedBlocks: allowCompactedUpload,
hashFunc: hashFunc,
}
}
Expand Down Expand Up @@ -599,7 +596,6 @@ func (t *MultiTSDB) startTSDB(logger log.Logger, tenantID string, tenant *tenant
return err
}
var ship *shipper.Shipper

if t.bucket != nil {
ship = shipper.New(
logger,
Expand All @@ -608,7 +604,7 @@ func (t *MultiTSDB) startTSDB(logger log.Logger, tenantID string, tenant *tenant
t.bucket,
func() labels.Labels { return lset },
metadata.ReceiveSource,
func() bool { return t.uploadCompactedBlocks },
nil,
t.allowOutOfOrderUpload,
t.hashFunc,
shipper.DefaultMetaFilename,
Expand Down
10 changes: 0 additions & 10 deletions pkg/receive/multitsdb_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ func TestMultiTSDB(t *testing.T) {
"tenant_id",
nil,
false,
false,
metadata.NoneFunc,
)
defer func() { testutil.Ok(t, m.Close()) }()
Expand Down Expand Up @@ -136,7 +135,6 @@ func TestMultiTSDB(t *testing.T) {
"tenant_id",
nil,
false,
false,
metadata.NoneFunc,
)
defer func() { testutil.Ok(t, m.Close()) }()
Expand Down Expand Up @@ -180,7 +178,6 @@ func TestMultiTSDB(t *testing.T) {
"tenant_id",
nil,
false,
false,
metadata.NoneFunc,
)
defer func() { testutil.Ok(t, m.Close()) }()
Expand Down Expand Up @@ -448,7 +445,6 @@ func TestMultiTSDBPrune(t *testing.T) {
"tenant_id",
test.bucket,
false,
false,
metadata.NoneFunc,
)
defer func() { testutil.Ok(t, m.Close()) }()
Expand Down Expand Up @@ -510,7 +506,6 @@ func TestMultiTSDBRecreatePrunedTenant(t *testing.T) {
"tenant_id",
objstore.NewInMemBucket(),
false,
false,
metadata.NoneFunc,
)
defer func() { testutil.Ok(t, m.Close()) }()
Expand Down Expand Up @@ -572,7 +567,6 @@ func TestAlignedHeadFlush(t *testing.T) {
"tenant_id",
test.bucket,
false,
false,
metadata.NoneFunc,
)
defer func() { testutil.Ok(t, m.Close()) }()
Expand Down Expand Up @@ -647,7 +641,6 @@ func TestMultiTSDBStats(t *testing.T) {
"tenant_id",
nil,
false,
false,
metadata.NoneFunc,
)
defer func() { testutil.Ok(t, m.Close()) }()
Expand Down Expand Up @@ -677,7 +670,6 @@ func TestMultiTSDBWithNilStore(t *testing.T) {
"tenant_id",
nil,
false,
false,
metadata.NoneFunc,
)
defer func() { testutil.Ok(t, m.Close()) }()
Expand Down Expand Up @@ -719,7 +711,6 @@ func TestProxyLabelValues(t *testing.T) {
"tenant_id",
nil,
false,
false,
metadata.NoneFunc,
)
defer func() { testutil.Ok(t, m.Close()) }()
Expand Down Expand Up @@ -810,7 +801,6 @@ func BenchmarkMultiTSDB(b *testing.B) {
"tenant_id",
nil,
false,
false,
metadata.NoneFunc,
)
defer func() { testutil.Ok(b, m.Close()) }()
Expand Down
1 change: 0 additions & 1 deletion pkg/receive/receive_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -814,7 +814,6 @@ func initializeMultiTSDB(dir string) *MultiTSDB {
"tenant_id",
bucket,
false,
false,
metadata.NoneFunc,
)

Expand Down
2 changes: 0 additions & 2 deletions pkg/receive/writer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,6 @@ func TestWriter(t *testing.T) {
"tenant_id",
nil,
false,
false,
metadata.NoneFunc,
)
t.Cleanup(func() { testutil.Ok(t, m.Close()) })
Expand Down Expand Up @@ -436,7 +435,6 @@ func benchmarkWriter(b *testing.B, labelsNum int, seriesNum int, generateHistogr
"tenant_id",
nil,
false,
false,
metadata.NoneFunc,
)
b.Cleanup(func() { testutil.Ok(b, m.Close()) })
Expand Down

0 comments on commit 7f70a35

Please sign in to comment.