mirror of
https://github.com/prometheus/prometheus.git
synced 2025-03-05 20:59:13 -08:00
head.checkWALExpiry -> head.getWALExpiry; check implies a comparison that doesn't happen in the function
Signed-off-by: Patryk Prus <p@trykpr.us>
This commit is contained in:
parent
786d3d99ba
commit
f2f1357917
|
@ -1262,7 +1262,7 @@ func (h *Head) IsQuerierCollidingWithTruncation(querierMint, querierMaxt int64)
|
|||
return false, false, 0
|
||||
}
|
||||
|
||||
func (h *Head) checkWALExpiry(id chunks.HeadSeriesRef) (int, bool) {
|
||||
func (h *Head) getWALExpiry(id chunks.HeadSeriesRef) (int, bool) {
|
||||
h.walExpiriesMtx.Lock()
|
||||
defer h.walExpiriesMtx.Unlock()
|
||||
|
||||
|
@ -1286,7 +1286,7 @@ func (h *Head) keepSeriesInWALCheckpoint(id chunks.HeadSeriesRef, last int) bool
|
|||
}
|
||||
|
||||
// Keep the record if the series has an expiry set.
|
||||
keepUntil, ok := h.checkWALExpiry(id)
|
||||
keepUntil, ok := h.getWALExpiry(id)
|
||||
return ok && keepUntil > last
|
||||
}
|
||||
|
||||
|
|
|
@ -729,13 +729,13 @@ func TestHead_ReadWAL(t *testing.T) {
|
|||
// Duplicate series record should not be written to the head.
|
||||
require.Nil(t, s101)
|
||||
// But it should have a WAL expiry set.
|
||||
keepUntil, ok := head.checkWALExpiry(101)
|
||||
keepUntil, ok := head.getWALExpiry(101)
|
||||
require.True(t, ok)
|
||||
_, last, err := wlog.Segments(w.Dir())
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, last, keepUntil)
|
||||
// Only the duplicate series record should have a WAL expiry set.
|
||||
_, ok = head.checkWALExpiry(50)
|
||||
_, ok = head.getWALExpiry(50)
|
||||
require.False(t, ok)
|
||||
|
||||
expandChunk := func(c chunkenc.Iterator) (x []sample) {
|
||||
|
|
Loading…
Reference in a new issue