Skip to content
This repository was archived by the owner on Aug 13, 2019. It is now read-only.

Commit ca248e3

Browse files
committed
Fix some stuff I broke during rebase.
Signed-off-by: Callum Styan <[email protected]>
1 parent 1be0c97 commit ca248e3

File tree

2 files changed

+22
-35
lines changed

2 files changed

+22
-35
lines changed

head.go

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -347,20 +347,11 @@ func (h *Head) loadWAL(r *wal.Reader, multiRef map[uint64]uint64) (err error) {
347347
}
348348

349349
var (
350-
<<<<<<< HEAD
351-
dec RecordDecoder
352-
series []RefSeries
353-
samples []RefSample
354-
tstones []Stone
355-
allStones = newMemTombstones()
356-
=======
357350
dec record.RecordDecoder
358351
series []record.RefSeries
359352
samples []record.RefSample
360353
tstones []tombstones.Stone
361354
allStones = tombstones.NewMemTombstones()
362-
err error
363-
>>>>>>> Move tombstones to it's own package.
364355
)
365356
defer func() {
366357
if err := allStones.Close(); err != nil {
@@ -474,15 +465,11 @@ func (h *Head) loadWAL(r *wal.Reader, multiRef map[uint64]uint64) (err error) {
474465
}
475466
wg.Wait()
476467

477-
<<<<<<< HEAD
478468
if r.Err() != nil {
479469
return errors.Wrap(r.Err(), "read records")
480470
}
481471

482-
if err := allStones.Iter(func(ref uint64, dranges Intervals) error {
483-
=======
484472
if err := allStones.Iter(func(ref uint64, dranges tombstones.Intervals) error {
485-
>>>>>>> Move tombstones to it's own package.
486473
return h.chunkRewrite(ref, dranges)
487474
}); err != nil {
488475
return errors.Wrap(r.Err(), "deleting samples from tombstones")
@@ -1368,7 +1355,7 @@ func (h *Head) getOrCreateWithID(id, hash uint64, lset labels.Labels) (*record.M
13681355
return s, true
13691356
}
13701357

1371-
// seriesHashmap is a simple hashmap for memSeries by their label set. It is built
1358+
// seriesHashmap is a simple hashmap for MemSeries by their label set. It is built
13721359
// on top of a regular hashmap and holds a slice of series to resolve hash collisions.
13731360
// Its methods require the hash to be submitted with it to avoid re-computations throughout
13741361
// the code.

head_test.go

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -102,28 +102,28 @@ func TestHead_ReadWAL(t *testing.T) {
102102
for _, compress := range []bool{false, true} {
103103
t.Run(fmt.Sprintf("compress=%t", compress), func(t *testing.T) {
104104
entries := []interface{}{
105-
[]RefSeries{
105+
[]record.RefSeries{
106106
{Ref: 10, Labels: labels.FromStrings("a", "1")},
107107
{Ref: 11, Labels: labels.FromStrings("a", "2")},
108108
{Ref: 100, Labels: labels.FromStrings("a", "3")},
109109
},
110-
[]RefSample{
110+
[]record.RefSample{
111111
{Ref: 0, T: 99, V: 1},
112112
{Ref: 10, T: 100, V: 2},
113113
{Ref: 100, T: 100, V: 3},
114114
},
115-
[]RefSeries{
115+
[]record.RefSeries{
116116
{Ref: 50, Labels: labels.FromStrings("a", "4")},
117117
// This series has two refs pointing to it.
118118
{Ref: 101, Labels: labels.FromStrings("a", "3")},
119119
},
120-
[]RefSample{
120+
[]record.RefSample{
121121
{Ref: 10, T: 101, V: 5},
122122
{Ref: 50, T: 101, V: 6},
123123
{Ref: 101, T: 101, V: 7},
124124
},
125-
[]Stone{
126-
{ref: 0, intervals: []Interval{{Mint: 99, Maxt: 101}}},
125+
[]tombstones.Stone{
126+
{Ref: 0, Intervals: []tombstones.Interval{{Mint: 99, Maxt: 101}}},
127127
},
128128
}
129129
dir, err := ioutil.TempDir("", "test_read_wal")
@@ -148,10 +148,10 @@ func TestHead_ReadWAL(t *testing.T) {
148148
s50 := head.series.getByID(50)
149149
s100 := head.series.getByID(100)
150150

151-
testutil.Equals(t, labels.FromStrings("a", "1"), s10.lset)
152-
testutil.Equals(t, (*memSeries)(nil), s11) // Series without samples should be garbage colected at head.Init().
153-
testutil.Equals(t, labels.FromStrings("a", "4"), s50.lset)
154-
testutil.Equals(t, labels.FromStrings("a", "3"), s100.lset)
151+
testutil.Equals(t, labels.FromStrings("a", "1"), s10.Lset)
152+
testutil.Equals(t, (*record.MemSeries)(nil), s11) // Series without samples should be garbage colected at head.Init().
153+
testutil.Equals(t, labels.FromStrings("a", "4"), s50.Lset)
154+
testutil.Equals(t, labels.FromStrings("a", "3"), s100.Lset)
155155

156156
expandChunk := func(c chunkenc.Iterator) (x []sample) {
157157
for c.Next() {
@@ -161,9 +161,9 @@ func TestHead_ReadWAL(t *testing.T) {
161161
testutil.Ok(t, c.Err())
162162
return x
163163
}
164-
testutil.Equals(t, []sample{{100, 2}, {101, 5}}, expandChunk(s10.iterator(0)))
165-
testutil.Equals(t, []sample{{101, 6}}, expandChunk(s50.iterator(0)))
166-
testutil.Equals(t, []sample{{100, 3}, {101, 7}}, expandChunk(s100.iterator(0)))
164+
testutil.Equals(t, []sample{{100, 2}, {101, 5}}, expandChunk(s10.Iterator(0)))
165+
testutil.Equals(t, []sample{{101, 6}}, expandChunk(s50.Iterator(0)))
166+
testutil.Equals(t, []sample{{100, 3}, {101, 7}}, expandChunk(s100.Iterator(0)))
167167
})
168168
}
169169
}
@@ -328,14 +328,14 @@ func TestHeadDeleteSeriesWithoutSamples(t *testing.T) {
328328
for _, compress := range []bool{false, true} {
329329
t.Run(fmt.Sprintf("compress=%t", compress), func(t *testing.T) {
330330
entries := []interface{}{
331-
[]RefSeries{
331+
[]record.RefSeries{
332332
{Ref: 10, Labels: labels.FromStrings("a", "1")},
333333
},
334-
[]RefSample{},
335-
[]RefSeries{
334+
[]record.RefSample{},
335+
[]record.RefSeries{
336336
{Ref: 50, Labels: labels.FromStrings("a", "2")},
337337
},
338-
[]RefSample{
338+
[]record.RefSample{
339339
{Ref: 50, T: 80, V: 1},
340340
{Ref: 50, T: 90, V: 1},
341341
},
@@ -1056,17 +1056,17 @@ func TestHead_LogRollback(t *testing.T) {
10561056

10571057
testutil.Equals(t, 1, len(recs))
10581058

1059-
series, ok := recs[0].([]RefSeries)
1059+
series, ok := recs[0].([]record.RefSeries)
10601060
testutil.Assert(t, ok, "expected series record but got %+v", recs[0])
1061-
testutil.Equals(t, []RefSeries{{Ref: 1, Labels: labels.FromStrings("a", "b")}}, series)
1061+
testutil.Equals(t, []record.RefSeries{{Ref: 1, Labels: labels.FromStrings("a", "b")}}, series)
10621062
})
10631063
}
10641064
}
10651065

10661066
// TestWalRepair_DecodingError ensures that a repair is run for an error
10671067
// when decoding a record.
10681068
func TestWalRepair_DecodingError(t *testing.T) {
1069-
var enc RecordEncoder
1069+
var enc record.RecordEncoder
10701070
for name, test := range map[string]struct {
10711071
corrFunc func(rec []byte) []byte // Func that applies the corruption to a record.
10721072
rec []byte
@@ -1078,7 +1078,7 @@ func TestWalRepair_DecodingError(t *testing.T) {
10781078
// Do not modify the base record because it is Logged multiple times.
10791079
res := make([]byte, len(rec))
10801080
copy(res, rec)
1081-
res[0] = byte(RecordInvalid)
1081+
res[0] = byte(record.RecordInvalid)
10821082
return res
10831083
},
10841084
enc.Series([]record.RefSeries{{Ref: 1, Labels: labels.FromStrings("a", "b")}}, []byte{}),

0 commit comments

Comments
 (0)