Article View: news.software.nntp
Article #92702Re: High and low water marks vs active file
From: Russ Allbery
Date: Fri, 01 May 2026 17:38
Date: Fri, 01 May 2026 17:38
247 lines
13461 bytes
13461 bytes
InterLinked <nntp@phreaknet.org> writes:
> On 4/30/2026 8:05 PM, Russ Allbery wrote:
>> 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).
So, I have to admit that I don't recall this explicitly coming up during
the RFC discussions, so I don't have a definitive answer for you about why
we worded it this way. I think if we'd noticed this at the time, we would
have been a bit clearer about what clients should expect, so I think there
is a (minor) bug in the standard here.
What I can say is that the intent of RFC 3977 was to document existing
practice (which had moved on a lot since RFC 977) and add some new
features, but not to rule out the behavior of existing servers unless it
was clearly wrong in some way that would cause problems.
There are two fairly obvious ways to handle the high water mark:
1. Keep low and high water marks in only one place, increment the high
water mark on every new article arrival as part of article numbering,
and never decrement it because it doubles as the source of the next
article number for that group.
2. Keep internal "next article number" data for each group but report the
high water mark based on what articles are in the spool at the time.
Historically, INN (and C News, I'm fairly sure) always did 1, so that was
very widespread practice. I'm fairly sure that we wouldn't have chosen to
declare it nonconformant. 2 is arguably more correct so the language
should (and was) written to *allow* it, but we wouldn't have *required* it
and ruled the historic INN behavior non-compliant. INN's ability to do 1
in theory based on the overview database information is new in INN 2.x as
I recall. Before that, OVcancel was not a thing, and there was no way to
remove the information about the cancelled article from overview before
the next nightly expire, so there was no independent source of truth about
the current article numbers beyond checking the spool.
I agree with you that this didn't really make it into the text, but I
think that's just a minor bug in the standard that we didn't catch at the
time.
Thinking about the problem this morning, I do see a small but real
advantage to the client in getting an accurate high water mark: It means
that the count of unread articles derived purely from LIST ACTIVE will be
more correct in the specific case that only the highest-numbered article
was removed. That in turn may save some spurious notification of unread
messages. But counts based solely on LIST ACTIVE responses are going to be
inaccurate for the more common case (for servers that support article
removal at all in their configuration) of an article that is *not* the
highest-numbered article being removed. This is just the tradeoff of using
LIST ACTIVE for article numbers; if the client wants more accurate
information, it needs to use one of the other commands like OVER. But of
course those are inherently heavier-weight, due to the increased amount of
information returned and the requirement of a round trip per group.
> Of course, the phrasing doesn't mandate that the high water mark
> decrease in this case, though it seems to allow for that option.
Yes, I agree that decreasing the high water mark is definitely allowed.
> 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?
The latter. You'll find that this is really common in the netnews RFCs:
there was such a long gap between the initial RFCs and the updates, and so
much changed about the implementations in a not-entirely-coherent way,
that the RFCs allow for a lot of variations of behavior to avoid declaring
existing implementations nonconformant with the new standard except where
that seemed warranted.
The primary purpose of the RFC refresh cycle was not to try to clean up
all the existing implementations, but instead ot document what the
behavior was in as clean of a way as possible so that new software knew
what it could rely on.
> 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).
If you can provide a more accurate high water mark, I don't see any
drawback to doing so. The only possible downside that I can imagine is
that some client will be surprised by the high water mark decreasing,
since it has never seen a server that would do that, and might issue some
sort of warning to the user. I suppose such a client could exist. But it
would surprise me a bit; decreasing the high water mark is clearly allowed
by the RFC.
> 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]
Yup, and in the days when spam and spam cancels were fighting it out, it
wasn't uncommon to see things like that happen in some groups.
> 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).
*If* your server would never reinstate articles, the best response in the
sense of giving the client the most information would be to increase the
low water mark and return a high of 2999 and a low of 3000, because the
client can then forget about all of those deleted articles permanently.
But as the RFC says, if you might ever reinstate those articles, you're
not allowed to increase the low water mark like that, so I think the best
response would be to return high 0 and low 1 if the articles may later
reappear.
> 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
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.
> 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.
I *think* that if it had ever received traffic (and the news administrator
hadn't rebuilt the active file, etc.), you would see the result that you
are expecting.
> Okay, so performance > strict correctness (which is a reasonable answer,
> when the client can't really say it wasn't correct).
Exactly.
> 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>
There is no reason that one could not make it fast. It's just extra
development work and extra bookkeeping that no one has implemented for
INN. The overview database, where the more accurate information is stored,
is optimized for per-group retrieval and, for some of the overview
backends currently implemented, iterating through all of the groups to get
current low and high marks would be slow.
> 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?
Yes, exactly, and just because this didn't seem important enough to put
effort into.
> 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.
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.
> 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.
I suspect it would be fine to do that.
> 2. Is INN's active file (or file system more generally) intended to be
> portable with other news servers?
Not really, no. Some of INN's on-disk data structures match the format of
files specified in the RFC for convenience reasons, but most of INN"s
on-disk data structures (apart from the spool if tradspool is used) are
very, very specific to INN.
> 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.
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. :)
--
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:
<87se8bxc5x.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-mailReferences:
<10t0m5h$1177o$1@dont-email.me> <877bpo570b.fsf@hope.eyrie.org> <10t12o5$14bjd$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 10:38:50 -0700 Organization: The Eyrie Message-ID: <87se8bxc5x.fsf@hope.eyrie.org> References: <10t0m5h$1177o$1@dont-email.me> <877bpo570b.fsf@hope.eyrie.org> <10t12o5$14bjd$1@dont-email.me> MIME-Version: 1.0 Content-Type: text/plain Injection-Info: hope.eyrie.org; logging-data="28409"; mail-complaints-to="news@eyrie.org" User-Agent: Gnus/5.13 (Gnus v5.13) Cancel-Lock: sha1:cfzOEwUoArbk0aiKRQEhesGJ3dE=