🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: news.software.nntp
5 messages
5 total messages Started by David Eckhardt Thu, 15 Feb 2001 21:51
cloning an INN server
#50644
Author: David Eckhardt
Date: Thu, 15 Feb 2001 21:51
36 lines
2584 bytes
I want to clone an INN server.  That is, I want a second server
with the same articles numbered the same way.  I understand that
xrefslave does most of what I want, but I am concerned about a
corner case.

Some of the articles on the old server were posted many years ago
to groups that we never expire.  A few of those articles were also
crossposted to groups with much shorter expiration times.  My old
server used the traditional spool format for everything, and I
expect the new one to use it for our local hierarchies (i.e., both
newsgroups in question).

From looking at the code, it appears as if one of these articles
arriving at the new server would be indexed into all of the groups
in the Xref:  header.  That is, while the article would appear in
only one group on the old server, it would appear in both groups
on the new server.

If I initialized the new server with a copy of the old server's
active file, this re-creation of expired articles would not affect
anybody.  But if I retired the old server and some catastrophe
required me to rebuild the active file, then the low mark for the
non-eternal newsgroup would go down, causing readers to reset the
group, right?  Since some of our old newsgroups have six-month
expiration times, the window of vulnerability is not really
trivial.

The cleanest approach I can think of would be for the new server
to notice that the incoming article number is under the lowmark
in its (cloned) active file and skip indexing it into that group.
Should I look into doing that, or am I confused about something?

Dave Eckhardt

P.S. Please reply via news rather than mail.
Re: cloning an INN server
#50649
Author: Russ Allbery
Date: Thu, 15 Feb 2001 23:35
109 lines
5201 bytes
David Eckhardt <davide+receptionist@cs.cmu.edu> writes:

> I want to clone an INN server.  That is, I want a second server with the
> same articles numbered the same way.  I understand that xrefslave does
> most of what I want, but I am concerned about a corner case.

xrefslave is the right place to be looking.

> Some of the articles on the old server were posted many years ago to
> groups that we never expire.  A few of those articles were also
> crossposted to groups with much shorter expiration times.  My old server
> used the traditional spool format for everything, and I expect the new
> one to use it for our local hierarchies (i.e., both newsgroups in
> question).

> From looking at the code, it appears as if one of these articles
> arriving at the new server would be indexed into all of the groups in
> the Xref:  header.  That is, while the article would appear in only one
> group on the old server, it would appear in both groups on the new
> server.

Right.

> If I initialized the new server with a copy of the old server's active
> file, this re-creation of expired articles would not affect anybody.
> But if I retired the old server and some catastrophe required me to
> rebuild the active file, then the low mark for the non-eternal newsgroup
> would go down, causing readers to reset the group, right?

It may, yeah.  The approach I would take is to use this script that I
wrote to solve the exact same problem for our servers; it filters out any
crossposts in the Xref header while copying a tree of articles into a new
directory.  You can then use find on that new tree to generate a batch
file for an innxmit that understands how to read files and not storage API
tokens (any innxmit prior to INN 2.3 will work, and so should the version
in INN 2.3.2 when I get a chance to fix it).

#!/usr/bin/perl
$ID = q$Id: fixref,v 1.1 2001/01/10 11:27:37 eagle Exp $;
#
# fixref -- Fix the Xref headers in a tree of news articles.
#
# Written by Russ Allbery <rra@stanford.edu>
# Copyright 2000 Board of Trustees, Leland Stanford Jr. University
#
# Copy a tree of traditional spool news articles, fixing the Xref headers as
# we go.  Add Xref headers if missing (based on the path to the article),
# and if an Xref header is present, trim out hierarchies other than those
# given on the command line.
#
# Usage: fixref -a <hierarchy-pattern> <from> <to> <hierarchy>

use strict;
use vars qw($ALLOW $COUNT %DONE $FROM $ID $TO);

use File::Find qw(find);
use File::Path qw(mkpath);
use Getopt::Long qw(GetOptions);

sub copy {
    return unless -f $_;
    return unless /^\d+$/;
    my $path = $File::Find::dir;
    $path =~ s%^\Q$FROM\E/*%%;
    open (SRC, "< $_") or die "Can't open $File::Find::name: $!\n";
    mkpath ("$TO/$path", 0, 0755) unless $DONE{$path}++;
    open (DST, "> $TO/$path/$_") or die "Can't open $TO/$path/$_: $!\n";
    my $header = 1;
    my $havexref = 0;
    while ($header) {
        my $line = <SRC>;
        if ($line =~ /^Xref: /) {
            if ($ALLOW) {
                my ($xref, $server, @groups) = split (' ', $line);
                @groups = grep { /$ALLOW/ } @groups;
                $line = join (' ', $xref, $server, @groups) . "\n";
            }
            $havexref = 1;
        } elsif ($line =~ /^[\r\n]*$/) {
            unless ($havexref) {
                my $group = $path;
                $group =~ tr%/%.%;
                $group .= ":$_";
                print DST "Xref: fixref $group\n";
            }
            $header = 0;
        }
        print DST $line;
    }
    local $_;
    print DST while <SRC>;
    close SRC;
    close DST or die "Can't flush $TO/$path/$_: $!\n";
    print "$COUNT articles processed\n" if ((++$COUNT % 100) == 0);
}

GetOptions ('allow|a=s' => \$ALLOW) or exit 1;
my $hierarchy;
($FROM, $TO, $hierarchy) = @ARGV;
die "Usage: fixref [-a <allow>] <from> <to> <hierarchy>\n"
    unless $hierarchy;
find (\&copy, "$FROM/$hierarchy");

-- 
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: cloning an INN server
#50671
Author: David Eckhardt
Date: Fri, 16 Feb 2001 21:39
21 lines
1978 bytes
Russ Allbery  <rra@stanford.edu> wrote:

>It may, yeah.  The approach I would take is to use this script that I
>wrote to solve the exact same problem for our servers; it filters out any
>crossposts in the Xref header while copying a tree of articles into a new
>directory.

Thank you for that script; I may end up going down that path.  Do
I need "storeonxref" as well as "xrefslave", so that innd won't
get confused by there being fewer entries on the Xref:  header than
there are on the Newsgroups: header?

But I feel like it would be cleaner and more truthful to keep the
Xref header unmodified and have the receiving machine just not
index the article in newsgroups where it has "clearly" already
expired, as indicated by the active file.  If code came along that
did that, would it be welcome?  Should "xrefslave" always do
that, or only if an additional flag is set?

Dave Eckhardt
Re: cloning an INN server
#50672
Author: Russ Allbery
Date: Fri, 16 Feb 2001 23:14
32 lines
2377 bytes
David Eckhardt <davide+receptionist@cs.cmu.edu> writes:

> Thank you for that script; I may end up going down that path.  Do I need
> "storeonxref" as well as "xrefslave", so that innd won't get confused by
> there being fewer entries on the Xref:  header than there are on the
> Newsgroups: header?

I think that xrefslave already takes care of that, but I always set
storeonxref too, so I haven't tested it.

> But I feel like it would be cleaner and more truthful to keep the Xref
> header unmodified and have the receiving machine just not index the
> article in newsgroups where it has "clearly" already expired, as
> indicated by the active file.

The problem with doing that is that often when people are doing things
like you're doing, they end up feeding the articles in the wrong order.
It would have to be robust against that, and possibly against ctlinnd
lowmark being run inbetween.

> If code came along that did that, would it be welcome?  Should
> "xrefslave" always do that, or only if an additional flag is set?

The above makes me think it should be an option, but I could be convinced
otherwise.

-- 
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: cloning an INN server
#50742
Author: David Eckhardt
Date: Tue, 20 Feb 2001 17:38
28 lines
2431 bytes
>>But I feel like it would be cleaner and more truthful to keep the Xref
>>header unmodified and have the receiving machine just not index the
>>article in newsgroups where it has "clearly" already expired, as
>>indicated by the active file.

>The problem with doing that is that often when people are doing things
>like you're doing, they end up feeding the articles in the wrong order.

Assume for a moment that the new server's low marks would stay
indefinitely at the same value as the old server's.  In that case,
feed order would not matter--either an Xref entry is under a group's
lowmark, in which case "trimxrefs" would indicate that it should
not be used for indexing, or it is above the lowmark, in which case
it would be.

>It would have to be robust against that, and possibly against ctlinnd
>lowmark being run inbetween.

Good point.  What if there were a configuration flag that caused
ctlinnd lowmark to return success but actually do nothing? Then
cloning would involve turning on xrefslave, nnrpdposthost, "trimxrefs"
and "ignorelowmark" while the old articles are being fed.  The
"ignorelowmark" flag would also be useful on the *old* server so
that readers being migrated from the old server to the new one
would never see group resets.

Dave Eckhardt
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