]> Sergey Matveev's repositories - public-inbox.git/commitdiff
extindex: add undocumented --no-scan switch
authorEric Wong <e@80x24.org>
Sat, 26 Dec 2020 10:16:23 +0000 (10:16 +0000)
committerEric Wong <e@80x24.org>
Sun, 27 Dec 2020 09:30:33 +0000 (09:30 +0000)
This makes diagnosing --watch problems easier when there's
50K inboxes by avoiding the lengthy scan (which is the reason
--watch exists in the first place).

lib/PublicInbox/ExtSearchIdx.pm
script/public-inbox-extindex

index 778154a564b20433cf841adcd596ae121bb63ac7..07e646985a4715d273b2f7b7f80f2c0374179d7b 100644 (file)
@@ -881,9 +881,11 @@ sub eidx_sync { # main entry point
        }
 
        # don't use $_ here, it'll get clobbered by reindex_checkpoint
-       for my $ibx (@{$self->{ibx_list}}) {
-               last if $sync->{quit};
-               sync_inbox($self, $sync, $ibx);
+       if ($opt->{scan} // 1) {
+               for my $ibx (@{$self->{ibx_list}}) {
+                       last if $sync->{quit};
+                       sync_inbox($self, $sync, $ibx);
+               }
        }
        $self->{oidx}->rethread_done($opt) unless $sync->{quit};
        eidxq_process($self, $sync) unless $sync->{quit};
index 17986f606e93f16872aa7e4df2d0ad72cad4fe59..f4ffda4b43703694a8da671ceb43416514dd4b33 100644 (file)
@@ -23,12 +23,12 @@ usage: public-inbox-extindex [options] EXTINDEX_DIR [INBOX_DIR]
 BYTES may use `k', `m', and `g' suffixes (e.g. `10m' for 10 megabytes)
 See public-inbox-extindex(1) man page for full documentation.
 EOF
-my $opt = { quiet => -1, compact => 0, max_size => undef, fsync => 1 };
+my $opt = { quiet => -1, compact => 0, fsync => 1, scan => 1 };
 GetOptions($opt, qw(verbose|v+ reindex rethread compact|c+ jobs|j=i
                fsync|sync!
                indexlevel|index-level|L=s max_size|max-size=s
                batch_size|batch-size=s
-               gc commit-interval=i watch
+               gc commit-interval=i watch scan!
                all help|h))
        or die $help;
 if ($opt->{help}) { print $help; exit 0 };