From: Eric Wong <e@80x24.org>
To: meta@public-inbox.org
Subject: [PATCH] net_reader: NNTP: remove article numbers from mail_sync folders
Date: Sun, 19 Sep 2021 17:51:57 -0500 [thread overview]
Message-ID: <20210919225157.24276-1-e@80x24.org> (raw)
NNTP article numbers are stored separately from folder names
in mail_sync.sqlite3.
Recovering from this is optional, worse case is wasting
bandwidth refetching some messages. To (optionally) recover
from this, use:
lei forget-mail-sync $URL_WITH_ARTNUMS
Some articles will be refetched on the next import, but
duplicate data won't be indexed in Xapian.
---
lib/PublicInbox/NetReader.pm | 5 ++++-
t/lei-import-nntp.t | 4 ++++
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/lib/PublicInbox/NetReader.pm b/lib/PublicInbox/NetReader.pm
index fbe1ac4f..eab7320e 100644
--- a/lib/PublicInbox/NetReader.pm
+++ b/lib/PublicInbox/NetReader.pm
@@ -729,7 +729,10 @@ sub _nntp_fetch_all ($$$) {
}
(defined($num_a) && defined($num_b) && $num_a > $num_b) and
return "E: $uri: backwards range: $num_a > $num_b";
-
+ if (defined($num_a)) { # no article numbers in mail_sync.sqlite3
+ $uri = $uri->clone;
+ $uri->group($group);
+ }
# IMAPTracker is also used for tracking NNTP, UID == article number
# LIST.ACTIVE can get the equivalent of UIDVALIDITY, but that's
# expensive. So we assume newsgroups don't change:
diff --git a/t/lei-import-nntp.t b/t/lei-import-nntp.t
index 1eb41e0e..df0594d4 100644
--- a/t/lei-import-nntp.t
+++ b/t/lei-import-nntp.t
@@ -49,12 +49,16 @@ test_lei({ tmpdir => $tmpdir }, sub {
my $end = $high - 1;
lei_ok qw(import), "$url/$high";
+ lei_ok 'ls-mail-sync';
+ is($lei_out, "$url\n", 'article number not stored as folder');
lei_ok qw(q z:0..); my $one = json_utf8->decode($lei_out);
pop @$one; # trailing null
is(scalar(@$one), 1, 'only 1 result');
local $ENV{HOME} = "$tmpdir/h3";
lei_ok qw(import), "$url/$low-$end";
+ lei_ok 'ls-mail-sync';
+ is($lei_out, "$url\n", 'article range not stored as folder');
lei_ok qw(q z:0..); my $start = json_utf8->decode($lei_out);
pop @$start; # trailing null
is(scalar(@$start), scalar(map { $_ } ($low..$end)),
reply other threads:[~2021-09-19 22:51 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://public-inbox.org/README
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210919225157.24276-1-e@80x24.org \
--to=e@80x24.org \
--cc=meta@public-inbox.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).