🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #92708

Re: High and low water marks vs active file

#92708
From: Russ Allbery
Date: Fri, 01 May 2026 21:14
229 lines
12043 bytes
InterLinked <nntp@phreaknet.org> writes:

> How often does article reinstatement really occur and under what
> circumstances? Purely by the local newsmaster?

INN doesn't support it at all, although there are some corruption repair
tools that can create similar effects. It therefore never attempts to
reserve low water mark space.

I think people have discussed article reinstatement in theory, usually
around spam filtering scenarios where an article is quaratined as possible
spam and then later released. But I don't know if any server has actually
implemented this, and therefore am not sure whether the discussion of this
in the NNTP RFC is theoretical or based on some implementation. It was
probably discussed at the time, but it's been more than 20 years and I
don't remember, sadly.

> I probably wouldn't plan to reinstate articles that expired due to the
> server's local policy; are there any other reasons that might happen?
> Undoing a cancel - is that a thing? (And beyond that, without some kind
> of recycle bin, the article would have to be restored from some kind of
> backup.)

There is no control message to undo a cancel, but of course the local
administrator can do anything the software allows.

> If NNTP had something analogous to UIDVALIDITY in IMAP, where one would
> normally increase the low water mark but could "reset" it in some
> unforseen circumstance, that would allow for both behaviors, but there
> isn't as far as I know.

Correct, there's no such concept in NNTP.

>> Is it possible that those groups have never received traffic on that
>> server? That's the response I would expect if the server has never
>> stored an article for that group.

> It's possible, though it would surprise me a little - this was running
> LIST ACTIVE on Eternal September's INN server, which I think has been
> around for a while, but maybe some of these are super old groups that
> have been inactive a long while.

There are definitely Big Eight groups that haven't gotten any traffic for
10-20 years. (Some moderated ones, at least.)

> For active groups, I do see low water marks that are greater than 1, so
> for these groups, there's a commitment to not reinstate articles below
> the present low water mark. So is article reinstatement in an empty
> group vs non-empty really a special case? To allow unconditional
> reinstatement, the low water mark would always have to be 1, which is
> not really that meaningful.

Correct. The only requirement is to not increase the low water mark if
you'd reinstate one of those older articles. The empty group isn't a
special case. The special case is more "the articles were all removed down
to the low water mark by something other than expiration," since
presumably you would never reinstate expired articles, only ones removed
by some other mechanism that may be erroneous, like cancels (which can be
forged if one isn't using canlock or the like).

>> If I were writing a news server from scratch, I would embrace modern
>> databases as early as possible and not try to reinvent that wheel. Long
>> experience with INN is that the reinvention of various databases is one
>> of the hardest parts of INN to maintain and handing that all off to
>> some suitable library or external service would be very attractive.

> Isn't the database more of a "cache" in INN, of technically
> reconstructible data? (in contrast to the active file, which has <last>
> which is not reconstructible).

Well, I'm not sure I agree with the distinction you're making here, since
the active file *is* a database. INN has a whole bunch of databases, some
of which it stores as text files, but just because the format is a text
file doesn't make it a database. INN definitely uses the active file like
a database (hence the zero-padding).

In general, there is data in many of the databases that cannot be
reconstructed from the spool, such as article arrival time and the record
of rejected articles. Overview is a bit of a special case that overview
can generally be regenerated solely from the spool, but that's just one of
the (many) databases.

> For LIST responses, I don't see how using a database would be faster
> than reading through one of these files, especially if you already have
> to do ACL checks and wildmat matches on every group - I would think
> those would be the bottleneck.

I don't think the database would be faster necessarily. I think it would
be more maintainable and more consistent and have fewer of the numerous
bugs we've run into with INN over the years. Having transactions, for
instance, eliminate a whole set of corruption inconsistencies. Combining
active and newsgroups eliminates a whole class of synchronization issues
when processing control messages.

> For articles within a group, .overview seems fairly efficient.

Well, we wrote a whole new overview mechanism because we didn't think it
was sufficiently efficient. :) Using only a flat .overview file can be
extremely slow for very large groups when clients request only a subset of
the records (which is very common; they usually only care about the latest
messages).

A simple flat .overview text file is how INN 1.x worked, and it does
indeed work fine for small groups. Everything works fine for small groups.

> GROUP would require a linear scan of the active file for its response,
> to find the group, and a database could be faster in that case, but
> apart from single-group responses, is there any case where a database
> would result in a noticeable speedup?

In theory, a database may be able to do much faster prefix matching than a
linear scan doing wildmat matching for, e.g., LIST ACTIVE news.*, but that
would require converting wildmat expressions to something the database can
understand with LIKE, which may not be possible in the general case.

> And at that point, maybe a simple hash table with pointers to the
> beginning of the corresponding line in the active file would close the
> performance gap, without needing to add a database to the picture.

See, you're going down the same path that all the INN authors, myself
included, have gone down: You can see a simple data structure that would
solve the problem that you have and it seems more straightforward to just
implement that than use a "full database" which feels like it would have a
ton of overhead.

And you can do that! That's how INN works! I'm just saying that as someone
with a lot of years of experience maintaining that code with a simple hash
table and whatnot, a whole lot of time and bugs would have been saved by
just using an off-the-shelf database. At, of course, the cost of having to
handle database transitions and implementation changes and BerkeleyDB
getting bought by Oracle and then killed and so forth.

INN now has a SQLite overview implementation and I think that's the right
direction to go.

> Really, was more wondering about the active file than anything else. While
> not officially standardized anywhere, it seems in practice there are a few
> standardized files with standardized formats:

> .active (LIST ACTIVE)
> .active.times (LIST ACTIVE.TIMES)
> .newsgroups (LIST NEWSGROUPS)
> <group>/.overview (8 standardized fields)
> <group>/<article number> for article naming

The last is often not used these days because it has a lot of poor
performance properties.

There are a few other ones that aren't as widely used and are arguably
configuration instead, but that do need to be queryable. They're probably
fine as configuration files with some in-memory representation, though,
since they're usually very small.

    LIST DISTRIB.PATS
    LIST MODERATORS
    LIST OVERVIEW.FMT

> I think we've established there's no good reason the real high water mark
> couldn't be stored here, and I don't think there's any reason the count
> couldn't be either, since anything that changes the count updates the
> active file already.

Yes, I agree that seems reasonable.

>> If you are reworking the format, I would find a way to put the
>> newsgroup description into the same file, because desynchronization
>> between active and newsgroups is a long-standing annoyance in INN. And
>> at that point I would consider some sort of structured database with
>> fast writes. :)

> Hmm, could you elaborate a bit more on the kind of desynchronization that
> tends to happen?

Deleting the group doesn't remove the description line. The control
message processing dies in the middle because the server crashes and a
line gets added to one and not the other. The description gets added to
the newsgroups file more than once. Some of these are bugs, but that's
part of the point: It's theoretically possible to keep the files fully in
sync, but in practice this has been an area where INN has had tons of
bugs over the years.

> If I recall, the RFC states that the list of groups from LIST ACTIVE and
> LIST NEWSGROUPS can differ (though perhaps this was worded that way to
> prevent existing installations from violating the spec, not necessarily
> to condone that practice? Ideally, would the list of groups always match
> identically? Or are there ever good reasons they should differ?)

Yeah, I think that may be toleration for lots and lots of historic bugs.
Really, there's no reason why this should be the case except for the
narrow case of a group being added or removed between the two commands.

> If combining .newsgroups into .active, it makes me wonder, why not go
> further and also combine .active.times into .active?

Yes, indeed.

> Were these initially separate simply because .active.times came later
> and wanted to avoid breaking the format of .active,

Yup, exactly.

> <group> <last> <high> <low> <count> <creation epoch> <creator name>
> <description>

Note that you now have a space-separated file except for the last field
and you have a problem if you want to add another field that you didn't
think of originally. I would really want to store this as some sort of
structured file because you have some fields there (at least the
description, maybe the creator name) that can contain a variety of
characters.

> The only thing I can think of (and this applies to .newsgroups but not
> .active.times) is that if the description is changed, its length can
> change, so now the whole active file needs to be rewritten.

Yup, that too. That's the big argument for a database, which supports
updates without having to rewrite the whole file.

> But this is probably an uncommon enough occurrence (maybe even less
> common than group creation or deletion?) that the performance
> implication could be ignored.

It's roughly as common as group creation or deletion in my experience.

-- 
Russ Allbery (eagle@eyrie.org)             <https://www.eyrie.org/~eagle/>

          Please post questions rather than mailing me directly.
     <https://www.eyrie.org/~eagle/faqs/questions.html> explains why.
Technical Details
Message-ID: <87zf2ix26q.fsf@hope.eyrie.org>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!spool1.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!nntp-feed.chiark.greenend.org.uk!ewrotcd!news.killfile.org!news.eyrie.org!.POSTED!not-for-mail
References: <10t0m5h$1177o$1@dont-email.me> <877bpo570b.fsf@hope.eyrie.org> <10t12o5$14bjd$1@dont-email.me> <87se8bxc5x.fsf@hope.eyrie.org> <10t32uf$1mio9$1@dont-email.me>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!spool1.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!nntp-feed.chiark.greenend.org.uk!ewrotcd!news.killfile.org!news.eyrie.org!.POSTED!not-for-mail
From: Russ Allbery <eagle@eyrie.org>
Newsgroups: news.software.nntp
Subject: Re: High and low water marks vs active file
Date: Fri, 01 May 2026 14:14:21 -0700
Organization: The Eyrie
Message-ID: <87zf2ix26q.fsf@hope.eyrie.org>
References: <10t0m5h$1177o$1@dont-email.me> <877bpo570b.fsf@hope.eyrie.org>
	<10t12o5$14bjd$1@dont-email.me> <87se8bxc5x.fsf@hope.eyrie.org>
	<10t32uf$1mio9$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: hope.eyrie.org;
	logging-data="1135"; mail-complaints-to="news@eyrie.org"
User-Agent: Gnus/5.13 (Gnus v5.13)
Cancel-Lock: sha1:XcQ3XO3GmQIDmNSZ9pc5TVfERFA=