summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
98c0341)
Having a special init path for external indices is probably
easier than further overloading SearchIdx->new initialization
to work without an Inbox object.
die "$$ $0 still in transaction\n" if $self->{txn};
}
die "$$ $0 still in transaction\n" if $self->{txn};
}
+sub eidx_shard_new {
+ my ($class, $eidx, $shard) = @_;
+ my $self = bless {
+ xpfx => $eidx->{xpfx},
+ indexlevel => $eidx->{indexlevel},
+ -skip_docdata => 1,
+ shard => $shard,
+ creat => 1,
+ }, $class;
+ $self->{-set_indexlevel_once} = 1 if $self->{indexlevel} eq 'medium';
+ $self;
+}
+
use PublicInbox::Eml;
sub new {
use PublicInbox::Eml;
sub new {
- my ($class, $v2w, $shard) = @_;
+ my ($class, $v2w, $shard) = @_; # v2w may be ExtSearchIdx
- my $self = $class->SUPER::new($ibx, 1, $shard);
+ my $self = $ibx ? $class->SUPER::new($ibx, 1, $shard)
+ : $class->eidx_shard_new($v2w, $shard);
# create the DB before forking:
$self->idx_acquire;
$self->set_metadata_once;
# create the DB before forking:
$self->idx_acquire;
$self->set_metadata_once;
# this reads all the writes to $self->{w} from the parent process
sub shard_worker_loop ($$$$$) {
my ($self, $v2w, $r, $shard, $bnote) = @_;
# this reads all the writes to $self->{w} from the parent process
sub shard_worker_loop ($$$$$) {
my ($self, $v2w, $r, $shard, $bnote) = @_;
- $0 = "pi-v2-shard[$shard]";
$self->begin_txn_lazy;
while (my $line = readline($r)) {
$v2w->{current_info} = "[$shard] $line";
$self->begin_txn_lazy;
while (my $line = readline($r)) {
$v2w->{current_info} = "[$shard] $line";