You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by so...@apache.org on 2016/05/03 22:03:27 UTC

[trafficserver] branch 6.2.x updated: TS-4403: Fix stale-while-revalidate on DNS lookup failures (#609)

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

sorber pushed a commit to branch 6.2.x
in repository https://git-dual.apache.org/repos/asf/trafficserver.git

The following commit(s) were added to refs/heads/6.2.x by this push:
       new  af91bf8   TS-4403: Fix stale-while-revalidate on DNS lookup failures (#609)
af91bf8 is described below

commit af91bf80d8a6ca1a85056c1ff960f8848b7dfac3
Author: Thomas Jackson <ja...@gmail.com>
AuthorDate: Mon May 2 08:34:05 2016 -0700

    TS-4403: Fix stale-while-revalidate on DNS lookup failures (#609)
    
    HostDB's "stale-while-revalidate" feature allows hostdb to return stale records while doing the DNS lookup in the background. This works properly in the case where the resolver goes away, but in the case that an error was returned from the resolver the record in cache was thrown away. This means that a transient error out in the DNS infrastructure would cause ATS to drop its stale record it would have contently served-- this patch simply makes hostdb honor its stale-while-revalidate c [...]
    
    This closes #609
    (cherry picked from commit 131875cbe7b0975c8c3c4f3d20aa55a5c7caba86)
---
 iocore/hostdb/HostDB.cc | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/iocore/hostdb/HostDB.cc b/iocore/hostdb/HostDB.cc
index 8360a9d..b83ddff 100644
--- a/iocore/hostdb/HostDB.cc
+++ b/iocore/hostdb/HostDB.cc
@@ -1501,7 +1501,12 @@ HostDBContinuation::dnsEvent(int event, HostEnt *e)
     HostDBInfo *r = NULL;
     IpAddr tip; // temp storage if needed.
 
-    if (is_byname()) {
+    // If the DNS lookup failed (errors such as NXDOMAIN, SERVFAIL, etc.) but we have an old record
+    // which is okay with being served stale-- lets continue to serve the stale record as long as
+    // the record is willing to be served.
+    if (failed && old_r && old_r->serve_stale_but_revalidate()) {
+      r = old_r;
+    } else if (is_byname()) {
       if (first)
         ip_addr_set(tip, af, first);
       r = lookup_done(tip, md5.host_name, is_rr, ttl_seconds, failed ? 0 : &e->srv_hosts);

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