]> granicus.if.org Git - pdns/commitdiff
dnsdist: Comment that the rings shouldn't be resized at run-time
authorRemi Gacogne <remi.gacogne@powerdns.com>
Thu, 29 Mar 2018 09:34:07 +0000 (11:34 +0200)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Thu, 29 Mar 2018 09:37:52 +0000 (11:37 +0200)
pdns/dnsdist-rings.hh

index f9810efad448a3cee662092b006af86e250afe0b..0ff9a1ec9438ba56f99023ac7daabc3112e0a188 100644 (file)
@@ -71,6 +71,7 @@ struct Rings {
   }
   std::unordered_map<int, vector<boost::variant<string,double> > > 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)