Thread View: news.software.nntp
6 messages
6 total messages
Started by Matija Nalis
Thu, 25 Oct 2007 15:06
inn2_overview_fix (and expire question)
Author: Matija Nalis
Date: Thu, 25 Oct 2007 15:06
Date: Thu, 25 Oct 2007 15:06
63 lines
3843 bytes
3843 bytes
Hi, I've written a tool inn2_overview_fix, which can be found on http://newsfeed.carnet.hr/programs/ It is tool for checking (and optionally, fixing) out-of-sync errors in inn tradspool with tradindex overviews. It currently compares tradspool files, active(5) ranges, and tradindex overviews and reports any inconsistencies found. It also brings them in sync (using tradspool storage as authoritative source). It was written because when things get out of sync in tradspool/tradindex in inn-2.4.3 (like in Debian Etch) "makeactive -O" which was run to correct it would often silently fail leaving bunch of groups unfixed (which would lead to server throttling *again* soon). This program uses tdx-util to fix tradindex overviews, and ctlinnd renumber to fix active for groups it finds inconsistencies in; and it seems to work without problems (as opposed to "makeactive -O"). Additional bonus is that it can fix groups while your server is running (by just throttling it when needed), thus reducing downtime for your users; and that is has hierarchy priorities so it will first fix groups that are more important to you. The program works great, but there is one annoying expire-related problem. Assume we have a group, which has following articles in tradspool: -rw-rw-r-- 2 news news 1758 Mar 1 2007 3989 -rw-rw-r-- 1 news news 2379 Oct 5 08:56 4135 -rw-rw-r-- 1 news news 966 Oct 5 08:57 4136 -rw-rw-r-- 1 news news 991 Oct 5 08:58 4137 -rw-rw-r-- 1 news news 1427 Oct 5 09:01 4138 -rw-rw-r-- 1 news news 1185 Oct 8 23:01 4139 -rw-rw-r-- 1 news news 1963 Oct 9 13:27 4140 -rw-rw-r-- 1 news news 1428 Oct 15 23:31 4141 -rw-rw-r-- 1 news news 3147 Oct 21 14:42 4142 -rw-rw-r-- 6 news news 1139 Oct 21 23:34 4143 original tradindex overview had records 4135-4143 (note missing 3989). The script throttles innd, and runs tdx-util (which generates all overviews, including previously missing 3989), unthrottles, and runs ctlinnd renumber. All looks great, now active(5) and tradindex overviews are in sync with tradspool (all have 3989 + 4135-4143 records) However, when cron does its daily run, it runs "news.daily expireover lowmark delayrm" (expire.ctl has an 1 month expiration for that group.) I would expect that news.daily would remove the 3989 article from tradspool (as it is several months old) and update overview and active file so that they have only range 4135-4143. However, while it does update overview and active file to range 4135-4143, it DOES NOT expire article 3989 from tradspool. Any idea why it is so (and prehaps how to fix it) ? I've tried also running "news.daily notdaily noexpireover delayrm", but it seems to behave in the same (broken) manner. -- Opinions above are GNU-copylefted.
Re: inn2_overview_fix (and expire question)
Author: Julien ÉLIE
Date: Thu, 25 Oct 2007 18:14
Date: Thu, 25 Oct 2007 18:14
39 lines
2606 bytes
2606 bytes
Hi Matija,
> Hi, I've written a tool inn2_overview_fix, which can be found on
> http://newsfeed.carnet.hr/programs/
Thanks for having put signcontrol.py there (but do not forget
signcontrol.conf); I am glad to see you find it useful.
> I would expect that news.daily would remove the 3989 article from tradspool
> (as it is several months old) and update overview and active file so that
> they have only range 4135-4143.
>
> However, while it does update overview and active file to range 4135-4143,
> it DOES NOT expire article 3989 from tradspool.
>
> Any idea why it is so (and prehaps how to fix it) ?
I believe article 3989 is not in your history file any longer so expire
has no idea it still exists on your hard disk.
That is why it does not "expirerm" it and just change the range to 4135-4143.
Just use:
grephistory -l '<Message-ID>'
to see if that is the case.
Well, it would also be interesting to know why that article was not removed
from the disk when it expired. Such a thing also appears on my news server
but I still have not tried to figure that out.
--
Julien ÉLIE
« -- Que lui est-il arrivé ? Un choc moral ?
-- Oui, avec un menhir. » (Astérix)
Re: inn2_overview_fix (and expire question)
Author: Russ Allbery
Date: Mon, 29 Oct 2007 16:18
Date: Mon, 29 Oct 2007 16:18
52 lines
3414 bytes
3414 bytes
Matija Nalis <mnalis-news@voyager.hr> writes:
> Hi, I've written a tool inn2_overview_fix, which can be found on
> http://newsfeed.carnet.hr/programs/
> It is tool for checking (and optionally, fixing) out-of-sync errors in
> inn tradspool with tradindex overviews. It currently compares tradspool
> files, active(5) ranges, and tradindex overviews and reports any
> inconsistencies found.
The description seems to indicate that this is trying to do exactly what
tdx-util -A and -R was written to do. I assume, from the fact that you
wrote it, that tdx-util was insufficient. Could you provide some more
information about what it didn't do that you wanted?
I'd rather enhance tdx-util to do what you want than have another program
floating around to do the same thing. Is it mostly just running ctlinnd
renumber afterwards?
> Additional bonus is that it can fix groups while your server is running
> (by just throttling it when needed), thus reducing downtime for your
> users; and that is has hierarchy priorities so it will first fix groups
> that are more important to you.
Note that while it's not heavily tested, tdx-util -R should actually work
while the server is running, since it locks the relevant overview file.
It may slow down innd if it tries to write to the same group, of course.
> All looks great, now active(5) and tradindex overviews are in sync with
> tradspool (all have 3989 + 4135-4143 records)
> However, when cron does its daily run, it runs
> "news.daily expireover lowmark delayrm"
> (expire.ctl has an 1 month expiration for that group.)
> I would expect that news.daily would remove the 3989 article from
> tradspool (as it is several months old) and update overview and active
> file so that they have only range 4135-4143.
> However, while it does update overview and active file to range 4135-4143,
> it DOES NOT expire article 3989 from tradspool.
It's probably a cross-posted article that's expired out of that group but
not out of some other group. This is one of the hardest things to get
right about a tradspool storage format.
--
Russ Allbery (rra@stanford.edu) <http://www.eyrie.org/~eagle/>
Please post questions rather than mailing me directly.
<http://www.eyrie.org/~eagle/faqs/questions.html> explains why.
Re: inn2_overview_fix (and expire question)
Author: Matija Nalis
Date: Tue, 30 Oct 2007 16:10
Date: Tue, 30 Oct 2007 16:10
77 lines
4776 bytes
4776 bytes
On 2007-10-29, Russ Allbery <rra@stanford.edu> wrote:
> Matija Nalis <mnalis-news@voyager.hr> writes:
>> Hi, I've written a tool inn2_overview_fix, which can be found on
>> http://newsfeed.carnet.hr/programs/
>
>> It is tool for checking (and optionally, fixing) out-of-sync errors in
>> inn tradspool with tradindex overviews. It currently compares tradspool
>> files, active(5) ranges, and tradindex overviews and reports any
>> inconsistencies found.
>
> The description seems to indicate that this is trying to do exactly what
> tdx-util -A and -R was written to do. I assume, from the fact that you
> wrote it, that tdx-util was insufficient. Could you provide some more
> information about what it didn't do that you wanted?
It is a perl script with just checks consistency using tradspool as
authorative information, and checking active(5) and tradindex files if
they match (and fixes them with "tdx-util -R" and "ctlinnd renumber" if
it doesn't)
I'm not sure "tdx-utils -A" does all that checks -- it finishes way too
quickly (about 2 minutes here for ~6 million articles in > 22k groups) and
seems to miss some the stuff that looks wrong to me.
I guess it just checks tradindex with active file or something like that
(haven't had time to look into source) ? It does not seem to take tradspool
storage as only authorative source of information (which it is, IMHO).
And issue with just rebuilding all overview records (using "tdx-util -R"
without group specification) was:
1) it is much slower if just few groups are broken (as they usually are)
[and I was under impression it was not safe to run while server is
not throttled]
2) Mostly I'd like just to do the checks from time to time, and send mail
with error instead of rebuilding everything periodically. ("tdx-util -A"
would be great for that, if it did full checks mentioned above).
3) it is one binary, and if it breaks, it could leave all other groups
unchecked (as I unfortunately found out with "makeactive -O" which
silently dies for me in inn2.4.3 without fixing majority of the groups).
It "tdx-util -R" for one group dies silently (like makeactive does), my
script will continue, leaving just that one group broken.
> I'd rather enhance tdx-util to do what you want than have another program
> floating around to do the same thing. Is it mostly just running ctlinnd
> renumber afterwards?
It fixes overview tradindex files being out-of-sync with "tdx-util -R" and
active(5) being out-of-sync with "ctlinnd renumber", yes.
> Note that while it's not heavily tested, tdx-util -R should actually work
> while the server is running, since it locks the relevant overview file.
> It may slow down innd if it tries to write to the same group, of course.
That is good news that I wasn't previously aware of. If it works reliably,
I should be able to avoid throttling the server before running it from the
script.
>> However, while it does update overview and active file to range 4135-4143,
>> it DOES NOT expire article 3989 from tradspool.
>
> It's probably a cross-posted article that's expired out of that group but
> not out of some other group. This is one of the hardest things to get
> right about a tradspool storage format.
You are correct, I somehow missed the crosspost.
Which brings me to the another point - why didn't expire remove that article
from that directory when it expired overview for that directory ? Shouldn't
it be expected behaviour ? After all, the article IS hardlinked in all
directories that message is crossposted to, so shouldn't it be removed from
groups from which it is expired ?
--
Opinions above are GNU-copylefted.
Re: inn2_overview_fix (and expire question)
Author: Russ Allbery
Date: Tue, 30 Oct 2007 16:51
Date: Tue, 30 Oct 2007 16:51
81 lines
5258 bytes
5258 bytes
Matija Nalis <mnalis-news@voyager.hr> writes:
> It is a perl script with just checks consistency using tradspool as
> authorative information, and checking active(5) and tradindex files if
> they match (and fixes them with "tdx-util -R" and "ctlinnd renumber" if
> it doesn't)
Okay. So the bits that are missing are checking the article numbers
against the active file, running ctlinnd renumber, and checking the
directory for (non-crossposted) articles that are missing from active.
The Perl script is a good temporary solution, but I do think that in the
long run tdx-util should be able to deal with all of that as well. I
don't know if I'll get a chance to work on it any time soon, though. I do
appreciate the additional ideas and code!
> I'm not sure "tdx-utils -A" does all that checks -- it finishes way too
> quickly (about 2 minutes here for ~6 million articles in > 22k groups)
> and seems to miss some the stuff that looks wrong to me.
tdx-util -A only checks the overview for internal consistency. I don't
think it also checks external data sources. So you're right, you're doing
something different.
> I guess it just checks tradindex with active file or something like that
> (haven't had time to look into source) ? It does not seem to take
> tradspool storage as only authorative source of information (which it
> is, IMHO).
The only exception is that INN doesn't delete articles properly on ctlinnd
rmgroup, which needs to be fixed.
> And issue with just rebuilding all overview records (using "tdx-util -R"
> without group specification) was:
Oh, yeah, you don't want to do that. In fact, I don't think tdx-util even
supports -R without -n (the man page claims it doesn't, anyway).
> 3) it is one binary, and if it breaks, it could leave all other groups
> unchecked (as I unfortunately found out with "makeactive -O" which
> silently dies for me in inn2.4.3 without fixing majority of the groups).
We should figure out what broke there.
> Which brings me to the another point - why didn't expire remove that
> article from that directory when it expired overview for that directory?
It's an annoying compromise that goes back to the history of how all this
stuff originally worked.
In the first version of INN, the history file stored a list of groups into
which each article was stored, since there was only one storage format.
When the article expired out of some groups, it was deleted out of those
groups and removed from the history line, remaining in the other groups.
(This gets more complex in the presence of symlinks, but I'll ignore that
for right now.)
When INN was changed to have a pluggable storage backend so that we could
support CNFS, the history file format changed to list a storage API token
instead of a list of groups. Unfortunately, space in an API token is
limited and we can't store the complete list of groups, only encode one
group. Therefore, each article stored in tradspool acquired a "primary
group" and it's through that path that the article is retrieved when
retrieving articles by token (which is done when retrieving articles by
message ID). As a result, the article cannot be unlinked from the primary
group until the article has fully expired, even if it's already expired
from that specific group. The primary group is just the first group
listed in Xref (in other words, the first group in Newsgroups that's
carried by the local server in the common case).
This is ugly and kind of broken. I'm not sure of the best way to fix it.
Another side database for tradspool that maps articles to newsgroups is
probably the right way, although maintaining another database has various
performance and complexity impacts that are annoying. I haven't given it
a lot of thought; there's probably some elegant solution.
--
Russ Allbery (rra@stanford.edu) <http://www.eyrie.org/~eagle/>
Please post questions rather than mailing me directly.
<http://www.eyrie.org/~eagle/faqs/questions.html> explains why.
Re: inn2_overview_fix (and expire question)
Author: Matija Nalis
Date: Tue, 13 Nov 2007 16:01
Date: Tue, 13 Nov 2007 16:01
89 lines
5330 bytes
5330 bytes
On 2007-10-30, Russ Allbery <rra@stanford.edu> wrote:
> Matija Nalis <mnalis-news@voyager.hr> writes:
>> It is a perl script with just checks consistency using tradspool as
>> authorative information, and checking active(5) and tradindex files if
>> they match (and fixes them with "tdx-util -R" and "ctlinnd renumber" if
>> it doesn't)
>
> Okay. So the bits that are missing are checking the article numbers
> against the active file, running ctlinnd renumber, and checking the
> directory for (non-crossposted) articles that are missing from active.
Yes. Also missing in tdx-util (if I get it right) is checking the tradspool
articles against the overview itself.
> The Perl script is a good temporary solution, but I do think that in the
> long run tdx-util should be able to deal with all of that as well. I
That would be great, provided it doesn't silently die in the middle of
operation (as "makeactive -O" does, and as actually many C-programs are
known to do when they hit invalid pointer and stuff :()
> don't know if I'll get a chance to work on it any time soon, though. I do
> appreciate the additional ideas and code!
I've tried to mess with the C source, but found it too time consuming to
pick up quickly, so it was much easier for me to rewrite it from scratch in
perl :(
>> 3) it is one binary, and if it breaks, it could leave all other groups
>> unchecked (as I unfortunately found out with "makeactive -O" which
>> silently dies for me in inn2.4.3 without fixing majority of the groups).
>
> We should figure out what broke there.
I do have a backup server that has a copy of the innd software and the news
spool, so I think I can reproduce the problem. I do lack free time to hunt
it down all by myself, unfortunately.
So if you (or somebody else) can produce a patch that adds verbosity in all
places where makeactive (from inn 2.4.3) could die, I could try to make it
fail and report back where it dies, so the code could be fixed.
>> Which brings me to the another point - why didn't expire remove that
>> article from that directory when it expired overview for that directory?
>
> It's an annoying compromise that goes back to the history of how all this
> stuff originally worked.
Thanks Russ, the explanation below is useful.
I must say though I prefer the way stuff originally worked, it was much
less of the kludge (for tradspool) than it is now :(
> group. Therefore, each article stored in tradspool acquired a "primary
> group" and it's through that path that the article is retrieved when
> retrieving articles by token (which is done when retrieving articles by
<snip>
> This is ugly and kind of broken. I'm not sure of the best way to fix it.
> Another side database for tradspool that maps articles to newsgroups is
> probably the right way, although maintaining another database has various
> performance and complexity impacts that are annoying. I haven't given it
> a lot of thought; there's probably some elegant solution.
It does not seem to be very elegant ones... The best I can see is:
have /var/spool/news/master_articles which contains ALL [1] crossposted
articles (making this directory "primary group" for ANY crossposted
article), and then in each of crossposted groups you would hardlink there.
During expire, you would always only unlink the article from directory where
it expired (fast and simple). When the hardlink count reaches 1, it would
mean the article is no longer referenced from any groups, and you could do
final unlink (to free disk space) from news.daily via simple
"find /var/spool/news/master_articles -links 1 | xargs rm"
(or equivalent at the end of expire itself)
Code changes do seem relatively minor, but you do need another directory
hierarchy.
[1] for performance reasons, you would actually split
/var/spool/news/master_articles in 2-layer subdirectories named as hash
of article number and groups or something (like squid cache or other
stuff which stores huge number of files does) instead of keeping it flat
--
Opinions above are GNU-copylefted.
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads