The "xdb" prefix was inaccurate since it's used by
indexlevel=basic, which is Xapian-free. The '_' (underscore)
prefix was also wrong for a method which is called across
package boundaries.
sub need_xapian ($) { $_[0]->{indexlevel} =~ $xapianlevels }
sub need_xapian ($) { $_[0]->{indexlevel} =~ $xapianlevels }
my ($self, $wake) = @_;
if (need_xapian($self)) {
my $xdb = delete $self->{xdb} or croak 'not acquired';
my ($self, $wake) = @_;
if (need_xapian($self)) {
my $xdb = delete $self->{xdb} or croak 'not acquired';
my ($self) = @_;
my $flag;
my $dir = $self->xdir;
my ($self) = @_;
my $flag;
my $dir = $self->xdir;
$git->cleanup;
delete $self->{txn};
$xdb->cancel_transaction if $xdb;
$git->cleanup;
delete $self->{txn};
$xdb->cancel_transaction if $xdb;
- $xdb = _xdb_release($self);
+ $xdb = idx_release($self);
# ensure we leak no FDs to "git log" with Xapian <= 1.2
my $range = $lx eq '' ? $tip : "$lx..$tip";
# ensure we leak no FDs to "git log" with Xapian <= 1.2
my $range = $lx eq '' ? $tip : "$lx..$tip";
$self->{over}->rethread_done($opts) if $newest; # all done
$self->commit_txn_lazy;
$git->cleanup;
$self->{over}->rethread_done($opts) if $newest; # all done
$self->commit_txn_lazy;
$git->cleanup;
- $xdb = _xdb_release($self, $nr);
+ $xdb = idx_release($self, $nr);
# let another process do some work...
$pr->("indexed $nr/$self->{ntodo}\n") if $pr && $nr;
if (!$newest) { # more to come
# let another process do some work...
$pr->("indexed $nr/$self->{ntodo}\n") if $pr && $nr;
if (!$newest) { # more to come
$? == 0 or die ref($self)." pid:$pid exited with: $?";
} else {
die "transaction in progress $self\n" if $self->{txn};
$? == 0 or die ref($self)." pid:$pid exited with: $?";
} else {
die "transaction in progress $self\n" if $self->{txn};
- $self->_xdb_release if $self->{xdb};
+ idx_release($self) if $self->{xdb};
sub _begin_txn {
my ($self) = @_;
sub _begin_txn {
my ($self) = @_;
- my $xdb = $self->{xdb} || $self->_xdb_acquire;
+ my $xdb = $self->{xdb} || idx_acquire($self);
$self->{over}->begin_lazy if $self->{over};
$xdb->begin_transaction if $xdb;
$self->{txn} = 1;
$self->{over}->begin_lazy if $self->{over};
$xdb->begin_transaction if $xdb;
$self->{txn} = 1;
my $ibx = $v2w->{ibx};
my $self = $class->SUPER::new($ibx, 1, $shard);
# create the DB before forking:
my $ibx = $v2w->{ibx};
my $self = $class->SUPER::new($ibx, 1, $shard);
# create the DB before forking:
$self->spawn_worker($v2w, $shard) if $v2w->{parallel};
$self;
}
$self->spawn_worker($v2w, $shard) if $v2w->{parallel};
$self;
}
if ($line eq "commit\n") {
$self->commit_txn_lazy;
} elsif ($line eq "close\n") {
if ($line eq "commit\n") {
$self->commit_txn_lazy;
} elsif ($line eq "close\n") {
} elsif ($line eq "barrier\n") {
$self->commit_txn_lazy;
# no need to lock < 512 bytes is atomic under POSIX
} elsif ($line eq "barrier\n") {
$self->commit_txn_lazy;
# no need to lock < 512 bytes is atomic under POSIX
my $im = $ibx->importer(0);
if ($V == 1) {
my $sidx = PublicInbox::SearchIdx->new($ibx, 1);
my $im = $ibx->importer(0);
if ($V == 1) {
my $sidx = PublicInbox::SearchIdx->new($ibx, 1);
- $sidx->_xdb_release; # allow watching on lockfile
+ $sidx->idx_release; # allow watching on lockfile
}
my $pi_config = PublicInbox::Config->new(\<<EOF);
publicinbox.inbox-idle.inboxdir=$inboxdir
}
my $pi_config = PublicInbox::Config->new(\<<EOF);
publicinbox.inbox-idle.inboxdir=$inboxdir
my $rw = PublicInbox::SearchIdx->new($ibx, 1);
$ibx->with_umask(sub {
my $rw = PublicInbox::SearchIdx->new($ibx, 1);
$ibx->with_umask(sub {
- $rw->_xdb_acquire;
- $rw->_xdb_release;
+ $rw->idx_acquire;
+ $rw->idx_release;
});
$rw = undef;
my $ro = PublicInbox::Search->new($ibx);
});
$rw = undef;
my $ro = PublicInbox::Search->new($ibx);