Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: prevent silently dropped writes with overlapping shards #21946

Merged
merged 6 commits into from
Jul 27, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
test: rework how list is built in test-case
danxmoran committed Jul 27, 2021

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit 14b1b2c0e4df7c80bbb153b6f2050ef22a458313
42 changes: 20 additions & 22 deletions v1/coordinator/points_writer_internal_test.go
Original file line number Diff line number Diff line change
@@ -14,18 +14,17 @@ func TestSgList_ShardGroupAt(t *testing.T) {
return base.Add(time.Duration(24*n) * time.Hour)
}

list := sgList{
items: meta.ShardGroupInfos{
{ID: 1, StartTime: day(0), EndTime: day(1)},
{ID: 2, StartTime: day(1), EndTime: day(2)},
{ID: 3, StartTime: day(2), EndTime: day(3)},
// SG day 3 to day 4 missing...
{ID: 4, StartTime: day(4), EndTime: day(5)},
{ID: 5, StartTime: day(5), EndTime: day(6)},
},
needsSort: true,
earliest: day(0),
latest: day(6),
items := meta.ShardGroupInfos{
{ID: 1, StartTime: day(0), EndTime: day(1)},
{ID: 2, StartTime: day(1), EndTime: day(2)},
{ID: 3, StartTime: day(2), EndTime: day(3)},
// SG day 3 to day 4 missing...
{ID: 4, StartTime: day(4), EndTime: day(5)},
{ID: 5, StartTime: day(5), EndTime: day(6)},
}
var list sgList
for _, i := range items {
list.Add(i)
}

examples := []struct {
@@ -62,16 +61,15 @@ func TestSgList_ShardGroupAtOverlapping(t *testing.T) {
return base.Add(time.Duration(24*n) * time.Hour)
}

list := sgList{
items: meta.ShardGroupInfos{
{ID: 1, StartTime: hour(5), EndTime: hour(6)},
{ID: 2, StartTime: hour(6), EndTime: hour(7)},
// Day-long shard overlaps with the two hour-long shards.
{ID: 3, StartTime: base, EndTime: day(1)},
},
needsSort: true,
earliest: base,
latest: day(1),
items := meta.ShardGroupInfos{
{ID: 1, StartTime: hour(5), EndTime: hour(6)},
{ID: 2, StartTime: hour(6), EndTime: hour(7)},
// Day-long shard overlaps with the two hour-long shards.
{ID: 3, StartTime: base, EndTime: day(1)},
}
var list sgList
for _, i := range items {
list.Add(i)
}

examples := []struct {