aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuilhem Moulin <guilhem@fripost.org>2019-11-11 16:43:40 +0100
committerGuilhem Moulin <guilhem@fripost.org>2019-11-13 06:23:57 +0100
commitc3bf5d306ff1396d6117774316afd998f6e9874a (patch)
treec9017afe719565f28c233630002a8cc06c70c0ed
parent23046d58204e636880ff4412e52799e0c06065b4 (diff)
interimap: raise SELECT sample set size from 64 to 256 bytes.
A n-bytes set covers at least ⌊(n+1)/11⌋ UIDs (UIDs are at most 10 bytes of size), hence 23 UIDs for 256 bytes long sets. However we exceed it by another range, so in the worst case (if the the higher UIDs are sparse) we'll sample ⌊(n+1)/11+1⌋ UIDs: 1000000000,1000000002,1000000004,…,1000000046 This was 6 UIDs for n=64 which is a tad low; this is now raised to 24 UIDs. The actual set size returned by sample() is of max size n+22 bytes (extra "$UID1:$UID2," where $UID1 and $UID2 are both ≥10⁹).
-rw-r--r--Changelog1
-rwxr-xr-xinterimap7
2 files changed, 5 insertions, 3 deletions
diff --git a/Changelog b/Changelog
index c08de80..f90c28c 100644
--- a/Changelog
+++ b/Changelog
@@ -50,6 +50,7 @@ interimap (0.5) upstream;
full.
+ interimap: new option 'log-prefix' to control the prefix of each log
entry, depending on the component name and relevant mailbox.
+ + interimap: raise SELECT sample range size from 64 to 256 bytes.
- libinterimap: bugfix: hierarchy delimiters in LIST responses were
returned as an escaped quoted special, like "\\", not as a single
character (backslash in this case).
diff --git a/interimap b/interimap
index a409c65..9a1df0b 100755
--- a/interimap
+++ b/interimap
@@ -793,7 +793,7 @@ sub delete_mapping($$) {
# we let the server know that the messages have been EXPUNGEd [RFC7162,
# section 3.2.5.2].
# The UID set is the largest set of higest UIDs with at most 1024 UIDs,
-# of length (once compacted) at most 64.
+# of length (once compacted) at most 256.
# The reason why we sample with the highest UIDs is that lowest UIDs are
# less likely to be deleted.
sub sample($$) {
@@ -814,13 +814,14 @@ sub sample($$) {
$uids = ($min == $max ? $min : "$min:$max")
.(defined $uids ? ','.$uids : '');
$min = $max = $k;
- if (length($uids) > 64) {
+ if (length($uids) > 256) {
$sth->finish(); # done with the statement
last;
}
}
}
- if (!defined $uids or length($uids) <= 64) {
+ if (!defined $uids or length($uids) <= 256) {
+ # exceed max size by at most 22 bytes ("$MIN:$MAX,")
$n += $max - $min + 1;
$uids = ($min == $max ? $min : "$min:$max")
. (defined $uids ? ','.$uids : '');