You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by ja...@apache.org on 2016/05/02 17:34:12 UTC

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

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

jacksontj pushed a commit to branch master
in repository https://git-dual.apache.org/repos/asf/trafficserver.git

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

commit 131875cbe7b0975c8c3c4f3d20aa55a5c7caba86
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
---
 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>'].