From e4444ca48c0aa8415aeb29b27a23fb4d7cd211ec Mon Sep 17 00:00:00 2001 From: codwu Date: Fri, 6 Jul 2018 20:30:27 +0800 Subject: [PATCH] update `addInterval` function and test. Signed-off-by: codwu --- querier_test.go | 6 +++++- tombstones.go | 3 +-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/querier_test.go b/querier_test.go index 51b01de1c..d3ddec407 100644 --- a/querier_test.go +++ b/querier_test.go @@ -557,7 +557,11 @@ func TestBlockQuerierDelete(t *testing.T) { }, }, }, - tombstones: NewMemTombstones().addInterval(1, Interval{1, 3}).addInterval(2, Interval{1, 3}, Interval{6, 10}).addInterval(3, Interval{6, 10}), + tombstones: &memTombstones{mts: map[uint64]Intervals{ + 1: Intervals{{1, 3}}, + 2: Intervals{{1, 3}, {6, 10}}, + 3: Intervals{{6, 10}}, + }}, queries: []query{ { mint: 2, diff --git a/tombstones.go b/tombstones.go index 733a81afb..03389de72 100644 --- a/tombstones.go +++ b/tombstones.go @@ -183,13 +183,12 @@ func (t *memTombstones) Iter(f func(uint64, Intervals) error) error { } // addInterval to an existing memTombstones -func (t *memTombstones) addInterval(ref uint64, itvs ...Interval) *memTombstones { +func (t *memTombstones) addInterval(ref uint64, itvs ...Interval) { t.mtx.Lock() defer t.mtx.Unlock() for _, itv := range itvs { t.mts[ref] = t.mts[ref].add(itv) } - return t } func (memTombstones) Close() error {