Skip to content
Closed
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
2 changes: 1 addition & 1 deletion pkg/ring/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ func (d *Desc) TokensFor(id string) (tokens, other []uint32) {
func (i *IngesterDesc) IsHealthy(op Operation, heartbeatTimeout time.Duration) bool {
if op == Write && i.State != ACTIVE {
return false
} else if op == Read && i.State == JOINING {
} else if op == Read && i.State != ACTIVE && i.State != LEAVING {
return false
}
return time.Now().Sub(time.Unix(i.Timestamp, 0)) <= heartbeatTimeout
Expand Down
12 changes: 12 additions & 0 deletions pkg/ring/model_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,18 @@ func TestIngesterDesc_IsHealthy(t *testing.T) {
writeExpected: false,
readExpected: true,
},
"PENDING ingester with last keepalive newer than timeout": {
ingester: &IngesterDesc{State: PENDING, Timestamp: time.Now().Add(-30 * time.Second).Unix()},
timeout: time.Minute,
writeExpected: false,
readExpected: false,
},
"LEFT ingester with last keepalive newer than timeout": {
ingester: &IngesterDesc{State: LEFT, Timestamp: time.Now().Add(-30 * time.Second).Unix()},
timeout: time.Minute,
writeExpected: false,
readExpected: false,
},
}

for testName, testData := range tests {
Expand Down