Re: negative_dns_ttl in STABLE5 [related patch]

From: Henrik Nordstrom <hno@dont-contact.us>
Date: Mon, 18 Oct 1999 20:33:42 +0200

Charles Bruneteau wrote:

> > "Pragma: no-cache" invalidates both object and DNS caches.
>
> Are you certain of this Henrik ?

I was.. but it doesn't.

My memory said it was the intention once upon a time, but a closer look
at the source shows that it does not quite work the way I remembered.
Only negative cached DNS entries get released on reload (and only if
Squid has the object cached..)

Attached is a small patch fixing two issues related to this:

a) Have PURGE also purge the IP-cache from any (valid or not) DNS entry.
b) Release negatively cached DNS entries on reload regardless if Squid
has the reloaded object in cache or not.

Having reload to invalidate seemingly valid DNS entries is perhaps not a
so great idea. The amount of reloads is quite large, DNS servers usually
overloaded, and changes in DNS is fairly rare with common practice that
such changes takes time to propagate.

The two changes above make the operation somewhat cleaner: makes users
able to quickly get rid of intermettent DNS errors if they insist, and
allows the administrator to manually purge specific DNS entries if so
required.

(the patch is named 2.3.DEVEL but applies without problems to 2.2.STABLE
as well)

--
Henrik Nordstrom
Squid hacker

Mon Oct 18 20:21:38 CEST 1999
Modified Files in squid/src
        client_side.c

Two changes in how IP-cache entries are invalidated

a) Have PURGE also purge the IP-cache from any (valid or not) DNS entry.
b) Release negatively cached DNS entries on reload regardless if Squid has
   the reloaded object cached or not.

Index: squid/src/client_side.c
diff -u squid/src/client_side.c:1.1.1.43.2.9 squid/src/client_side.c:1.1.1.43.2.10
--- squid/src/client_side.c:1.1.1.43.2.9 Sat Oct 2 01:15:18 1999
+++ squid/src/client_side.c Mon Oct 18 20:21:36 1999
@@ -572,6 +572,8 @@
         return;
     }
     http->log_type = LOG_TCP_MISS;
+ /* Release both IP and object cache entries */
+ ipcacheInvalidate(http->request->host);
     if ((entry = storeGetPublic(http->uri, METHOD_GET)) == NULL) {
         http->http_code = HTTP_NOT_FOUND;
     } else {
@@ -1829,6 +1831,13 @@
         /* We can generate a HEAD reply from a cached GET object */
         e = http->entry = storeGetPublic(http->uri, METHOD_GET);
     }
+ /* Release negatively cached IP-cache entries on reload */
+ if (r->flags.nocache)
+ ipcacheReleaseInvalid(r->host);
+#if HTTP_VIOLATIONS
+ else if (r->flags.nocache_hack)
+ ipcacheReleaseInvalid(r->host);
+#endif
 #if USE_CACHE_DIGESTS
     http->lookup_type = e ? "HIT" : "MISS";
 #endif
@@ -1854,12 +1863,6 @@
         return LOG_TCP_HIT;
     }
 #if HTTP_VIOLATIONS
- if (r->flags.nocache_hack) {
- /* if nocache_hack is set, nocache should always be clear, right? */
- assert(!r->flags.nocache);
- ipcacheReleaseInvalid(r->host);
- /* continue! */
- }
     if (e->store_status == STORE_PENDING) {
         if (r->flags.nocache || r->flags.nocache_hack) {
             debug(33, 3) ("Clearing no-cache for STORE_PENDING request\n\t%s\n",
Received on Mon Oct 18 1999 - 17:50:46 MDT

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:48:57 MST