Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ We use *breaking* word for marking changes that are not backward compatible (rel

## Unreleased

### Fixed

- [#2238](https://github.com/thanos-io/thanos/pull/2238) Ruler: Fixed Issue #2204 bug in alert queue signalling filled up queue and alerts were dropped

## [v0.11.0](https://github.com/thanos-io/thanos/releases/tag/v0.11.0-rc.1) - 2020.03.02

### Fixed
Expand Down
6 changes: 6 additions & 0 deletions pkg/alert/alert.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,12 @@ func (q *Queue) Pop(termc <-chan struct{}) []*Alert {

q.popped.Add(float64(n))

if len(q.queue) > 0 {
select {
case q.morec <- struct{}{}:
default:
}
}
return as[:n]
}

Expand Down
25 changes: 25 additions & 0 deletions pkg/alert/alert_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,31 @@ import (
"github.com/thanos-io/thanos/pkg/testutil"
)

func TestQueue_Pop_all_Pushed(t *testing.T) {
qcapacity := 10
batchsize := 1
pushes := 3

q := NewQueue(
nil, nil, qcapacity, batchsize, nil, nil,
)
for i := 0; i < pushes; i++ {
q.Push([]*Alert{
{},
{},
})
}

timeoutc := make(chan struct{}, 1)
time.AfterFunc(time.Second, func() { timeoutc <- struct{}{} })
popped := 0
for p := q.Pop(timeoutc); p != nil; p = q.Pop(timeoutc) {
popped += len(p)
}

testutil.Equals(t, pushes*2, popped)
}

func TestQueue_Push_Relabelled(t *testing.T) {
q := NewQueue(
nil, nil, 10, 10,
Expand Down