my $dbh = $self->{oidx}->dbh;
my $tot = $dbh->selectrow_array('SELECT COUNT(*) FROM eidxq') or return;
$self->{nrec} = 0;
- local $sync->{-regen_fmt} = "%u/$tot\n";
+ local $self->{-regen_fmt} = "%u/$tot\n";
my $pr = $self->{-opt}->{-progress};
if ($pr) {
my $min = $dbh->selectrow_array('SELECT MIN(docid) FROM eidxq');
# first, check if we missed any messages in target $ibx
my $msgs;
my $pr = $self->{-opt}->{-progress};
- local $sync->{-regen_fmt} = "$ekey checking %u/$max\n";
+ local $self->{-regen_fmt} = "$ekey checking %u/$max\n";
$self->{nrec} = 0;
my $fast = $self->{-opt}->{fast};
my $usr; # _unref_stale_range (< $lo) called
my ($max_id) = $self->{oidx}->dbh->selectrow_array(<<EOS);
SELECT MAX(id) FROM msgid
EOS
- local $sync->{-regen_fmt} = "dedupe %u/$max_id\n";
+ local $self->{-regen_fmt} = "dedupe %u/$max_id\n";
# note: we could write this query more intelligently,
# but that causes lock contention with read-only processes
local $self->{need_checkpoint} = 0;
local $self->{nrec} = 0;
local $self->{-opt} = $opt;
+ local $self->{-regen_fmt} = "%u/?\n";
my $sync = {
# DO NOT SET {reindex} here, it's incompatible with reused
# V2Writable code, reindex is totally different here
# compared to v1/v2 inboxes because we have multiple histories
self => $self,
- -regen_fmt => "%u/?\n",
};
local $SIG{USR1} = sub { $self->{need_checkpoint} = 1 };
my $quit = PublicInbox::SearchIdx::quit_cb($sync);
delete $self->{-commit_timer};
eidxq_process($self, $self->{-watch_sync});
eidxq_release($self);
- my $fmt = delete $self->{-watch_sync}->{-regen_fmt};
+ my $fmt = delete $self->{-regen_fmt};
reindex_checkpoint($self, $self->{-watch_sync});
- $self->{-watch_sync}->{-regen_fmt} = $fmt;
+ $self->{-regen_fmt} = $fmt;
# call event_step => done unless commit_timer is armed
PublicInbox::DS::requeue($self);
$self->done; # release lock
}
- if (my $pr = $sync->{-regen_fmt} ? $self->{-opt}->{-progress} : undef) {
- $pr->(sprintf $sync->{-regen_fmt}, $self->{nrec});
+ if (my $pr = $self->{-regen_fmt} ? $self->{-opt}->{-progress} : undef) {
+ $pr->(sprintf $self->{-regen_fmt}, $self->{nrec});
}
# allow -watch or -mda to write...
}
return 0 if $sync->{quit};
if (!$regen_max) {
- $sync->{-regen_fmt} = "%u/?\n";
+ $self->{-regen_fmt} = "%u/?\n";
return 0;
}
# reindex should NOT see new commits anymore, if we do,
# it's a problem and we need to notice it via die()
my $pad = length($regen_max) + 1;
- $sync->{-regen_fmt} = "% ${pad}u/$regen_max\n";
+ $self->{-regen_fmt} = "% ${pad}u/$regen_max\n";
$self->{nrec} = 0;
return -1 if $sync->{reindex};
$regen_max + $self->artnum_max || 0;
local $self->{parallel} = 0 if $seq;
$self->idx_init($self->{-opt}); # acquire lock
if (my $art_end = $self->{ibx}->mm->max) {
- $sync //= {
- self => $self,
- -regen_fmt => "%u/?\n",
- };
+ $self->{-regen_fmt} //= "%u/?\n";
+ $sync //= { self => $self };
$sync->{art_end} = $art_end;
if ($seq || !$self->{parallel}) {
my $shard_end = $self->{shards} - 1;
local $self->{need_checkpoint} = 0;
local $self->{nrec} = 0;
local $self->{-opt} = $opt;
+ local $self->{-regen_fmt};
return xapian_only($self) if $opt->{xapian_only};
my $epoch_max = $self->{ibx}->max_git_epoch // return;
if (my $nrec = $self->{nrec}) {
my $pr = $self->{-opt}->{-progress};
- $pr->('all.git '.sprintf($sync->{-regen_fmt}, $nrec)) if $pr;
+ $pr->('all.git '.sprintf($self->{-regen_fmt}, $nrec)) if $pr;
}
my $quit_warn;