if (my $new_smsg = $req->{new_smsg}) { # 'm' on cross-posted message
my $xnum = $req->{xnum};
$self->{oidx}->add_xref3($docid, $xnum, $oid, $eidx_key);
- $idx->shard_add_eidx_info($docid, $eidx_key, $eml);
+ $idx->ipc_do('add_eidx_info', $docid, $eidx_key, $eml);
check_batch_limit($req);
} else { # 'd'
my $rm_eidx_info;
\$rm_eidx_info);
if ($nr == 0) {
$self->{oidx}->eidxq_del($docid);
- $idx->shard_remove($docid);
+ $idx->ipc_do('xdb_remove', $docid);
} elsif ($rm_eidx_info) {
- $idx->shard_remove_eidx_info($docid, $eidx_key, $eml);
+ $idx->ipc_do('remove_eidx_info',
+ $docid, $eidx_key, $eml);
$self->{oidx}->eidxq_add($docid); # yes, add
}
}
}
} else {
warn "I: remove #$docid $eidx_key @oid\n";
- $self->idx_shard($docid)->shard_remove($docid);
+ $self->idx_shard($docid)->ipc_do('xdb_remove', $docid);
}
}
for my $x (reverse @$stable) {
$ibx = _ibx_for($self, $sync, $x);
my $hdr = delete $x->{hdr} // die 'BUG: no {hdr}';
- $idx->shard_add_eidx_info($docid, $ibx->eidx_key, $hdr);
+ $idx->ipc_do('add_eidx_info', $docid, $ibx->eidx_key, $hdr);
}
return if $nr == 1; # likely, all good
my $remain = $self->{oidx}->remove_xref3($docid, $expect_oid);
if ($remain == 0) {
warn "W: #$docid gone or corrupted\n";
- $self->idx_shard($docid)->shard_remove($docid);
+ $self->idx_shard($docid)->ipc_do('xdb_remove', $docid);
} 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";
- $self->idx_shard($docid)->shard_remove($docid);
+ $self->idx_shard($docid)->ipc_do('xdb_remove', $docid);
}
return;
}
BUG? #$docid $smsg->{blob} is not referenced by inboxes during reindex
$self->{oidx}->delete_by_num($docid);
- $self->idx_shard($docid)->shard_remove($docid);
+ $self->idx_shard($docid)->ipc_do('xdb_remove', $docid);
return;
}
if (scalar(@$xr3) == 0) { # all gone
$self->{oidx}->delete_by_num($docid);
$self->{oidx}->eidxq_del($docid);
- $idx->shard_remove($docid);
+ $idx->ipc_do('xdb_remove', $docid);
} else { # enqueue for reindex of remaining messages
- $idx->shard_remove_eidx_info($docid,
- $ibx->eidx_key);
+ $idx->ipc_do('remove_eidx_info',
+ $docid, $ibx->eidx_key);
$self->{oidx}->eidxq_add($docid); # yes, add
}
}
my $eidx = eidx_init($self);
my @docids = _docids_for($self, $eml);
for my $docid (@docids) {
- $eidx->idx_shard($docid)->shard_set_keywords($docid, @kw);
+ $eidx->idx_shard($docid)->ipc_do('set_keywords', $docid, @kw);
}
\@docids;
}
my $eidx = eidx_init($self);
my @docids = _docids_for($self, $eml);
for my $docid (@docids) {
- $eidx->idx_shard($docid)->shard_add_keywords($docid, @kw);
+ $eidx->idx_shard($docid)->ipc_do('add_keywords', $docid, @kw);
}
\@docids;
}
my $eidx = eidx_init($self);
my @docids = _docids_for($self, $eml);
for my $docid (@docids) {
- $eidx->idx_shard($docid)->shard_remove_keywords($docid, @kw);
+ $eidx->idx_shard($docid)->ipc_do('remove_keywords', $docid, @kw)
}
\@docids;
}
for my $docid (@docids) {
my $idx = $eidx->idx_shard($docid);
$oidx->add_xref3($docid, -1, $smsg->{blob}, '.');
- $idx->shard_add_eidx_info($docid, '.', $eml); # List-Id
- $idx->shard_add_keywords($docid, @kw) if @kw;
+ # add_eidx_info for List-Id
+ $idx->ipc_do('add_eidx_info', $docid, '.', $eml);
+ $idx->ipc_do('add_keywords', $docid, @kw) if @kw;
}
\@docids;
} else {
$oidx->add_xref3($smsg->{num}, -1, $smsg->{blob}, '.');
my $idx = $eidx->idx_shard($smsg->{num});
$idx->index_raw($msgref, $eml, $smsg);
- $idx->shard_add_keywords($smsg->{num}, @kw) if @kw;
+ $idx->ipc_do('add_keywords', $smsg->{num}, @kw) if @kw;
$smsg;
}
}
sub xdb_remove {
my ($self, @docids) = @_;
+ $self->begin_txn_lazy;
my $xdb = $self->{xdb} or return;
for my $docid (@docids) {
eval { $xdb->delete_document($docid) };
}
}
-sub remove_by_docid {
- my ($self, $num) = @_;
- die "BUG: remove_by_docid is v2-only\n" if $self->{oidx};
- $self->begin_txn_lazy;
- xdb_remove($self, $num) if need_xapian($self);
-}
-
sub index_git_blob_id {
my ($doc, $pfx, $objid) = @_;
$self->ipc_do('add_message', $eml, $smsg);
}
-sub shard_add_eidx_info {
- my ($self, $docid, $eidx_key, $eml) = @_;
- $self->ipc_do('add_eidx_info', $docid, $eidx_key, $eml);
-}
-
-sub shard_remove_eidx_info {
- my ($self, $docid, $eidx_key, $eml) = @_;
- $self->ipc_do('remove_eidx_info', $docid, $eidx_key, $eml);
-}
-
# needed when there's multiple IPC workers and the parent forking
# causes newer siblings to inherit older siblings sockets
sub shard_atfork_child {
$self->ipc_worker_stop;
}
-sub shard_remove {
- my ($self, $num) = @_;
- $self->ipc_do('remove_by_docid', $num);
-}
-
-sub shard_set_keywords {
- my ($self, $docid, @kw) = @_;
- $self->ipc_do('set_keywords', $docid, @kw);
-}
-
-sub shard_remove_keywords {
- my ($self, $docid, @kw) = @_;
- $self->ipc_do('remove_keywords', $docid, @kw);
-}
-
-sub shard_add_keywords {
- my ($self, $docid, @kw) = @_;
- $self->ipc_do('add_keywords', $docid, @kw);
-}
-
sub shard_over_check {
my ($self, $over) = @_;
if ($self->{-ipc_sock} && $over->{dbh}) {
my ($self, $oid, $mid) = @_;
my @removed = $self->{oidx}->remove_oid($oid, $mid);
for my $num (@removed) {
- my $idx = idx_shard($self, $num);
- $idx->shard_remove($num);
+ idx_shard($self, $num)->ipc_do('xdb_remove', $num);
}
}