Article View: news.software.nntp
Article #92704Re: High and low water marks vs active file
From: InterLinked
Date: Fri, 01 May 2026 20:37
Date: Fri, 01 May 2026 20:37
262 lines
15122 bytes
15122 bytes
On 5/1/2026 1:38 PM, Russ Allbery wrote: > 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 think I understand the landscape now - both are compliant but choose to gravitate slightly more towards either performance or correctness. I'm more surprised if it's the case that maybe this is the first time anyone is considering #2 in a design. > 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. I think I'll definitely want to consider that angle - hitherto, I've been directly using Eternal September in my newsreader (which is Mozilla-based) and I've noticed for some large groups, I see a very high count, and then when I click on the group, it changes radically. Just now, I did a packet capture and I only see it using the GROUP command (and not LIST ACTIVE at all), but from the configuration that INN allows, I wonder if maybe Eternal September has their INN (for indeed, they are using INN) configured to return estimate group counts in most cases, and thus my reader only sees the correct count when I click on the group. Could've been some other command, but that makes me desire even more strongly to always provide accurate counts as well, if nothing else to avoid irritating me :) > 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. Hmm - yet another fork in the road! How often does article reinstatement really occur and under what circumstances? Purely by the local newsmaster? 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.) My personal uninformed preference at the moment is probably to refrain from reinstating articles, if only because empty groups would then show the historical high water mark count in LIST ACTIVE, which to me would be *very* useful and interesting for statistical and information purposes. 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. I know you mentioned water marks can change in potentially non-compliant ways if a group is renumbered, so I guess INN may not even be consistent in other cases. >> 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. 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. 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. (So intuitively, I would feel that it makes more sense to keep the low water mark as high as is legal at any given point, assuming reinstatement isn't likely to occur.) > 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). 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. For articles within a group, .overview seems fairly efficient. 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? 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. (I'm not opposed to a database if it really made sense, but it seems like a few flat files can get the job done here ~just as good - though maybe I'm missing something obvious.) >> 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. Gotcha, makes sense. 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 My plan was to go with these, and possibly bastardize .active in the process in a way nobody else has done (adding <real high> and <count>). This has the downside of deviating from the canonical format for the file, which does seem to be pretty universal amongst existing software. It just seems silly to me to add another file just to avoid breaking compatibility. (My thinking: worst case, if needed, a migration could always be done using NNTP itself anyways, to another server - in which case the format of my active file is nobody else's business.) 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. >> 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. :) Hmm, could you elaborate a bit more on the kind of desynchronization that tends to happen? 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?) If combining .newsgroups into .active, it makes me wonder, why not go further and also combine .active.times into .active? Were these initially separate simply because .active.times came later and wanted to avoid breaking the format of .active, or for some other good reason? It would seem there *could* theoretically be just one big global file, like so: .active.extended <group> <last> <high> <low> <count> <creation epoch> <creator name> <description> 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. But this is probably an uncommon enough occurrence (maybe even less common than group creation or deletion?) that the performance implication could be ignored. I had also previously assumed .newsgroups was separate because group descriptions contain spaces/tabs, which would complicate the parsing if combined with other stuff. But if I made it the last entry on each line, it wouldn't pose an issue. And of course, now all the LIST handlers would need to parse the file and send the right info, but that's not a big deal either. Maybe slightly more contention for the file with locking, is all I can think. Most commands would then simply do a full scan of this file and get what they need, either for all groups or just a specific group. Writes (new or deleted articles) would generally update <last>, <high>, <low>, and/or <count>, and while existing servers don't do that, they *are* already updating *something* in the file (<last> for new posts, and at least one of the water marks for deletions), so updating the other metadata is effectively "free".
Technical Details
Message-ID:
<10t32uf$1mio9$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-mailReferences:
<10t0m5h$1177o$1@dont-email.me> <877bpo570b.fsf@hope.eyrie.org> <10t12o5$14bjd$1@dont-email.me> <87se8bxc5x.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 16:37:34 -0400 Organization: A noiseless patient Spider Lines: 262 Message-ID: <10t32uf$1mio9$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> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Fri, 01 May 2026 20:37:36 +0000 (UTC) Injection-Info: dont-email.me; logging-data="1788681"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+sZXF8lb3OHRtWB1+YggBwaFFQpajjPBc="; posting-host="8ed642e9731a1e251773b245d28968ae" Cancel-Lock: sha1:SKH2iDgdJd1BtK5W/Mq4dJpB1qw= In-Reply-To: <87se8bxc5x.fsf@hope.eyrie.org> X-Mailer: MailNews/52.9.9224a1 Content-Language: en-US