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

Commit

Permalink
fix the refs logic for the addFast path for createBlock (#504)
Browse files Browse the repository at this point in the history
Signed-off-by: Krasi Georgiev <[email protected]>
  • Loading branch information
krasi-georgiev authored Jan 21, 2019
1 parent 10ba228 commit cc277e3
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions block_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,17 +68,20 @@ func createBlock(tb testing.TB, dir string, nSeries int, mint, maxt int64) strin

lbls, err := labels.ReadLabels(filepath.Join("testdata", "20kseries.json"), nSeries)
testutil.Ok(tb, err)
var ref uint64
refs := make([]uint64, nSeries)

for ts := mint; ts <= maxt; ts++ {
app := head.Appender()
for _, lbl := range lbls {
err := app.AddFast(ref, ts, rand.Float64())
if err == nil {
continue
for i, lbl := range lbls {
if refs[i] != 0 {
err := app.AddFast(refs[i], ts, rand.Float64())
if err == nil {
continue
}
}
ref, err = app.Add(lbl, int64(ts), rand.Float64())
ref, err := app.Add(lbl, int64(ts), rand.Float64())
testutil.Ok(tb, err)
refs[i] = ref
}
err := app.Commit()
testutil.Ok(tb, err)
Expand Down

0 comments on commit cc277e3

Please sign in to comment.