🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #92709

Re: High and low water marks vs active file

#92709
From: InterLinked
Date: Sat, 02 May 2026 00:29
136 lines
7848 bytes
On 5/1/2026 5:14 PM, Russ Allbery wrote:
> InterLinked <nntp@phreaknet.org> writes:
>> 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).

Sorry, to be clear, I meant database in the sense of something like 
SQLite or MySQL, not using a text file under direct control of the 
program as a store.

>> 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).

Makes sense - I'm assuming the new mechanism is a database of each 
article, effectively, so you can just select the articles of interest?

> 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.

Another good point, thank you.

>> 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.

Thanks, this is helpful perspective. I think I still need to sleep on 
this a bit but hearing about your experience here is really valuable.

Honestly, I was really set on just using flat files before but there are 
some compelling reasons you've brought up. Maybe I'll abstract things in 
a way such that I can start with flat files and add a DB (SQLite or 
other) backend option later that could be used instead. I was trying to 
avoid that complexity but it might be worth it.

If going the database route, I'm assuming you would just recommend 
SQLite for everything? I would guess a regular RDBMS like MariaDB would 
be overkill (and possibly cause issues if the server weren't local).

>> 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.

You mean one file per article in the spool?
 From the documentation, I thought the "tradspool" method in INN was the 
most common deployment.

> 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

Yes, I skipped these since they're global and not "one entry per group"- 
are there any others of those that I missed?

Is the "LIST MODERATORS" file all that is involved in moderation? I 
didn't think there was any moderator info explicitly associated with 
each group.

>> 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.

Some files already use tab, which I don't *think* is allowed in any of 
the metadata to date? If it is, maybe a non-ASCII character like field 
separator would work.

Adding a field is something to think about. It would be a problem for 
databases too, though there are various migration tools for extending 
schemas, at least, and I'll grant that's one area where databases win 
over plain text files. But regardless of the underlying format, I'd 
prefer to invest enough time in the design up front to hopefully not 
need any changes later. Since NNTP has been stable for quite a long time 
now, I think that's realistic, unless there are new extensions in the 
future which add more metadata - and I do have a few extensions in mind 
for later but none would modify the group metadata.

(Thinking now of the new possible file format, theoretically a new 
command to return all this info at once might also be useful in the 
future now that doing so would be efficient, e.g. LIST EVERYTHING or 
whatever, instead of doing LIST ACTIVE, LIST ACTIVE.TIMES, LIST 
NEWSGROUPS, etc. individually.)
Technical Details
Message-ID: <10t3gha$1qe2v$1@dont-email.me>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!spool1.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.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> <87zf2ix26q.fsf@hope.eyrie.org>

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!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail
From: InterLinked <nntp@phreaknet.org>
Newsgroups: news.software.nntp
Subject: Re: High and low water marks vs active file
Date: Fri, 1 May 2026 20:29:28 -0400
Organization: A noiseless patient Spider
Lines: 136
Message-ID: <10t3gha$1qe2v$1@dont-email.me>
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> <87zf2ix26q.fsf@hope.eyrie.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Sat, 02 May 2026 00:29:31 +0000 (UTC)
Injection-Info: dont-email.me;
	logging-data="1914975"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1/hhZ1zapzw708U+Pkir6KLvHXhR5MBF8I="; posting-host="2dc781b9cd3f35c558a07365dbd78f6a"
Cancel-Lock: sha1:nR2q1ETIgR/IVclzf3Q2GWXkZ6g=
X-Mailer: MailNews/52.9.9224a1
Content-Language: en-US
In-Reply-To: <87zf2ix26q.fsf@hope.eyrie.org>