Lots of cleanup finished, INN 2.4 status

Alex Kiernan alexk at demon.net
Tue Jan 21 09:24:16 UTC 2003


Russ Allbery <rra at stanford.edu> writes:

> I'll put the current code on a test machine to flush out any cases where I
> missed something.  I think I'm pretty much ready for INN 2.4 from my end.
> I think the only other changes that we had outstanding were some patches
> from Alex for the nnrpd cache and ESTALE in tradindexed

I've just committed everything I've got (modulo the newnews
improvements). Other than the diff below what's committed is what
we're running (nnrpd rather then innd - not upgraded our innd yet).

Hopefully the changes to tradindexed are simple enough that my checks
by inspection (as I've not used it in write mode) are
sufficient. There is one change I know of which was to fix an instance
where the code unmapped the data file, but any errors reported would
have claimed it was the index file.

For the record (if its of any use to anyone), here's the remaining
diffs we're running:

Index: nnrpd/newnews.c
===================================================================
RCS file: /dist1/cvs/isc/inn/inn/nnrpd/newnews.c,v
retrieving revision 1.42
diff -u -r1.42 newnews.c
--- nnrpd/newnews.c	2003/01/21 06:37:02	1.42
+++ nnrpd/newnews.c	2003/01/21 09:22:39
@@ -149,6 +149,7 @@
     if ((handle = OVopensearch(group, ARTlow, ARThigh)) != NULL) {
 	ARTNUM artnum;
 	unsigned long artcount = 0;
+	extern time_t GLOBAL_ARRIVED_HACK;
 	struct cvector *vector = NULL;
 
 	if (innconf->nfsreader) {
@@ -157,6 +158,7 @@
 	    if (date >= innconf->nfsreaderdelay)
 		date -= innconf->nfsreaderdelay;
 	}
+	GLOBAL_ARRIVED_HACK = date;
 	while (OVsearch(handle, &artnum, &data, &len, &token, &arrived)) {
 	    if (innconf->nfsreader && arrived + innconf->nfsreaderdelay > now)
 		continue;
@@ -225,12 +227,6 @@
       return;
   }
 
-  /* Make other processes happier if someone uses NEWNEWS */
-  if (innconf->nicenewnews > 0) {
-      nice(innconf->nicenewnews);
-      innconf->nicenewnews = 0;
-  }
-
   snprintf(line, sizeof(line), "%s %s %s %s", av[1], av[2], av[3],
 	   (ac >= 5 && (*av[4] == 'G' || *av[4] == 'U')) ? "GMT" : "local");
   notice("%s newnews %s", ClientHost, line);
@@ -269,6 +265,13 @@
 	  process_newnews(groups[i], AllGroups, date);
       }
   } else {
+      /* Make other processes happier if someone uses NEWNEWS */
+      if (innconf->nicenewnews > 0) {
+	  /* newnews is only expensive if we have to do the full group
+	   * list scan, so only penalise those ones */
+	  nice(innconf->nicenewnews);
+	  innconf->nicenewnews = 0;
+      }
       path = concatpath(innconf->pathdb, _PATH_ACTIVE);
       qp = QIOopen(path);
       if (qp == NULL) {
Index: nnrpd/nnrpd.c
===================================================================
RCS file: /dist1/cvs/isc/inn/inn/nnrpd/nnrpd.c,v
retrieving revision 1.168
diff -u -r1.168 nnrpd.c
--- nnrpd/nnrpd.c	2003/01/21 06:39:58	1.168
+++ nnrpd/nnrpd.c	2003/01/21 09:22:40
@@ -1104,6 +1104,7 @@
 	/* Arrange to toggle tracing. */
 	xsignal(SIGHUP, ToggleTrace);
  
+	SetupDaemon();
 	setproctitle("accepting connections");
  	
 	listen(lfd, 128);	
@@ -1165,7 +1166,6 @@
 	close(fd);
 	dup2(0, 1);
 	dup2(0, 2);
-	SetupDaemon();
 
 	/* if we are a daemon innd didn't make us nice, so be nice kids */
 	if (innconf->nicekids) {
Index: storage/tradindexed/tdx-data.c
===================================================================
RCS file: /dist1/cvs/isc/inn/inn/storage/tradindexed/tdx-data.c,v
retrieving revision 1.26
diff -u -r1.26 tdx-data.c
--- storage/tradindexed/tdx-data.c	2003/01/21 09:14:54	1.26
+++ storage/tradindexed/tdx-data.c	2003/01/21 09:22:43
@@ -33,6 +33,9 @@
 #include "tdx-private.h"
 #include "tdx-structure.h"
 
+#include <assert.h>
+time_t GLOBAL_ARRIVED_HACK = 0;
+
 /* Returned to callers as an opaque data type, this holds the information
    needed to manage a search in progress. */
 struct search {
@@ -474,6 +477,33 @@
         return false;
 
     max = (search->data->indexlen / sizeof(struct index_entry)) - 1;
+
+    if (GLOBAL_ARRIVED_HACK) {
+	ARTNUM arrived = GLOBAL_ARRIVED_HACK;
+	ARTNUM where, low, high;
+
+	entry = search->data->index;
+	low = search->current;
+	high = search->limit;
+	while (high > low && (high - low) > 3) {
+	    ARTNUM plow, phigh;
+
+	    assert(low <= high);
+	    where = (high - low) / 2 + low;
+	    plow = low;
+	    phigh = high;
+	    if (where > max || entry[where].length == 0 ||
+		entry[where].arrived >= arrived) {
+		high = where;
+	    } else {
+		low = where;
+	    }
+	    assert(low != plow || high != phigh); 
+	}
+	search->current = low;
+	GLOBAL_ARRIVED_HACK = 0;
+    }
+
     entry = search->data->index + search->current;
     while (search->current <= search->limit && search->current <= max) {
         if (entry->length != 0)

-- 
Alex Kiernan, Principal Engineer, Development, THUS plc


More information about the inn-workers mailing list