X-Git-Url: http://www.git.stargrave.org/?a=blobdiff_plain;f=lib%2FPublicInbox%2FImport.pm;h=362cdc47375db4b7947c41747c6d15bf91583d7d;hb=40f3f2a2c805fc37c7ed35a60948856bd962b493;hp=3adf9dec21785ee9865a22bcdd8e7a338051dcac;hpb=4481b372ba150c669b2fefe2d6ec5dccb5da1d40;p=public-inbox.git diff --git a/lib/PublicInbox/Import.pm b/lib/PublicInbox/Import.pm index 3adf9dec..362cdc47 100644 --- a/lib/PublicInbox/Import.pm +++ b/lib/PublicInbox/Import.pm @@ -413,19 +413,19 @@ sub add { $smsg->{blob} = $self->get_mark(":$blob"); $smsg->set_bytes($raw_email, $n); if (my $oidx = delete $smsg->{-oidx}) { # used by LeiStore - my @docids = $oidx->blob_exists($smsg->{blob}); - my @vivify_xvmd; - for my $id (@docids) { - if (my $cur = $oidx->get_art($id)) { - # already imported if bytes > 0 - return if $cur->{bytes} > 0; - push @vivify_xvmd, $id; - } else { - warn "W: $smsg->{blob} ", - "#$id gone (bug?)\n"; - } - } - $smsg->{-vivify_xvmd} = \@vivify_xvmd; + my $eidx_git = delete $smsg->{-eidx_git}; + + # we need this sharedkv to dedupe blobs added in the + # same fast-import transaction + my $u = $self->{uniq_skv} //= do { + require PublicInbox::SharedKV; + my $x = PublicInbox::SharedKV->new; + $x->dbh; + $x; + }; + return if !$u->set_maybe(pack('H*', $smsg->{blob}), 1); + return if (!$oidx->vivify_xvmd($smsg) && + $eidx_git->check($smsg->{blob})); } } my $ref = $self->{ref};