🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #81423

Re: [PATCH] Regarding overview creation and the active file.

#81423
From: D. Stussy
Date: Fri, 19 Jun 2009 11:56
131 lines
6984 bytes
"Russ Allbery" <rra@stanford.edu> wrote in message
news:87hbyhx90e.fsf@windlord.stanford.edu...
> "D. Stussy" <spam@bde-arc.ampr.org> writes:
> > In file:  storage/tradindexed/tdx-group.c, routine hashmap_load()
> >
> > I note that in the while-loop, we read EVERY entry from the active file
and
> > create a hash for it.  As this is to determine OVERVIEW data, I
question
> > whether we need to do this.  Should we SKIP entries marked "j", "x",
and
> > "=" because those "groups" will always be EMPTY ("j" will file in
"junk",
> > "x" will be rejected, and "=" will file in the alias group).  Only
groups
> > marked with "m", "n", and "y" will be non-empty.  (I note that groups
> > marked with "j", "x", or "=" or which were previously removed may have
> > residual overview data).  Is it this loop that effectively causes
"empty"
> > overview files to be created?   ...
>
> You'd have to check the nnrpd code to be sure, but I think it gets
> everything about groups in some places, including the flag, from
> overview.  If that's the case, they need to be present in overview for
> nnrpd to behave correctly for those groups (which is not quite the same
> as having them not exist).

Here's what I have come up with and am running now to test.  Bypassing the
creation and leaving the indexinode entry as zero does require bypassing
some log warnings and actually setting the value when a file is finally
allocated (for whatever reason).  There seems to be no side effects by
NNRPD as of yet.  NNRPD's attempt to read a group won't create overview
files (as expected, but I explicitly checked for this).

I tested this by setting all my "control.*" pseudogroups to "x".  Their
index files were not initially created on inn startup.  However,
"control.cancel" did have index files appearing once some cancel messages
came in.  (I've known that the special files marked with "x" will not block
their special messages filed in them - control messages for "control.*",
any message for junk ("j" marked groups or "wanttrash: true"), or "to
groups => to".)  This means no more wasted inodes for blocked, junk, or
aliased groups (2+ per each group).

Of course, servers that are either new or are reinitializing their
tradtional overviews from scratch will benefit.  Existing overviews may
not.

No sane filesystem seems to ever return zero for the inode value to an
application program where there's an actual file allocated.  The first few
inodes seem to always be reserved for FS special files.  (Ext2/3/4 for
Linux seems to reserve the first 8 values.  Furthermore, under Unix-type
systems, a inode value of zero in a directory usually means unassigned.)
Should zero turn out to be a problem, then a value of -1 to mean unassigned
shouldn't.

Expireover seems to have created the skipped groups.  Argh!  Looks like
there's a little more to do.

Patch to date:
DIRECTORY:  storage/tradindexed/
diff -u tdx-data.c*
--- tdx-data.c  2009-05-21 20:08:33.000000000 +0000
+++ tdx-data.c.mod      2009-06-19 11:00:14.000000000 +0000
@@ -1055,10 +1055,12 @@

     /* Check the inode of the index. */
     if (data->indexinode != index->indexinode) {
-        warn("tradindexed: index inode mismatch for %s: %lu != %lu",
group,
-             (unsigned long) data->indexinode,
-             (unsigned long) index->indexinode);
-        if (fix) {
+        if (index->indexinode) {
+            warn("tradindexed: index inode mismatch for %s: %lu != %lu",
group,
+                 (unsigned long) data->indexinode,
+                 (unsigned long) index->indexinode);
+        }
+        if (fix || !index->indexinode) {
             index->indexinode = data->indexinode;
             changed = true;
         }
diff -u tdx-group.c*
--- tdx-group.c 2009-05-21 20:08:33.000000000 +0000
+++ tdx-group.c.mod     2009-06-19 11:05:13.000000000 +0000
@@ -658,10 +658,12 @@
     entry->count = 0;
     entry->flag = *flag;
     data = tdx_data_new(group, index->writable);
-    if (!tdx_data_open_files(data))
-        warn("tradindexed: unable to create data files for %s", group);
-    entry->indexinode = data->indexinode;
-    tdx_data_close(data);
+    if (strchr("=xj",*flag) == NULL) {
+        if (!tdx_data_open_files(data))
+            warn("tradindexed: unable to create data files for %s",
group);
+        entry->indexinode = data->indexinode;
+        tdx_data_close(data);
+    }
     index_add(index, entry);

     index_lock(index->fd, INN_LOCK_UNLOCK);
@@ -765,8 +767,10 @@
             index_lock_group(index->fd, offset, INN_LOCK_UNLOCK);
             goto fail;
         }
-        if (entry->indexinode != data->indexinode)
-            warn("tradindexed: index inode mismatch for %s", group);
+        if (entry->indexinode != data->indexinode) {
+            if (!entry->indexinode) entry->indexinode = data->indexinode;
+            else warn("tradindexed: index inode mismatch for %s", group);
+        }
         high = entry->high;
         base = entry->base;
         index_lock_group(index->fd, offset, INN_LOCK_UNLOCK);
@@ -805,9 +809,11 @@
     if (entry->indexinode != data->indexinode) {
         if (!tdx_data_open_files(data))
             goto fail;
-        if (entry->indexinode != data->indexinode)
-            warn("tradindexed: index inode mismatch for %s",
+        if (entry->indexinode != data->indexinode) {
+            if (!entry->indexinode) entry->indexinode = data->indexinode;
+            else warn("tradindexed: index inode mismatch for %s",
                  HashToText(entry->hash));
+        }
         data->base = entry->base;
     }

Technical Details
Message-ID: <h1fuea$b2d$1@snarked.org>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.20141118.mbox.gz!backlog1.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!t-online.de!news-out1.kabelfoon.nl!newsfeed.kabelfoon.nl!xindi.nntp.kabelfoon.nl!teleglobe.net!teleglobe.net!news.linkpendium.com!news.linkpendium.com!news.snarked.org!not-for-mail
References: <h16rde$stb$1@snarked.org> <87hbyhx90e.fsf@windlord.stanford.edu>

Show Full Headers
Complete Article Headers
Message-ID: <h1fuea$b2d$1@snarked.org>
Subject: Re: [PATCH] Regarding overview creation and the active file.
Date: Fri, 19 Jun 2009 04:56:54 -0700
From: "D. Stussy" <spam@bde-arc.ampr.org>
References: <h16rde$stb$1@snarked.org> <87hbyhx90e.fsf@windlord.stanford.edu>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.20141118.mbox.gz!backlog1.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!t-online.de!news-out1.kabelfoon.nl!newsfeed.kabelfoon.nl!xindi.nntp.kabelfoon.nl!teleglobe.net!teleglobe.net!news.linkpendium.com!news.linkpendium.com!news.snarked.org!not-for-mail
Newsgroups: news.software.nntp
Lines: 131
Reply-To: "D. Stussy" <replies@newsgroups.kd6lvw.ampr.org>
NNTP-Posting-Host: pool-71-118-50-95.lsanca.dsl-w.verizon.net
X-Trace: snarked.org 1245412618 11341 71.118.50.95 (19 Jun 2009 11:56:58 GMT)
X-Complaints-To: newsmaster@snarked.org
NNTP-Posting-Date: Fri, 19 Jun 2009 11:56:58 +0000 (UTC)
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1478
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1478