From: Remi Gacogne Date: Thu, 29 Mar 2018 09:34:07 +0000 (+0200) Subject: dnsdist: Comment that the rings shouldn't be resized at run-time X-Git-Tag: dnsdist-1.3.0~1^2~2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=be67763ad8f396a3d336bec93fb902a58783e3a4;p=pdns dnsdist: Comment that the rings shouldn't be resized at run-time --- diff --git a/pdns/dnsdist-rings.hh b/pdns/dnsdist-rings.hh index f9810efad..0ff9a1ec9 100644 --- a/pdns/dnsdist-rings.hh +++ b/pdns/dnsdist-rings.hh @@ -71,6 +71,7 @@ struct Rings { } std::unordered_map > > getTopBandwidth(unsigned int numentries); size_t numDistinctRequestors(); + /* This function should only be called at configuration time before any query or response has been inserted */ void setCapacity(size_t newCapacity, size_t numberOfShards) { if (numberOfShards < d_numberOfShards) { @@ -92,6 +93,10 @@ struct Rings { shard->respRing.set_capacity(newCapacity / numberOfShards); } } + + /* we just recreated the shards so they are now empty */ + d_nbQueryEntries = 0; + d_nbResponseEntries = 0; } void setNumberOfLockRetries(size_t retries)