From 1d94eb8d958ba228f3d19c8a4838f10dc46f7a86 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 9891546f5..4bebe2b76 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