diff options
author | Eric Wong <e@80x24.org> | 2020-12-09 09:25:12 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2020-12-10 06:39:39 +0000 |
commit | 02b2fcc46f364b51ca8434316c10eff41593b15e (patch) | |
tree | cd3e9642011b36018b3a22d232115368b3bd086d /lib/PublicInbox/V2Writable.pm | |
parent | abf5f024af0a78f27b132772838ed1189e2ba75b (diff) | |
download | public-inbox-02b2fcc46f364b51ca8434316c10eff41593b15e.tar.gz |
We cannot set xref3 data without the `xnum' column to tie it to the per-inbox over.sqlite3 DB. So ensure we don't read brand-new history that only exists in git, but instead rely on last_commit and last_xap15-$EPOCH metadata in msgmap to decide how far we can index. Before this change, it was possible to miss messages in the extindex if -index did not run (which will be fixable by upcoming --reindex support in -extindex).
Diffstat (limited to 'lib/PublicInbox/V2Writable.pm')
-rw-r--r-- | lib/PublicInbox/V2Writable.pm | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/lib/PublicInbox/V2Writable.pm b/lib/PublicInbox/V2Writable.pm index 07a7fa42..bef3a67a 100644 --- a/lib/PublicInbox/V2Writable.pm +++ b/lib/PublicInbox/V2Writable.pm @@ -1073,10 +1073,22 @@ sub sync_prepare ($$) { $pfx //= $sync->{ibx}->{inboxdir}; } - # reindex stops at the current heads and we later rerun index_sync - # without {reindex} - my $reindex_heads = $self->last_commits($sync) if $sync->{reindex}; - + my $reindex_heads; + if ($self->{ibx_map}) { + # ExtSearchIdx won't index messages unless they're in + # over.sqlite3 for a given inbox, so don't read beyond + # what's in the per-inbox index. + $reindex_heads = []; + my $v = PublicInbox::Search::SCHEMA_VERSION; + my $mm = $sync->{ibx}->mm; + for my $i (0..$sync->{epoch_max}) { + $reindex_heads->[$i] = $mm->last_commit_xap($v, $i); + } + } elsif ($sync->{reindex}) { # V2 inbox + # reindex stops at the current heads and we later + # rerun index_sync without {reindex} + $reindex_heads = $self->last_commits($sync); + } if ($sync->{max_size} = $sync->{-opt}->{max_size}) { $sync->{index_oid} = $self->can('index_oid'); } |