$self->{ibx_map}->{$ibx->eidx_key} //= do {
push @{$self->{ibx_active}}, $ibx;
push @{$self->{ibx_known}}, $ibx;
+ $ibx;
}
}
# invalidate cache
||
$a->[1] <=> $b->[1] # break ties with {xnum}
} @$xr3;
- my $top_blob = unpack('H*', $xr3->[0]->[2]);
my $new_smsg = $req->{new_smsg};
- return if $top_blob ne $new_smsg->{blob}; # loser
+ return if $xr3->[0]->[2] ne pack('H*', $new_smsg->{blob}); # loser
# replace the old smsg with the more boosted one
$new_smsg->{num} = $smsg->{num};
my $xref3 = $self->{oidx}->get_xref3($smsg->{num});
my @keep = grep(!/:$smsg->{blob}\z/, @$xref3);
if (@keep) {
+ warn "E: $smsg->{blob} gone, removing #$smsg->{num}\n";
$keep[0] =~ /:([a-f0-9]{40,}+)\z/ or
die "BUG: xref $keep[0] has no OID";
my $oidhex = $1;
$self->{oidx}->remove_xref3($smsg->{num}, $smsg->{blob});
- my $upd = $self->{oidx}->update_blob($smsg, $oidhex);
- my $saved = $self->{oidx}->get_art($smsg->{num});
+ $self->{oidx}->update_blob($smsg, $oidhex) or warn <<EOM;
+E: #$smsg->{num} gone ($smsg->{blob} => $oidhex)
+EOM
} else {
+ warn "E: $smsg->{blob} gone, removing #$smsg->{num}\n";
$self->{oidx}->delete_by_num($smsg->{num});
}
}
sub eidxq_process ($$) { # for reindexing
my ($self, $sync) = @_;
+ return unless $self->{cfg};
return unless eidxq_lock_acquire($self);
my $dbh = $self->{oidx}->dbh;
sub eidx_reindex {
my ($self, $sync) = @_;
+ return unless $self->{cfg};
# acquire eidxq_lock early because full reindex takes forever
# and incremental -extindex processes can run during our checkpoints
};
my $quit = PublicInbox::SearchIdx::quit_cb($sync);
$sig->{QUIT} = $sig->{INT} = $sig->{TERM} = $quit;
- my $sigfd = PublicInbox::Sigfd->new($sig,
- $PublicInbox::Syscall::SFD_NONBLOCK);
- @SIG{keys %$sig} = values(%$sig) if !$sigfd;
local $self->{-watch_sync} = $sync; # for ->on_inbox_unlock
- if (!$sigfd) {
- # wake up every second to accept signals if we don't
- # have signalfd or IO::KQueue:
- PublicInbox::DS::sig_setmask($oldset);
- PublicInbox::DS->SetLoopTimeout(1000);
- }
PublicInbox::DS->SetPostLoopCallback(sub { !$sync->{quit} });
$pr->("initial scan complete, entering event loop\n") if $pr;
- PublicInbox::DS->EventLoop; # calls InboxIdle->event_step
+ # calls InboxIdle->event_step:
+ PublicInbox::DS::event_loop($sig, $oldset);
done($self);
}