This is an automated email from the ASF dual-hosted git repository. zwoop pushed a commit to branch 7.1.x in repository https://gitbox.apache.org/repos/asf/trafficserver.git
commit 369db089b047bd0d3b044db37e96e127245efb4c Author: jrushf1239k <[email protected]> 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. (cherry picked from commit 1aed2942411fa98047095cf93a18e0618e84bcd4) --- 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 "[email protected]" <[email protected]>.
