🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #92695

Re: High and low water marks vs active file

#92695
From: InterLinked
Date: Fri, 01 May 2026 02:21
225 lines
12860 bytes
On 4/30/2026 8:05 PM, Russ Allbery wrote:
> InterLinked <nntp@phreaknet.org> writes:
> 
>> However, the documentation for the active file in InterNetNews (INN)[2]
>> says that <high> is the "highest article number that has ever been used in
>> that newsgroup". This implies it is NOT the same as the reported high
>> water mark, because the high water mark could decrease while <high> in
>> this context is monotonically increasing
> 
> Correct, INN never decreases the high water mark under normal operations.
> Therefore, if the latest article in the group is deleted, the high water
> mark will not decrease and will reference a non-existent article.
> 
> This is how most news servers have historically behaved, so the arguable
> implication in RFC 3977 that servers should decrease the high water mark
> in this case is arguably a bug. In practice, it has no real effect since
> news readers are required to handle this situation anyway, due to:
> 
> |   The set of articles in a group may change after the GROUP command is
> |   carried out:
> |
> |   o  Articles may be removed from the group.

Hmm, that's an interesting way to look at it - even if the article was 
deleted *before* the GROUP response is generated, the client wouldn't be 
able to tell.

But the 3rd bullet in the phrase you cite (6.1.1.2) also says:

> |   o New articles may be added with article numbers greater than the
> |     reported high water mark.  (If an article that was the one with
> |     the highest number has been removed and the high water mark has
> |     been adjusted accordingly, the next new article will not have the
> |     number one greater than the reported high water mark.)

To me, this implies the high water mark can (even "should") decrease 
when the high water mark article is removed - in which case, the next 
article assigned would indeed not have high + 1 (similar to how UIDs and 
UIDNEXT work in IMAP).

Of course, the phrasing doesn't mandate that the high water mark 
decrease in this case, though it seems to allow for that option.

> which is implicitly incorporated by reference into LIST ACTIVE since it
> references that definition of high and low water marks (and logically has
> to be the case regardless, since of course the state of the spool could
> change after LIST ACTIVE just as it could after GROUP).

Yes, that makes sense. But this seems more like a "loophole" or 
"shortcut"... did the RFC actually intend it work this way? Or everybody 
was already doing it that way before RFC 3977, and that part of it has 
just been ignored?

For context, I am working on my own NNTP implementation and I've really 
been scratching my head about how to handle this case. It seems like if 
I'm able to provide a more accurate response (a lower high water mark), 
that would be preferred, but maybe there is a good reason not to do so? 
(The obvious one being it requires extra bookkeeping).

To make an extreme example, if a group with a lot of articles had all of 
them except the low water mark article deleted (and "last" is 3000), you 
could have a response like:

211 3000 1 3000 misc.test

[and the count has to be at least 3000, per the RFC, so we can't even 
have 211 1 1 3000 misc.test to indicate there are definite gaps]

when in reality, this is the "most accurate" response:

211 1 1 1 misc.test

Though now that begs the question what to display if that last article 
(1) were then deleted. I presume in the first case, it would naturally be:

211 0 3000 2999 misc.test

And this is probably the best response. In the second case, it seems 
more ambiguous what the most logical reply would be, since you could 
start with either "last" or whatever the last true high water mark was 
(e.g. 211 0 0 1 misc.test).

That brings me to another observation: I've noticed that most inactive 
newsgroups in INN return high 0 and low 1 (at least for those I've 
analyzed in responses for Usenet groups), which seemed odd to me as I 
would have thought INN would naturally take the <high> in the active 
file, and taking low = <high> and high = low - 1, return something more 
like 211 0 3000 2999 misc.test

The benefit there is that from the output you could see how many 
articles were in the group historically, from the high water mark, even 
if all have since been deleted - it's extra context that can be conveyed 
"for free". Is there a reason INN just uses 1/0 instead? This seems like 
one case where using <last> directly would actually really make sense 
for a client.

>> - and the low and high water marks can be recomputed by scanning the
>> spool directory, while <high> in the active file cannot (and thus needs
>> to be stored persistently).
> 
> Yes, and I'm not sure INN's behavior when the news administrator
> reconstructs the active file from the spool is strictly conforming in all
> edge cases. (For example, the low water mark could decrease, which is
> forbidden by RFC 3977.) In practice, the edge cases probably don't matter.
> 
>> I've been perusing the source of InterNetNews (INN) to try to understand
>> how it behaves, as a reference. It refers to the active file <high> as
>> LAST in a few places, and this is used when assigning new article IDs in a
>> group. This makes sense. For LIST COUNT and GROUP, it pulls from group
>> stats, which I believe is ultimately some kind of database backend that
>> provides the reported water marks and article count. However, in the
>> response for LIST ACTIVE, it simply dumps the line from the active file as
>> is. Yet, the RFC says the response format for LIST ACTIVE includes the
>> reported high and low water marks.
> 
> In theory INN could construct a LIST ACTIVE response from the overview
> database. In practice, this is a very frequent operation and the current
> implementation is probably considerably faster than an overview-based
> implementation, for dubious benefit.
> 
> So, for your questions:
> 
>> 1. If "LAST" is an internal value used for assigning article IDs, and
>> not the reported high water mark, then why is it being handed out as
>> such for LIST ACTIVE? I would think it would use the actual reported
>> high water mark, because if the high water mark article were deleted,
>> then the response would have the wrong high water mark.
> 
> Because it's slow, basically. News readers like for LIST ACTIVE to be very
> fast with a large number of groups so that they can show unread article
> counts quickly on newsreader startup.

Okay, so performance > strict correctness (which is a reasonable answer, 
when the client can't really say it wasn't correct).

Though I don't see why the implementation could not be such that it 
would be just as fast - either perhaps through an in-memory cache of 
low/high/count for all groups, kept in sync with the active file, or 
even more simply, storing this all in the active file itself, i.e. with 
a format like:

<name> <last> <reportedhigh> <reportedlow> <count> <status>

Performance-wise, since the active file has to be updated when new 
articles are posted anyways, and deletions have to update the low water 
mark anyways, overall # of writes would stay the same.

I'm not proposing either of these for INN specifically, but wondering if 
either would make sense in the design of new software. If I had to 
guess, maybe the active file hasn't been extended like this for 
compatibility/portability reasons?

(For simplicity, I've also made the assumption articles won't be 
manually deleted outside of the software's knowledge.)

>> 2. The same page says <low> in the active file is ~the low water mark
>> but "not guaranteed to be accurate" and is just a hint. In INN, do the
>> values of <low> in the active file ever differ from the low water mark
>> in the group stats? Or are they distinct values like the active file
>> <high> (LAST) and the low water mark?
> 
> I would never guarantee full integrity between all of INN's various
> databases because they're all independent and updated non-transactionally,
> so all sorts of weird things are true momentarily. In theory, the low
> water mark in the active file should be eventually consistent with the low
> water mark in overview, but it will certainly vary while in the middle of
> nighly expire and may vary at other times that I'm not thinking of.
> 
> If I were writing a new news server from scratch today in 2026, I would
> try very hard not to use INN's design of having four separate databases in
> three entirely different formats for the active file, the newsgroup
> descriptions, the overview, and the history. Surely there is some way to
> write a transactional database that could track all those things in a more
> reasonable but still performant way that doesn't require constantly
> managing inconsistencies the way that INN does after some crashes or
> corruption. It used to be that all SQL databases were just too slow,
> particularly for history, but overview can be put in SQLite these days and
> I'm dubious that there is no standard database that could handle history
> given how much database optimization has happened over the years.
> 
> But INN will evolve slowly, if at all, because it basically works and a
> lot of the bugs have been flushed out over the years and changing
> architectures is very hard. :)

Thanks, this is helpful, since I'm basically writing a new news server 
from scratch. Obviously, performance matters, though I don't want to 
prioritize that above all else - for now, this will be smaller scale 
(private news hierarchies or subsets of Usenet).

The low/high water marks and count could be computed at startup by 
scanning the directories, and then stored in memory, but now I'm kind of 
tempted by the idea of just having it all in an "extended" active file.

So, two more big questions, I guess:

1. It seems that convention is to "lie" about the high water mark and 
just hand out "last" instead, for performance, at least the way INN is 
implemented (since the client can't tell that we lied). Considering it 
feels against the *spirit* of the RFC, setting aside performance, do you 
foresee any problems with choosing to provide an accurate high water 
mark? I can't see how it would break compatibility, since the RFC 
already says the high water mark CAN decrease, even if nobody does it today.

(Edge case being if all articles are deleted, then using last makes 
sense - though as I wondered above, I'm not sure if that's even what INN 
does.)

2. Is INN's active file (or file system more generally) intended to be 
portable with other news servers? If not, it seems like I could just 
extend the active file to add the "true" high water mark along with the 
article count, and then just use that for both LIST ACTIVE and GROUP. 
Then I could be truthful with no performance hit. Sure, I would have to 
parse the line and omit "last" and "count", format the rest and return 
it, but that seems minor and probably worth it (and as long as I'm 
already formatting it at this point, I could return non-padded numbers 
instead of zero-padded numbers, ultimately saving bandwidth for listing 
all groups as a side benefit - of course, I'd still pad the file to 
allow in-place edits).

I realize these are all edge cases, but I could see them arising and I 
would prefer to be as correct as possible, especially if performance 
won't be impacted much. But maybe (probably) there's something here that 
I've not fully thought through...

Thanks!
Technical Details
Message-ID: <10t12o5$14bjd$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>

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: Thu, 30 Apr 2026 22:21:53 -0400
Organization: A noiseless patient Spider
Lines: 225
Message-ID: <10t12o5$14bjd$1@dont-email.me>
References: <10t0m5h$1177o$1@dont-email.me> <877bpo570b.fsf@hope.eyrie.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 01 May 2026 02:21:58 +0000 (UTC)
Injection-Info: dont-email.me; posting-host="c1fb9bd0743c0df69afc5cd118a0668a";
	logging-data="1191533"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX19NyLNYBbaDhN3gj+fXWu/k+V4MBjG2+0g="
Cancel-Lock: sha1:zH+Z6933cqldN93I/e5ehGTUhg4=
In-Reply-To: <877bpo570b.fsf@hope.eyrie.org>
Content-Language: en-US
X-Mailer: MailNews/52.9.9224a1