]> Sergey Matveev's repositories - public-inbox.git/commitdiff
searchidx: respect XAPIAN_FLUSH_THRESHOLD env if set
authorEric Wong <e@80x24.org>
Thu, 19 Jul 2018 03:21:38 +0000 (03:21 +0000)
committerEric Wong <e@80x24.org>
Thu, 19 Jul 2018 03:22:15 +0000 (03:22 +0000)
Xapian documents and respect XAPIAN_FLUSH_THRESHOLD to define
the interval in documents to flush, so don't override it with
our own BATCH_BYTES.  This is helpful for initial indexing for
those on slower storage but enough RAM.

It is unnecessary for -watch and frequent incremental indexing;
and it increases transaction times if -watch is playing "catch-up"
if it was stopped for a while.

The original BATCH_BYTES was tuned for a machine with little
memory as the default XAPIAN_FLUSH_THRESHOLD of 10000 documents
was causing swap storms.  Using document counts also proved an
innaccurate estimator of RAM usage compared to the actual bytes
processed.

lib/PublicInbox/SearchIdx.pm

index 04e853069f0661c24b5d223d2c1ad72f47e7232b..bb60506ce1a9996e1d6a9971e61459cf13b250b7 100644 (file)
@@ -22,7 +22,8 @@ require PublicInbox::Git;
 use Compress::Zlib qw(compress);
 
 use constant {
-       BATCH_BYTES => 1_000_000,
+       BATCH_BYTES => defined($ENV{XAPIAN_FLUSH_THRESHOLD}) ?
+                       0x7fffffff : 1_000_000,
        DEBUG => !!$ENV{DEBUG},
 };