-# Copyright (C) 2015-2021 all contributors <meta@public-inbox.org>
+# Copyright (C) all contributors <meta@public-inbox.org>
# License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
# based on notmuch, but with no concept of folders, files
#
use POSIX qw(strftime);
use Time::Local qw(timegm);
use PublicInbox::OverIdx;
-use PublicInbox::Spawn qw(spawn nodatacow_dir);
+use PublicInbox::Spawn qw(spawn);
use PublicInbox::Git qw(git_unquote);
use PublicInbox::MsgTime qw(msg_timestamp msg_datestamp);
use PublicInbox::Address;
if (!-d $dir && (!$is_shard ||
($is_shard && need_xapian($self)))) {
File::Path::mkpath($dir);
- nodatacow_dir($dir);
+ require PublicInbox::Syscall;
+ PublicInbox::Syscall::nodatacow_dir($dir);
$self->{-set_has_threadid_once} = 1;
}
}
} elsif (m!^diff --git "?[^/]+/.+ "?[^/]+/.+\z!) {
# wait until "---" and "+++" to capture filenames
$in_diff = 1;
+ push @xnq, $_;
# traditional diff:
} elsif (m/^diff -(.+) (\S+) (\S+)$/) {
my ($opt, $fa, $fb) = ($1, $2, $3);
sub _msgmap_init ($) {
my ($self) = @_;
die "BUG: _msgmap_init is only for v1\n" if $self->{ibx}->version != 1;
- $self->{mm} //= eval {
+ $self->{mm} //= do {
require PublicInbox::Msgmap;
PublicInbox::Msgmap->new_file($self->{ibx}, 1);
};
$self->{xdb}->replace_document($docid, $doc);
}
+sub get_terms {
+ my ($self, $pfx, $docid) = @_;
+ begin_txn_lazy($self);
+ xap_terms($pfx, $self->{xdb}, $docid);
+}
+
sub remove_eidx_info {
my ($self, $docid, $eidx_key, $eml) = @_;
begin_txn_lazy($self);
${$sync->{max}} = $self->{batch_bytes};
$self->{mm}->{dbh}->commit;
+ eval { $self->{mm}->{dbh}->do('PRAGMA optimize') };
my $xdb = $self->{xdb};
if ($newest && $xdb) {
my $cur = $xdb->get_metadata('last_commit');
push @cmd, "--$k=$v";
}
my $fh = $git->popen(@cmd, $range);
- my ($at, $ct, $stk, $cmt);
- while (<$fh>) {
+ my ($at, $ct, $stk, $cmt, $l);
+ while (defined($l = <$fh>)) {
return if $sync->{quit};
- if (/\A([0-9]+)-([0-9]+)-($OID)$/o) {
+ if ($l =~ /\A([0-9]+)-([0-9]+)-($OID)$/o) {
($at, $ct, $cmt) = ($1 + 0, $2 + 0, $3);
$stk //= PublicInbox::IdxStack->new($cmt);
- } elsif (/$del/) {
+ } elsif ($l =~ /$del/) {
my $oid = $1;
if ($D) { # reindex case
$D->{pack('H*', $oid)}++;
} else { # non-reindex case:
$stk->push_rec('d', $at, $ct, $oid, $cmt);
}
- } elsif (/$add/) {
+ } elsif ($l =~ /$add/) {
my $oid = $1;
if ($D) {
my $oid_bin = pack('H*', $oid);