$sth = $dbh->prepare_cached(<<'', undef, 1);
SELECT docid FROM xref3 WHERE oidbin = ? AND xnum = ? AND ibx_id = ? LIMIT 1
- $sth->bind_param(1, pack('H*', $xsmsg->{blob}), SQL_BLOB);
+ $sth->bind_param(1, $xsmsg->oidbin, SQL_BLOB);
# NNTP::cmd_over can set {num} to zero according to RFC 3977 8.3.2
$sth->bind_param(2, $xsmsg->{num} || $xsmsg->{-orig_num});
$a->[1] <=> $b->[1] # break ties with {xnum}
} @$xr3;
my $new_smsg = $req->{new_smsg};
- return if $xr3->[0]->[2] ne pack('H*', $new_smsg->{blob}); # loser
+ return if $xr3->[0]->[2] ne $new_smsg->oidbin; # loser
# replace the old smsg with the more boosted one
$new_smsg->{num} = $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) {
+ if ($smsg && $smsg->oidbin eq $oidbin) {
carp("BUG: (non-fatal) ".$ibx->eidx_key.
" #$xnum $smsg->{blob} still valid");
return;
my ($req, $smsg) = @_;
# xnum and ibx are unknown, we only call this when an entry from
# /ei*/over.sqlite3 is bad, not on entries from xap*/over.sqlite3
- my $oidbin = pack('H*', $smsg->{blob});
$req->{self}->git->async_wait_all;
- _unref_doc($req, $smsg, undef, undef, $oidbin);
+ _unref_doc($req, $smsg, undef, undef, $smsg->oidbin);
}
sub ck_existing { # git->cat_async callback
for my $ary (values %$by_chash) {
for my $x (reverse @$ary) {
warn "removing #$docid xref3 $x->{blob}\n";
- my $bin = pack('H*', $x->{blob});
+ my $bin = $x->oidbin;
my $n = _unref_doc($sync, $docid, undef, undef, $bin);
die "BUG: $x->{blob} invalidated #$docid" if $n == 0;
}
my $oidx = $self->{oidx};
for my $smsg (@$ary) {
my $gone = $smsg->{num};
- $oidx->merge_xref3($keep->{num}, $gone, $smsg->{blob});
+ $oidx->merge_xref3($keep->{num}, $gone, $smsg->oidbin);
remove_doc($self, $gone);
}
}
}
sub merge_xref3 { # used for "-extindex --dedupe"
- my ($self, $keep_docid, $drop_docid, $oidhex) = @_;
- my $oidbin = pack('H*', $oidhex);
+ my ($self, $keep_docid, $drop_docid, $oidbin) = @_;
my $sth = $self->{dbh}->prepare_cached(<<'');
UPDATE OR IGNORE xref3 SET docid = ? WHERE docid = ? AND oidbin = ?
# large threads in our WWW UI and the NNTP range responses.
package PublicInbox::Smsg;
use strict;
-use warnings;
-use base qw(Exporter);
+use v5.10.1;
+use parent qw(Exporter);
our @EXPORT_OK = qw(subject_normalized);
use PublicInbox::MID qw(mids references);
use PublicInbox::Address;
use PublicInbox::MsgTime qw(msg_timestamp msg_datestamp);
+sub oidbin { pack('H*', $_[0]->{blob}) }
+
sub to_doc_data {
my ($self) = @_;
join("\n",