Skip to content

Commit 42f0e63

Browse files
committed
Ensure that compaction continues for block with incomplete time-range
Signed-off-by: 🌲 Harry 🌊 John 🏔 <[email protected]>
1 parent 3929bdb commit 42f0e63

File tree

2 files changed

+17
-17
lines changed

2 files changed

+17
-17
lines changed

CHANGELOG.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Changelog
22

33
## master / unreleased
4-
[BUGFIX] Compactor: Fixes #4770 - an edge case in compactor where compaction stops when a tenant stops ingesting samples. #4771
4+
[BUGFIX] Compactor: Fixes #4770 - an edge case in compactor where compaction stops when a tenant stops ingesting samples. #4771
55

66
## 1.13.0 in progress
77
* [CHANGE] Changed default for `-ingester.min-ready-duration` from 1 minute to 15 seconds. #4539

pkg/compactor/shuffle_sharding_grouper_test.go

+16-16
Original file line numberDiff line numberDiff line change
@@ -27,21 +27,25 @@ func TestShuffleShardingGrouper_Groups(t *testing.T) {
2727
block0to1hExt3Ulid := ulid.MustNew(7, nil)
2828
block4hto6hExt2Ulid := ulid.MustNew(8, nil)
2929
block6hto8hExt2Ulid := ulid.MustNew(9, nil)
30-
block1hto2hExt_1_ulid := ulid.MustNew(10, nil)
30+
block1hto2hExt1UlidCopy := ulid.MustNew(10, nil)
3131
block0hto20hExt1Ulid := ulid.MustNew(11, nil)
3232
block21hto40hExt1Ulid := ulid.MustNew(12, nil)
33-
block21hto40hExt1Ulid_copy := ulid.MustNew(13, nil)
33+
block21hto40hExt1UlidCopy := ulid.MustNew(13, nil)
3434
block0hto45mExt1Ulid := ulid.MustNew(14, nil)
3535
block0hto1h30mExt1Ulid := ulid.MustNew(15, nil)
3636
blocklast1hExt1Ulid := ulid.MustNew(16, nil)
37-
blocklast1hExt1Ulid_copy := ulid.MustNew(17, nil)
37+
blocklast1hExt1UlidCopy := ulid.MustNew(17, nil)
3838

3939
blocks :=
4040
map[ulid.ULID]*metadata.Meta{
4141
block1hto2hExt1Ulid: {
4242
BlockMeta: tsdb.BlockMeta{ULID: block1hto2hExt1Ulid, MinTime: 1 * time.Hour.Milliseconds(), MaxTime: 2 * time.Hour.Milliseconds()},
4343
Thanos: metadata.Thanos{Labels: map[string]string{"external": "1"}},
4444
},
45+
block1hto2hExt1UlidCopy: {
46+
BlockMeta: tsdb.BlockMeta{ULID: block1hto2hExt1UlidCopy, MinTime: 1 * time.Hour.Milliseconds(), MaxTime: 2 * time.Hour.Milliseconds()},
47+
Thanos: metadata.Thanos{Labels: map[string]string{"external": "1"}},
48+
},
4549
block3hto4hExt1Ulid: {
4650
BlockMeta: tsdb.BlockMeta{ULID: block3hto4hExt1Ulid, MinTime: 3 * time.Hour.Milliseconds(), MaxTime: 4 * time.Hour.Milliseconds()},
4751
Thanos: metadata.Thanos{Labels: map[string]string{"external": "1"}},
@@ -74,10 +78,6 @@ func TestShuffleShardingGrouper_Groups(t *testing.T) {
7478
BlockMeta: tsdb.BlockMeta{ULID: block6hto8hExt2Ulid, MinTime: 6 * time.Hour.Milliseconds(), MaxTime: 8 * time.Hour.Milliseconds()},
7579
Thanos: metadata.Thanos{Labels: map[string]string{"external": "2"}},
7680
},
77-
block1hto2hExt_1_ulid: {
78-
BlockMeta: tsdb.BlockMeta{ULID: block1hto2hExt_1_ulid, MinTime: 1 * time.Hour.Milliseconds(), MaxTime: 2 * time.Hour.Milliseconds()},
79-
Thanos: metadata.Thanos{Labels: map[string]string{"external": "1"}},
80-
},
8181
block0hto20hExt1Ulid: {
8282
BlockMeta: tsdb.BlockMeta{ULID: block0hto20hExt1Ulid, MinTime: 0 * time.Hour.Milliseconds(), MaxTime: 20 * time.Hour.Milliseconds()},
8383
Thanos: metadata.Thanos{Labels: map[string]string{"external": "1"}},
@@ -86,8 +86,8 @@ func TestShuffleShardingGrouper_Groups(t *testing.T) {
8686
BlockMeta: tsdb.BlockMeta{ULID: block21hto40hExt1Ulid, MinTime: 21 * time.Hour.Milliseconds(), MaxTime: 40 * time.Hour.Milliseconds()},
8787
Thanos: metadata.Thanos{Labels: map[string]string{"external": "1"}},
8888
},
89-
block21hto40hExt1Ulid_copy: {
90-
BlockMeta: tsdb.BlockMeta{ULID: block21hto40hExt1Ulid_copy, MinTime: 21 * time.Hour.Milliseconds(), MaxTime: 40 * time.Hour.Milliseconds()},
89+
block21hto40hExt1UlidCopy: {
90+
BlockMeta: tsdb.BlockMeta{ULID: block21hto40hExt1UlidCopy, MinTime: 21 * time.Hour.Milliseconds(), MaxTime: 40 * time.Hour.Milliseconds()},
9191
Thanos: metadata.Thanos{Labels: map[string]string{"external": "1"}},
9292
},
9393
block0hto45mExt1Ulid: {
@@ -102,8 +102,8 @@ func TestShuffleShardingGrouper_Groups(t *testing.T) {
102102
BlockMeta: tsdb.BlockMeta{ULID: blocklast1hExt1Ulid, MinTime: int64(ulid.Now()) - 1*time.Hour.Milliseconds(), MaxTime: int64(ulid.Now())},
103103
Thanos: metadata.Thanos{Labels: map[string]string{"external": "1"}},
104104
},
105-
blocklast1hExt1Ulid_copy: {
106-
BlockMeta: tsdb.BlockMeta{ULID: blocklast1hExt1Ulid_copy, MinTime: int64(ulid.Now()) - 1*time.Hour.Milliseconds(), MaxTime: int64(ulid.Now())},
105+
blocklast1hExt1UlidCopy: {
106+
BlockMeta: tsdb.BlockMeta{ULID: blocklast1hExt1UlidCopy, MinTime: int64(ulid.Now()) - 1*time.Hour.Milliseconds(), MaxTime: int64(ulid.Now())},
107107
Thanos: metadata.Thanos{Labels: map[string]string{"external": "1"}},
108108
},
109109
}
@@ -138,17 +138,17 @@ func TestShuffleShardingGrouper_Groups(t *testing.T) {
138138
},
139139
"test oldest min time first": {
140140
ranges: []time.Duration{2 * time.Hour, 4 * time.Hour},
141-
blocks: map[ulid.ULID]*metadata.Meta{block1hto2hExt1Ulid: blocks[block1hto2hExt1Ulid], block3hto4hExt1Ulid: blocks[block3hto4hExt1Ulid], block0hto1hExt1Ulid: blocks[block0hto1hExt1Ulid], block2hto3hExt1Ulid: blocks[block2hto3hExt1Ulid], block1hto2hExt_1_ulid: blocks[block1hto2hExt_1_ulid]},
141+
blocks: map[ulid.ULID]*metadata.Meta{block1hto2hExt1Ulid: blocks[block1hto2hExt1Ulid], block3hto4hExt1Ulid: blocks[block3hto4hExt1Ulid], block0hto1hExt1Ulid: blocks[block0hto1hExt1Ulid], block2hto3hExt1Ulid: blocks[block2hto3hExt1Ulid], block1hto2hExt1UlidCopy: blocks[block1hto2hExt1UlidCopy]},
142142
expected: [][]ulid.ULID{
143-
{block1hto2hExt1Ulid, block0hto1hExt1Ulid, block1hto2hExt_1_ulid},
143+
{block1hto2hExt1Ulid, block0hto1hExt1Ulid, block1hto2hExt1UlidCopy},
144144
{block3hto4hExt1Ulid, block2hto3hExt1Ulid},
145145
},
146146
},
147147
"test overlapping blocks": {
148148
ranges: []time.Duration{20 * time.Hour, 40 * time.Hour},
149-
blocks: map[ulid.ULID]*metadata.Meta{block0hto20hExt1Ulid: blocks[block0hto20hExt1Ulid], block21hto40hExt1Ulid: blocks[block21hto40hExt1Ulid], block21hto40hExt1Ulid_copy: blocks[block21hto40hExt1Ulid_copy]},
149+
blocks: map[ulid.ULID]*metadata.Meta{block0hto20hExt1Ulid: blocks[block0hto20hExt1Ulid], block21hto40hExt1Ulid: blocks[block21hto40hExt1Ulid], block21hto40hExt1UlidCopy: blocks[block21hto40hExt1UlidCopy]},
150150
expected: [][]ulid.ULID{
151-
{block21hto40hExt1Ulid, block21hto40hExt1Ulid_copy},
151+
{block21hto40hExt1Ulid, block21hto40hExt1UlidCopy},
152152
},
153153
},
154154
"test imperfect maxTime blocks": {
@@ -160,7 +160,7 @@ func TestShuffleShardingGrouper_Groups(t *testing.T) {
160160
},
161161
"test prematurely created blocks": {
162162
ranges: []time.Duration{2 * time.Hour},
163-
blocks: map[ulid.ULID]*metadata.Meta{blocklast1hExt1Ulid_copy: blocks[blocklast1hExt1Ulid_copy], blocklast1hExt1Ulid: blocks[blocklast1hExt1Ulid]},
163+
blocks: map[ulid.ULID]*metadata.Meta{blocklast1hExt1UlidCopy: blocks[blocklast1hExt1UlidCopy], blocklast1hExt1Ulid: blocks[blocklast1hExt1Ulid]},
164164
expected: [][]ulid.ULID{},
165165
},
166166
}

0 commit comments

Comments
 (0)