]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
dnsdist: Fix `whashed` and `wrandom` using the wrong parameter for consistent hashing
authorRemi Gacogne <remi.gacogne@powerdns.com>
Wed, 4 Dec 2024 14:28:50 +0000 (15:28 +0100)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Wed, 4 Dec 2024 14:28:50 +0000 (15:28 +0100)
pdns/dnsdistdist/dnsdist-lbpolicies.cc

index 337a062669d89a38ef0d8cfb49b269c977210949..298565cdd6abf8e7825140bc89f5b8be3d9eb111 100644 (file)
@@ -87,7 +87,7 @@ template <class T> static std::shared_ptr<DownstreamState> getValRandom(const Se
   int sum = 0;
 
   size_t usableServers = 0;
-  const auto weightedBalancingFactor = dnsdist::configuration::getImmutableConfiguration().d_consistentHashBalancingFactor;
+  const auto weightedBalancingFactor = dnsdist::configuration::getImmutableConfiguration().d_weightedBalancingFactor;
   for (const auto& d : servers) {      // w=1, w=10 -> 1, 11
     if (d.second->isUp() && (weightedBalancingFactor == 0 || (static_cast<double>(d.second->outstanding.load()) <= (targetLoad * d.second->d_config.d_weight)))) {
       // Don't overflow sum when adding high weights
@@ -121,7 +121,7 @@ static shared_ptr<DownstreamState> valrandom(const unsigned int val, const Serve
 {
   using ValRandomType = int;
   double targetLoad = std::numeric_limits<double>::max();
-  const auto weightedBalancingFactor = dnsdist::configuration::getImmutableConfiguration().d_consistentHashBalancingFactor;
+  const auto weightedBalancingFactor = dnsdist::configuration::getImmutableConfiguration().d_weightedBalancingFactor;
   if (weightedBalancingFactor > 0) {
     /* we start with one, representing the query we are currently handling */
     double currentLoad = 1;