From 4f8efdbd5966b8c407d735d0e0a94305906884f5 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 40c5a5eb4..f3dbe9235 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