Subject: Re: Question on nncp-rm

From: Sergey Matveev <[email-masked]>
Date: Sun, 13 Mar 2022 16:40:39 +0300

Greetings!

*** John Goerzen [2022-03-09 08:09]:
>nncp-rm -all -older 7d -seen
>
>Unfortunately, that deleted ALL -seen files, not just the ones that are
>older than 7 days.  How can I just delete the ones older than 7 days?

Well, "-seen" means deletion of all "seen" files. Plain "-rx" deletes
everything related to "rx/", including the "seen"s. So "nncp-rm -rx -older ..."
should also delete both rx-packets and seen-files that are older than
specified amount.

But there is no possibility to cleanup only and only "seen" files older
than specified boundary. I do not remember what was I thinking about and
why I decided that it is more convenient (everybody wants to clean up
everything related to rx/ with single command, right? :-)). At least it
is definitely not intuitive.

I refactored that command and changed its behaviour to be more intuitive
and clear:

* all options (-rx/-tx/-seen/...) respect -older, except for -lock
* -tx removes tx/* packets
* -rx removes rx/* (+corresponding rx/hdr/-ones), rx/*.part, rx/*.nock packets
* -part removes only rx/*.part
* -nock removes only rx/*.nock
* -seen removes rx/seen/*
* -rx -hdr removes only rx/hdr/*
* -tx -hdr removes only tx/hdr/*
* -pkt removes only specified packets found in rx/, tx/, rx/seen/
* -area removes only area/*/*

I will release it today in 8.7.2. I also made some integration tests for
it to be sure of expectations.

>What does -area do exactly?  It says just "seen" files in area subdirs;
>are those the only files that would be there, or might there be others?

If multicast areas are in use, then spool/NODE/area/AREAID/MSGID packets
are created for each seen/processed file for the given area and given
node. -area removes packets from all spool/NODE/area/AREAID subdirectories.
It is intended just to cleanup very old AREAID/MSGID-seen files.

>With nncp-rm -tmp, does it (or should it) also respect -older?  So
>nncp-rm -tmp -older 7d should be safe?  (and it wouldn't need -all)

No -all is needed, yes, because temporary files are placed in spool/tmp/
and are not related to any node directly. And yes, it already respected
-older option, so it is safe to use "-tmp -older ...".

>If I got -older working, then I think a full maintenance (clearing out
>cruft but not packets) would look like this:
>
>for TYPE in part seen hdr area; do
>nncp-rm -all -older 7d -$TYPE
>done
>nncp-rm -tmp -older 7d
>
>Does that sound right?

Yep, with ongoing release should be so.

-- 
Sergey Matveev (http://www.stargrave.org/)
OpenPGP: CF60 E89A 5923 1E76 E263  6422 AE1A 8109 E498 57EF