warn "# eliminated $nr stale Xapian documents\n" if $nr != 0;
}
-sub eidx_gc {
+sub eidx_gc { # top-level entry point
my ($self, $opt) = @_;
$self->{cfg} or die "E: GC requires ->attach_config\n";
$opt->{-idx_gc} = 1;
+ local $self->{checkpoint_unlocks} = 1;
my $sync = {
need_checkpoint => \(my $need_checkpoint),
check_intvl => 10,
next_check => now() + 10,
- checkpoint_unlocks => 1,
-opt => $opt,
self => $self,
};
}
if (my $msgids = delete($opt->{dedupe})) {
- local $sync->{checkpoint_unlocks} = 1;
+ local $self->{checkpoint_unlocks} = 1;
eidx_dedupe($self, $sync, $msgids);
}
if (delete($opt->{reindex})) {
- local $sync->{checkpoint_unlocks} = 1;
+ local $self->{checkpoint_unlocks} = 1;
eidx_reindex($self, $sync);
}
my $mm_tmp = $sync->{mm_tmp};
$mm_tmp->atfork_prepare if $mm_tmp;
die 'BUG: {im} during reindex' if $self->{im};
- if ($self->{ibx_map} && !$sync->{checkpoint_unlocks}) {
+ if ($self->{ibx_map} && !$self->{checkpoint_unlocks}) {
checkpoint($self, 1); # no need to release lock on pure index
} else {
$self->done; # release lock