diff options
Diffstat (limited to 'lib/PublicInbox')
-rw-r--r-- | lib/PublicInbox/ExtSearchIdx.pm | 7 | ||||
-rw-r--r-- | lib/PublicInbox/V2Writable.pm | 20 |
2 files changed, 22 insertions, 5 deletions
diff --git a/lib/PublicInbox/ExtSearchIdx.pm b/lib/PublicInbox/ExtSearchIdx.pm index b0a12bca..84449cb4 100644 --- a/lib/PublicInbox/ExtSearchIdx.pm +++ b/lib/PublicInbox/ExtSearchIdx.pm @@ -291,7 +291,12 @@ sub _sync_inbox ($$$) { } elsif ($v == 1) { my $uv = $ibx->uidvalidity; my $lc = $self->{oidx}->eidx_meta("lc-v1:$ekey//$uv"); - my $stk = prepare_stack($sync, $lc ? "$lc..HEAD" : 'HEAD'); + my $head = $ibx->mm->last_commit; + unless (defined $head) { + warn "E: $ibx->{inboxdir} is not indexed\n"; + return; + } + my $stk = prepare_stack($sync, $lc ? "$lc..$head" : $head); my $unit = { stack => $stk, git => $ibx->git }; push @{$sync->{todo}}, $unit; } else { 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'); } |