[patch] bind-8.3.3 less delay for small numbers of notifies

dean gaudet dean-list-bind-workers at arctic.org
Sun Oct 5 18:45:09 UTC 2003


when making small numbers of zone changes in a reload (on a server with
hundreds of zones) i found it really painful waiting for arbitrarily long
delays.  this patch makes the delay depend on the number of notifies we
need to issue rather than on the number of zones configured.

-dean

--- bind-8.3.3.orig/src/bin/named/ns_notify.c
+++ bind-8.3.3/src/bin/named/ns_notify.c
@@ -77,6 +77,10 @@

 /* Local. */

+/* number_of_notifies is the total number of entries in both
+ * the pending_notifies and loading_notifies lists
+ */
+static unsigned number_of_notifies;
 static LIST(struct pnotify) pending_notifies;
 static LIST(struct pnotify) loading_notifies;

@@ -134,12 +138,15 @@

 	if (loading != 0) {
 		APPEND(loading_notifies, ni, link);
+		++number_of_notifies;
 		return;
 	}

-	/* Delay notification for from five seconds up to fifteen minutes. */
-	max_delay = MIN(nzones, 895);
-	max_delay = MAX(max_delay, 25);
+	/* Delay notification for from five seconds up to fifteen minutes
+	 * depending on the total number of notifies we need to issue.
+	 */
+	max_delay = MIN(number_of_notifies, 895);
+	max_delay = MAX(max_delay, 10);
 	delay = 5 + (rand() % max_delay);
 	if (evSetTimer(ev, notify_timer, ni,
 		       evAddTime(evNowTime(), evConsTime(delay, 0)),
@@ -153,6 +160,7 @@

 	zp->z_flags |= Z_NOTIFY;
 	APPEND(pending_notifies, ni, link);
+	++number_of_notifies;
 	ns_debug(ns_log_notify, 3,
 		 "ns_notify(%s, %s, %s): ni %p, zp %p, delay %d",
 		 (dname && *dname) ? dname : ".",
@@ -167,6 +175,7 @@
 	INSIST(loading == 0);
 	while ((ni = HEAD(loading_notifies)) != NULL) {
 		UNLINK(loading_notifies, ni, link);
+		--number_of_notifies;
 		ns_notify(ni->name, ni->class, ni->type);
 		ni->name = freestr(ni->name);
 		memput(ni, sizeof *ni);
@@ -184,6 +193,7 @@

 		INSIST(LINKED(ni, link));
 		UNLINK(pending_notifies, ni, link);
+		--number_of_notifies;
 		free_notify(ni);
 	}
 }
@@ -203,6 +213,7 @@

 	if (ni != NULL) {
 		UNLINK(pending_notifies, ni, link);
+		--number_of_notifies;
 		free_notify(ni);
 	}
 }
@@ -455,6 +466,7 @@
 	evInitID(&ni->timer);
 	INSIST(LINKED(ni, link));
 	UNLINK(pending_notifies, ni, link);
+	--number_of_notifies;
 	sysnotify(ni->name, ni->class, ni->type);
 	free_notify(ni);
 }


More information about the bind-workers mailing list