my ($self, $eml, $oid, $sync) = @_;
my $mids = mids($eml);
my $mm = $self->{mm};
- if ($sync->{reindex}) {
+ if ($self->{reindex}) {
my $oidx = $self->{oidx};
for my $mid (@$mids) {
my ($num, undef) = $oidx->num_mid0_for_oid($oid, $mid);
if ($stk) { # all done if $stk is passed
# let SearchView know a full --reindex was done so it can
# generate ->has_threadid-dependent links
- if ($xdb && $sync->{reindex} && !ref($sync->{reindex})) {
+ if ($xdb && $self->{reindex} && !ref($self->{reindex})) {
my $n = $xdb->get_metadata('has_threadid');
$xdb->set_metadata('has_threadid', '1') if $n ne '1';
}
$git->qx(qw(rev-parse -q --verify), "$range^0");
return PublicInbox::IdxStack->new->read_prepare if $?;
}
- local $self->{D} = $sync->{reindex} ? {} : undef; # OID_BIN => NR
+ local $self->{D} = $self->{reindex} ? {} : undef; # OID_BIN => NR
log2stack($self, $sync, $git, $range);
}
local $self->{transact_bytes} = 0;
my $pr = $opt->{-progress};
local $self->{-opt} = $opt;
- my $sync = { reindex => $opt->{reindex}, ibx => $ibx };
+ local $self->{reindex} = $opt->{reindex};
+ my $sync = { ibx => $ibx };
my $quit = quit_cb $self;
local $SIG{QUIT} = $quit;
local $SIG{INT} = $quit;
my $xdb = $self->begin_txn_lazy;
$self->{oidx}->rethread_prepare($opt);
my $mm = v1_mm_init $self;
- if ($sync->{reindex}) {
+ if ($self->{reindex}) {
my $last = $mm->last_commit;
if ($last) {
$tip = $last;
} else {
# somebody just blindly added --reindex when indexing
# for the first time, allow it:
- undef $sync->{reindex};
+ delete $self->{reindex};
}
}
my $last_commit = v1_last_x_commit $self, $mm;
- my $lx = v1_reindex_from $sync->{reindex}, $last_commit;
+ my $lx = v1_reindex_from $self->{reindex}, $last_commit;
my $range = $lx eq '' ? $tip : "$lx..$tip";
$pr->("counting changes\n\t$range ... ") if $pr;
my $stk = prepare_stack($self, $sync, $range);
for my $i (0..$sync->{epoch_max}) {
$reindex_heads->[$i] = $mm->last_commit_xap($v, $i);
}
- } elsif ($sync->{reindex}) { # V2 inbox
+ } elsif ($self->{reindex}) { # V2 inbox
# reindex stops at the current heads and we later
# rerun index_sync without {reindex}
$reindex_heads = $self->last_commits($sync);
# We intentionally do NOT use {D} in the non-reindex case
# because we want NNTP article number gaps from unindexed
# messages to show up in mirrors, too.
- $self->{D} //= $sync->{reindex} ? {} : undef; # OID_BIN => NR
+ $self->{D} //= $self->{reindex} ? {} : undef; # OID_BIN => NR
my $stk = log2stack($self, $sync, $git, $range);
return 0 if $self->{quit};
my $nr = $stk ? $stk->num_records : 0;
my $pad = length($regen_max) + 1;
$self->{-regen_fmt} = "% ${pad}u/$regen_max\n";
$self->{nrec} = 0;
- return -1 if $sync->{reindex};
+ return -1 if $self->{reindex};
$regen_max + $self->artnum_max || 0;
}
sub sync_ranges ($$) {
my ($self, $sync) = @_;
- my $reindex = $sync->{reindex};
+ my $reindex = $self->{reindex};
return $self->last_commits($sync) unless $reindex;
return [] if ref($reindex) ne 'HASH';
$self->idx_init($opt); # acquire lock
$self->{mg}->fill_alternates;
$self->{oidx}->rethread_prepare($opt);
+ local $self->{reindex} = $opt->{reindex};
my $sync = {
- reindex => $opt->{reindex},
self => $self,
ibx => $self->{ibx},
epoch_max => $epoch_max,