🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: news.software.nntp
5 messages
5 total messages Started by Paul Tomblin Mon, 21 Jul 2003 17:53
Removing duplicates in inn 2.2 tradspool
#66265
Author: Paul Tomblin
Date: Mon, 21 Jul 2003 17:53
12 lines
1619 bytes
Thanks to some problems with both /var/lib/news and /var/spool/news
running out of space, it appears that my history file got corrupted
somehow, and there are duplicate articles all over my spool space.  If I
follow the steps in the makehistory man page to rebuild the history file,
will that automatically remove the duplicates, or will I have to do that
as a separate step?  Will news.daily do it?

-- 
Paul Tomblin <ptomblin@xcski.com>, not speaking for anybody
'Usenet "belongs" to those who administer the hosts of which it is comprised'
 - RFC 1036, draft revision
Re: Removing duplicates in inn 2.2 tradspool
#66270
Author: Jeffrey M. Vinocur
Date: Mon, 21 Jul 2003 21:02
19 lines
1908 bytes
In article <bfh9ai$ent$1@allhats.xcski.com>,
Paul Tomblin <ptomblin@xcski.com> wrote:
>Thanks to some problems with both /var/lib/news and /var/spool/news
>running out of space, it appears that my history file got corrupted
>somehow, and there are duplicate articles all over my spool space.  If I
>follow the steps in the makehistory man page to rebuild the history file,
>will that automatically remove the duplicates, or will I have to do that
>as a separate step?  Will news.daily do it?

Somebody may correct me here, but I think you've got to do it on
your own :-/

It shouldn't be but a little bit of Perl, I think, since you only
need to consider the files in a single directory at any given
time.

-- 
Jeffrey M. Vinocur
jeff@litech.org
Re: Removing duplicates in inn 2.2 tradspool
#66273
Author: Paul Tomblin
Date: Mon, 21 Jul 2003 23:44
41 lines
2368 bytes
In a previous article, jeff@litech.org (Jeffrey M. Vinocur) said:
>>follow the steps in the makehistory man page to rebuild the history file,
>>will that automatically remove the duplicates, or will I have to do that
>>as a separate step?  Will news.daily do it?
>
>Somebody may correct me here, but I think you've got to do it on
>your own :-/

Bummer.

>It shouldn't be but a little bit of Perl, I think, since you only
>need to consider the files in a single directory at any given
>time.

Call me an old traditionalist, but I use find and a script:

find . -type d -exec remove_dups.sh {} \; 

remove_dups.sh looks like:

  #!/bin/sh

  cd $1

  echo "doing $1"

  grep -i '^message-id: ' * |sed 's/^[0-9]*:[Mm]essage-[Ii][Dd]: //' | sort | uniq -d >> /tmp/$$.out
  for i in `cat /tmp/$$.out` ; do
          echo "duplicate message $i"
          grep -l $i * | head -1 | xargs rm
  done

  rm /tmp/$$.out

I'm sure I could have done it more efficiently or something in perl, but
it was faster to write it this way.


-- 
Paul Tomblin <ptomblin@xcski.com>, not speaking for anybody
        ---------------- hit any user to continue ----------------
Re: Removing duplicates in inn 2.2 tradspool
#66280
Author: Jeffrey M. Vinocur
Date: Tue, 22 Jul 2003 11:21
27 lines
2193 bytes
In article <bfhttq$n2d$1@allhats.xcski.com>,
Paul Tomblin <ptomblin@xcski.com> wrote:
>In a previous article, jeff@litech.org (Jeffrey M. Vinocur) said:
>
>>It shouldn't be but a little bit of Perl, I think, since you only
>>need to consider the files in a single directory at any given
>>time.
>
>Call me an old traditionalist, but I use find and a script: [...]
>
>I'm sure I could have done it more efficiently or something in perl, but
>it was faster to write it this way.

Well, whatever works.  You got quadratic runtime when linear was
quite possible, so yes, it would have been much faster to use a
different algorithm (for any substantial dataset, anyway).  Not
that you couldn't do that in a shell script, of course.

(I've given up on programming shell scripts, personally; there
are no convincing benefits, and the restrictions are a constant
annoyance.  So if it can't be done entirely as a pipeline, Perl
time.)


-- 
Jeffrey M. Vinocur
jeff@litech.org
Re: Removing duplicates in inn 2.2 tradspool
#66281
Author: Paul Tomblin
Date: Tue, 22 Jul 2003 11:52
29 lines
2476 bytes
In a previous article, jeff@litech.org (Jeffrey M. Vinocur) said:
>In article <bfhttq$n2d$1@allhats.xcski.com>,
>Paul Tomblin <ptomblin@xcski.com> wrote:
>>Call me an old traditionalist, but I use find and a script: [...]
>>
>>I'm sure I could have done it more efficiently or something in perl, but
>>it was faster to write it this way.
>
>Well, whatever works.  You got quadratic runtime when linear was
>quite possible, so yes, it would have been much faster to use a
>different algorithm (for any substantial dataset, anyway).  Not
>that you couldn't do that in a shell script, of course.

It took so long to run that I had time to write a better algorithm in
Perl.  *That* one runs a lot faster, but it's still running.


Meanwhile, I'm discovering that expire doesn't run when the news server is
throttled due to lack of space.  That isn't a good thing.  Neither is the
fact that the throttle message is the highly misleading "Permission denied
writing article file -- throttling".  I think I'm going to have to just
"rm -rf /var/spool/news/alt" just so I can get expire to finish.


-- 
Paul Tomblin <ptomblin@xcski.com>, not speaking for anybody
"Maybe if your vcr is still blinking 12:00 you shouldn't be using Linux."
-- Slashdot poster
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