From d7499f74c9eed7cebb6a4e273f04c854c1674c06 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Wed, 10 Jun 2020 07:05:17 +0000 Subject: imap: remove non-UID SEARCH for now Supporting MSNs in long-lived connections beyond the lifetime of a single request/response cycle is not scalable to a C10K scenario. It's probably not needed, since most clients seem to use UIDs. A somewhat efficient implementation I can come up uses pack("S*" ...) (AKA "uint16_t mapping[50000]") has an overhead of 100K per-client socket on a mailbox with 50K messages. The 100K is a contiguous scalar, so it could be swapped out for idle clients on most architectures if THP is disabled. An alternative could be to use a tempfile as an allocator partitioned into 100K chunks (or SQLite); but I'll only do that if somebody presents a compelling case to support MSN SEARCH. --- t/imapd.t | 37 ------------------------------------- 1 file changed, 37 deletions(-) (limited to 't') diff --git a/t/imapd.t b/t/imapd.t index c7e0baaa..f5ca8b7e 100644 --- a/t/imapd.t +++ b/t/imapd.t @@ -360,43 +360,6 @@ is(scalar keys %$ret, 3, 'got all 3 messages with comma-separated sequence'); $ret = $mic->fetch_hash('1:*', 'RFC822') or BAIL_OUT "FETCH $@"; is(scalar keys %$ret, 3, 'got all 3 messages'); -SKIP: { - # do any clients use non-UID IMAP SEARCH? - skip 'Xapian missing', 2 if $level eq 'basic'; - my $x = $mic->search('all'); - is_deeply($x, [1, 2, 3], 'MSN SEARCH works before rm'); - $x = $mic->search(qw(header subject embedded)); - is_deeply($x, [2], 'MSN SEARCH on Subject works before rm'); -} - -{ - my $rdr = { 0 => \($ret->{1}->{RFC822}) }; - my $env = { HOME => $ENV{HOME} }; - my @cmd = qw(-learn rm --all); - run_script(\@cmd, $env, $rdr) or BAIL_OUT('-learn rm'); -} - -SKIP: { - # do any clients use non-UID IMAP SEARCH? We only ensure - # MSN "SEARCH" can return a result which can be retrieved - # via MSN "FETCH" - skip 'Xapian missing', 3 if $level eq 'basic'; - my $x = $mic->search(qw(header subject embedded)); - is(scalar(@$x), 1, 'MSN SEARCH on Subject works after rm'); - $x = $mic->message_string($x->[0]); - is($x, $ret->{2}->{RFC822}, 'message 2 unchanged'); -} - -my $r2 = $mic->fetch_hash('1:*', 'BODY.PEEK[]') or BAIL_OUT "FETCH $@"; -is(scalar keys %$r2, 2, 'did not get all 3 messages'); -is($r2->{1}->{'BODY[]'}, $ret->{2}->{RFC822}, 'message 2 unchanged'); -is($r2->{2}->{'BODY[]'}, $ret->{3}->{RFC822}, 'message 3 unchanged'); -$r2 = $mic->fetch_hash(2, 'BODY.PEEK[HEADER.FIELDS (message-id)]') - or BAIL_OUT "FETCH $@"; -is($r2->{2}->{'BODY[HEADER.FIELDS (MESSAGE-ID)]'}, - 'Message-ID: <20200418222508.GA13918@dcvr>'."\r\n\r\n", - 'BODY.PEEK[HEADER.FIELDS ...] drops .PEEK'); - { my @new_list = $mic->list; # tag differs in [-1] -- cgit v1.2.3-24-ge0c7