You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by zw...@apache.org on 2020/03/31 18:53:14 UTC

[trafficserver] branch 8.1.x updated: Fixes Issue #6321 caused when proxy.config.http.no_dns_just_forward_to_parent is enabled. When this configuration variable is enabled, a parent selection strategies findParent() function is called twice on each transaction resulting in unexpected results such as every other parent is only used in a strict round robin strategy.

This is an automated email from the ASF dual-hosted git repository.

zwoop pushed a commit to branch 8.1.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/8.1.x by this push:
     new ffbaa4a  Fixes Issue #6321 caused when proxy.config.http.no_dns_just_forward_to_parent is enabled.  When this configuration variable is enabled, a parent selection strategies findParent() function is called twice on each transaction resulting in unexpected results such as every other parent is only used in a strict round robin strategy.
ffbaa4a is described below

commit ffbaa4a78e796305a79bcc9322cbd83da01ebfe5
Author: John Rushford <jr...@apache.org>
AuthorDate: Thu Jan 16 20:01:23 2020 +0000

    Fixes Issue #6321 caused when proxy.config.http.no_dns_just_forward_to_parent
    is enabled.  When this configuration variable is enabled, a parent selection
    strategies findParent() function is called twice on each transaction resulting
    in unexpected results such as every other parent is only used in a strict
    round robin strategy.
    
    (cherry picked from commit 98893b6df4e9acfe68c770ec6c8ef75bcebd0919)
    
    Conflicts:
     proxy/ParentSelection.cc
---
 proxy/ParentSelection.cc | 36 ++++++++++++++++++++++++++++++------
 1 file changed, 30 insertions(+), 6 deletions(-)

diff --git a/proxy/ParentSelection.cc b/proxy/ParentSelection.cc
index 296fa99..057a81e 100644
--- a/proxy/ParentSelection.cc
+++ b/proxy/ParentSelection.cc
@@ -140,6 +140,9 @@ ParentConfigParams::findParent(HttpRequestData *rdata, ParentResult *result, uns
     return;
   }
 
+  // Initialize the result structure
+  result->reset();
+
   tablePtr->Match(rdata, result);
   rec = result->rec;
 
@@ -240,17 +243,38 @@ ParentConfigParams::nextParent(HttpRequestData *rdata, ParentResult *result, uns
 bool
 ParentConfigParams::parentExists(HttpRequestData *rdata)
 {
-  unsigned int fail_threshold = policy.FailThreshold;
-  unsigned int retry_time     = policy.ParentRetryTime;
+  P_table *tablePtr = parent_table;
+  ParentRecord *rec = nullptr;
   ParentResult result;
 
-  findParent(rdata, &result, fail_threshold, retry_time);
+  // Initialize the result structure;
+  result.reset();
 
-  if (result.result == PARENT_SPECIFIED) {
-    return true;
-  } else {
+  tablePtr->Match(rdata, &result);
+  rec = result.rec;
+
+  if (rec == nullptr) {
+    Debug("parent_select", "No matching parent record was found for the request.");
     return false;
   }
+
+  if (rec->num_parents > 0) {
+    for (int ii = 0; ii < rec->num_parents; ii++) {
+      if (rec->parents[ii].available) {
+        Debug("parent_select", "found available parent: %s", rec->parents[ii].hostname);
+        return true;
+      }
+    }
+  }
+  if (rec->secondary_parents && rec->num_secondary_parents > 0) {
+    for (int ii = 0; ii < rec->num_secondary_parents; ii++) {
+      if (rec->secondary_parents[ii].available) {
+        Debug("parent_select", "found available parent: %s", rec->secondary_parents[ii].hostname);
+        return true;
+      }
+    }
+  }
+  return false;
 }
 
 int ParentConfig::m_id = 0;