You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by jr...@apache.org on 2017/03/20 15:31:06 UTC

[trafficserver] branch master updated: Insure that parent health stats are updated properly on a markdown when the retry window has elapsed. This avoids premature markdowns.

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

jrushford pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git

The following commit(s) were added to refs/heads/master by this push:
       new  1aed294   Insure that parent health stats are updated properly on a markdown when the retry window has elapsed.  This avoids premature markdowns.
1aed294 is described below

commit 1aed2942411fa98047095cf93a18e0618e84bcd4
Author: jrushf1239k <Jo...@cable.comcast.com>
AuthorDate: Tue Mar 7 18:01:25 2017 +0000

    Insure that parent health stats are updated properly on a markdown
    when the retry window has elapsed.  This avoids premature markdowns.
---
 proxy/ParentConsistentHash.cc | 14 ++++++++++++--
 proxy/ParentRoundRobin.cc     | 14 ++++++++++++--
 2 files changed, 24 insertions(+), 4 deletions(-)

diff --git a/proxy/ParentConsistentHash.cc b/proxy/ParentConsistentHash.cc
index 8eedfe1..4d82601 100644
--- a/proxy/ParentConsistentHash.cc
+++ b/proxy/ParentConsistentHash.cc
@@ -279,7 +279,7 @@ ParentConsistentHash::markParentDown(const ParentSelectionPolicy *policy, Parent
     //   it relates to how long the parent has been down.
     now = time(nullptr);
 
-    // Mark the parent as down
+    // Mark the parent failure time.
     ink_atomic_swap(&pRec->failedAt, now);
 
     // If this is clean mark down and not a failed retry, we
@@ -291,7 +291,17 @@ ParentConsistentHash::markParentDown(const ParentSelectionPolicy *policy, Parent
     Note("Parent %s marked as down %s:%d", (result->retry) ? "retry" : "initially", pRec->hostname, pRec->port);
 
   } else {
-    int old_count = ink_atomic_increment(&pRec->failCount, 1);
+    int old_count = 0;
+    now           = time(NULL);
+
+    // if the last failure was outside the retry window, set the failcount to 1
+    // and failedAt to now.
+    if ((pRec->failedAt + policy->ParentRetryTime) < now) {
+      ink_atomic_swap(&pRec->failCount, 1);
+      ink_atomic_swap(&pRec->failedAt, now);
+    } else {
+      old_count = ink_atomic_increment(&pRec->failCount, 1);
+    }
 
     Debug("parent_select", "Parent fail count increased to %d for %s:%d", old_count + 1, pRec->hostname, pRec->port);
     new_fail_count = old_count + 1;
diff --git a/proxy/ParentRoundRobin.cc b/proxy/ParentRoundRobin.cc
index 66e5647..82b3aae 100644
--- a/proxy/ParentRoundRobin.cc
+++ b/proxy/ParentRoundRobin.cc
@@ -220,7 +220,7 @@ ParentRoundRobin::markParentDown(const ParentSelectionPolicy *policy, ParentResu
     //   it relates to how long the parent has been down.
     now = time(nullptr);
 
-    // Mark the parent as down
+    // Mark the parent failure time.
     ink_atomic_swap(&pRec->failedAt, now);
 
     // If this is clean mark down and not a failed retry, we
@@ -232,7 +232,17 @@ ParentRoundRobin::markParentDown(const ParentSelectionPolicy *policy, ParentResu
     Note("Parent %s marked as down %s:%d", (result->retry) ? "retry" : "initially", pRec->hostname, pRec->port);
 
   } else {
-    int old_count = ink_atomic_increment(&pRec->failCount, 1);
+    int old_count = 0;
+    now           = time(NULL);
+
+    // if the last failure was outside the retry window, set the failcount to 1
+    // and failedAt to now.
+    if ((pRec->failedAt + policy->ParentRetryTime) < now) {
+      ink_atomic_swap(&pRec->failCount, 1);
+      ink_atomic_swap(&pRec->failedAt, now);
+    } else {
+      old_count = ink_atomic_increment(&pRec->failCount, 1);
+    }
 
     Debug("parent_select", "Parent fail count increased to %d for %s:%d", old_count + 1, pRec->hostname, pRec->port);
     new_fail_count = old_count + 1;

-- 
To stop receiving notification emails like this one, please contact
['"commits@trafficserver.apache.org" <co...@trafficserver.apache.org>'].