use v5.10.1;
use parent qw(PublicInbox::ExtSearch PublicInbox::Lock);
use Carp qw(croak carp);
+use Scalar::Util qw(blessed);
use Sys::Hostname qw(hostname);
use POSIX qw(strftime);
use File::Glob qw(bsd_glob GLOB_NOSORT);
$smsg = $docid;
$docid = $smsg->{num};
}
+ if (defined($oidbin) && defined($xnum) && blessed($ibx) && $ibx->over) {
+ my $smsg = $ibx->over->get_art($xnum);
+ if ($smsg && pack('H*', $smsg->{blob}) eq $oidbin) {
+ carp("BUG: (non-fatal) ".$ibx->eidx_key.
+ " #$xnum $smsg->{blob} still valid");
+ return;
+ }
+ }
my $s = 'DELETE FROM xref3 WHERE oidbin = ?';
$s .= ' AND ibx_id = ?' if defined($ibx);
$s .= ' AND xnum = ?' if defined($xnum);
my $oidbin = pack('H*', $expect_oid);
my $remain = _unref_doc($sync, $docid, undef, undef, $oidbin);
if ($remain == 0) {
- warn "W: #$docid gone or corrupted\n";
+ warn "W: #$docid ($oid) gone or corrupt\n";
} elsif (my $next_oid = $req->{xr3r}->[++$req->{ix}]->[2]) {
$self->git->cat_async($next_oid, \&_reindex_oid, $req);
} else {
- warn "BUG: #$docid gone (UNEXPECTED)\n";
+ warn "BUG: #$docid ($oid) gone (UNEXPECTED)\n";
}
return;
}
sub eidxq_process ($$) { # for reindexing
my ($self, $sync) = @_;
- return unless $self->{cfg};
-
- return unless eidxq_lock_acquire($self);
+ local $self->{current_info} = 'eidxq process';
+ return unless ($self->{cfg} && eidxq_lock_acquire($self));
my $dbh = $self->{oidx}->dbh;
my $tot = $dbh->selectrow_array('SELECT COUNT(*) FROM eidxq') or return;
${$sync->{nr}} = 0;