my $barrier = $self->barrier_init(scalar @$shards);
# each shard needs to issue a barrier command
- $_->remote_barrier for @$shards;
+ $_->shard_barrier for @$shards;
# wait for each Xapian shard
$self->barrier_wait($barrier);
} else {
- $_->remote_commit for @$shards;
+ $_->shard_commit for @$shards;
}
# last_commit is special, don't commit these until
my $shards = delete $self->{idx_shards};
if ($shards) {
for (@$shards) {
- eval { $_->remote_close };
+ eval { $_->shard_close };
$err .= "shard close: $@\n" if $@;
}
}
- eval { $self->{over}->disconnect };
- $err .= "over disconnect: $@\n" if $@;
+ eval { $self->{over}->dbh_close };
+ $err .= "over close: $@\n" if $@;
delete $self->{bnote};
my $nbytes = $self->{total_bytes};
$self->{total_bytes} = 0;
my $opt = $sync->{-opt};
my $pr = $opt->{-progress} if (($opt->{verbose} || 0) > 1);
my $cur = $sync->{ranges}->[$i] or do {
- $pr->("$i.git indexing all of $tip") if $pr;
+ $pr->("$i.git indexing all of $tip\n") if $pr;
return $tip; # all of it
};
my @removed = $self->{over}->remove_oid($oid, $mid);
for my $num (@removed) {
my $idx = idx_shard($self, $num % $self->{shards});
- $idx->remote_remove($oid, $num);
+ $idx->shard_remove($oid, $num);
}
}
$sync->{art_end} = $art_end;
if ($seq || !$self->{parallel}) {
my $shard_end = $self->{shards} - 1;
- for (0..$shard_end) {
- index_xap_step($self, $sync, $art_beg + $_)
+ for my $i (0..$shard_end) {
+ index_xap_step($self, $sync, $art_beg + $i);
+ if ($i != $shard_end) {
+ reindex_checkpoint($self, $sync);
+ }
}
} else { # parallel (maybe)
index_xap_step($self, $sync, $art_beg, 1);
xapian_only($self, $opt, $sync, $art_beg);
}
+ # --reindex on the command-line
+ if ($opt->{reindex} && !ref($opt->{reindex}) && $idxlevel ne 'basic') {
+ $self->lock_acquire;
+ my $s0 = PublicInbox::SearchIdx->new($self->{ibx}, 0, 0);
+ if (my $xdb = $s0->idx_acquire) {
+ my $n = $xdb->get_metadata('has_threadid');
+ $xdb->set_metadata('has_threadid', '1') if $n ne '1';
+ }
+ $s0->idx_release;
+ $self->lock_release;
+ }
+
# reindex does not pick up new changes, so we rerun w/o it:
if ($opt->{reindex}) {
my %again = %$opt;