From ec999ff397ee136534a1f171508a0aae7e298fb9 Mon Sep 17 00:00:00 2001 From: Tom Wilkie Date: Wed, 19 Jul 2017 16:27:19 +0100 Subject: [PATCH] Prevent number of remote write shards from going negative. This can happen in the situation where the system scales up the number of shards massively (to deal with some backlog), then scales it down again as the number of samples sent during the time period is less than the number received. --- storage/remote/queue_manager.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/storage/remote/queue_manager.go b/storage/remote/queue_manager.go index 6813566a4..2dd14e06d 100644 --- a/storage/remote/queue_manager.go +++ b/storage/remote/queue_manager.go @@ -339,6 +339,8 @@ func (t *QueueManager) calculateDesiredShards() { numShards := int(math.Ceil(desiredShards)) if numShards > t.cfg.MaxShards { numShards = t.cfg.MaxShards + } else if numShards < 1 { + numShards = 1 } if numShards == t.numShards { return