Skip to content

Commit

Permalink
compact: standardize group key order
Browse files Browse the repository at this point in the history
  • Loading branch information
fabxc committed Mar 8, 2018
1 parent 89b14b5 commit 064034d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pkg/compact/compact.go
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ func newGroup(

// Key returns an identifier for the group.
func (cg *Group) Key() string {
return fmt.Sprintf("%s@%d", cg.labels, cg.resolution)
return fmt.Sprintf("%d@%s", cg.resolution, cg.labels)
}

// Add the block with the given meta to the group.
Expand Down
4 changes: 2 additions & 2 deletions pkg/compact/compact_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,9 +171,9 @@ func TestSyncer_GarbageCollect(t *testing.T) {
groups, err := sy.Groups()
testutil.Ok(t, err)

testutil.Equals(t, "{}@0", groups[0].Key())
testutil.Equals(t, "0@{}", groups[0].Key())
testutil.Equals(t, []ulid.ULID{metas[9].ULID, m3.ULID}, groups[0].IDs())
testutil.Equals(t, "{}@1000", groups[1].Key())
testutil.Equals(t, "1000@{}", groups[1].Key())
testutil.Equals(t, []ulid.ULID{m4.ULID}, groups[1].IDs())
}

Expand Down

0 comments on commit 064034d

Please sign in to comment.