]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/SearchIdx.pm
extindex: --gc checkpoints
[public-inbox.git] / lib / PublicInbox / SearchIdx.pm
index e5c872d52fd3fd477f42301f7407acbd8d0061fb..78db329d9da9145ff97091004265ce9264231aca 100644 (file)
@@ -637,14 +637,21 @@ sub update_vmd {
 
 sub xdb_remove {
        my ($self, @docids) = @_;
-       $self->begin_txn_lazy;
-       my $xdb = $self->{xdb} or return;
+       begin_txn_lazy($self);
+       my $xdb = $self->{xdb} // die 'BUG: missing {xdb}';
        for my $docid (@docids) {
                eval { $xdb->delete_document($docid) };
                warn "E: #$docid not in in Xapian? $@\n" if $@;
        }
 }
 
+sub xdb_remove_quiet {
+       my ($self, $docid) = @_;
+       begin_txn_lazy($self);
+       my $xdb = $self->{xdb} // die 'BUG: missing {xdb}';
+       eval { $xdb->delete_document($docid) };
+}
+
 sub index_git_blob_id {
        my ($doc, $pfx, $objid) = @_;
 
@@ -1098,25 +1105,4 @@ sub eidx_shard_new {
        $self;
 }
 
-# ensure there's no stale Xapian docs by treating $over as canonical
-sub over_check {
-       my ($self, $over) = @_;
-       begin_txn_lazy($self);
-       my $sth = $over->dbh->prepare(<<'');
-SELECT COUNT(*) FROM over WHERE num = ?
-
-       my $xdb = $self->{xdb};
-       my $cur = $xdb->postlist_begin('');
-       my $end = $xdb->postlist_end('');
-       my $xdir = $self->xdir;
-       for (; $cur != $end; $cur++) {
-               my $docid = $cur->get_docid;
-               $sth->execute($docid);
-               my $x = $sth->fetchrow_array;
-               next if $x > 0;
-               warn "I: removing $xdir #$docid, not in `over'\n";
-               $xdb->delete_document($docid);
-       }
-}
-
 1;