* [PATCH 0/9] extindex: --reindex support
@ 2020-12-15 2:02 7% ` Eric Wong
2020-12-15 2:02 6% ` [PATCH 6/9] extsearchidx: checkpoint releases locks Eric Wong
0 siblings, 1 reply; 2+ results
From: Eric Wong @ 2020-12-15 2:02 UTC (permalink / raw)
To: meta
Patches 1 and 2 are resends, the rest have gone through a lot of
changes and I'm probably ready to run this live on the
extindex which holds my lore mirror onion
<http://rskvuqcfnfizkjg6h5jvovwb3wkikzcwskf54lfpymus6mxrzw67b5ad.onion/all/>
Eric Wong (9):
extindex: preliminary --reindex support
extindex: delete stale messages from over.sqlite3
over: sort xref3 by xnum if ibx_id repeats
extindex: support --rethread and content bifurcation
extsearchidx: reindex works on Xapian, too
extsearchidx: checkpoint releases locks
extsearchidx: simplify reindex code paths
extsearchidx: reindex releases over.sqlite3 handles properly
searchidxshard: simplify newline elimination
lib/PublicInbox/ExtSearchIdx.pm | 369 +++++++++++++++++++++++++++++-
lib/PublicInbox/Over.pm | 5 +-
lib/PublicInbox/OverIdx.pm | 23 ++
lib/PublicInbox/SearchIdx.pm | 13 +-
lib/PublicInbox/SearchIdxShard.pm | 20 +-
lib/PublicInbox/V2Writable.pm | 11 +-
t/extsearch.t | 133 ++++++++++-
7 files changed, 542 insertions(+), 32 deletions(-)
^ permalink raw reply [relevance 7%]
* [PATCH 6/9] extsearchidx: checkpoint releases locks
2020-12-15 2:02 7% ` [PATCH 0/9] extindex: " Eric Wong
@ 2020-12-15 2:02 6% ` Eric Wong
0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2020-12-15 2:02 UTC (permalink / raw)
To: meta
--reindex can take many hours or days, ensure we release
locks according to --batch-size so automated fetch+index
jobs can write new data to indices while we update old data.
---
lib/PublicInbox/ExtSearchIdx.pm | 19 ++++++-------------
lib/PublicInbox/V2Writable.pm | 2 +-
2 files changed, 7 insertions(+), 14 deletions(-)
diff --git a/lib/PublicInbox/ExtSearchIdx.pm b/lib/PublicInbox/ExtSearchIdx.pm
index f29a84e3..3b021a1b 100644
--- a/lib/PublicInbox/ExtSearchIdx.pm
+++ b/lib/PublicInbox/ExtSearchIdx.pm
@@ -404,7 +404,7 @@ sub _reindex_finalize ($$$) {
my $orig_smsg = $req->{orig_smsg} // die 'BUG: no {orig_smsg}';
my $docid = $smsg->{num} = $orig_smsg->{num};
$self->{oidx}->add_overview($eml, $smsg); # may rethread
- $self->{transact_bytes} += $smsg->{bytes};
+ check_batch_limit({ %$sync, new_smsg => $smsg });
if ($nr == 1) { # likely, all good
$self->idx_shard($docid)->shard_reindex_docid($docid);
return;
@@ -537,18 +537,8 @@ sub eidxq_process ($$) { # for reindexing
warn "E: #$docid does not exist in over\n";
}
$del->execute($docid);
+ ++${$sync->{nr}};
- my $cur = ++${$sync->{nr}};
-
- # shards flush on their own, just don't queue up too many
- # deletes
- if ($self->{transact_bytes} >= $self->{batch_bytes}) {
- $self->git->async_wait_all;
- $self->{oidx}->commit_lazy;
- $self->{oidx}->begin_lazy;
- $pr->("reindexed $cur/$tot\n") if $pr;
- $self->{transact_bytes} = 0;
- }
# this is only for SIGUSR1, shards do their own accounting:
reindex_checkpoint($self, $sync) if ${$sync->{need_checkpoint}};
}
@@ -709,7 +699,10 @@ sub eidx_sync { # main entry point
for my $ibx (@{$self->{ibx_list}}) {
$ibx->{-ibx_id} //= $self->{oidx}->ibx_id($ibx->eidx_key);
}
- eidx_reindex($self, $sync) if delete($opt->{reindex});
+ if (delete($opt->{reindex})) {
+ $sync->{checkpoint_unlocks} = 1;
+ eidx_reindex($self, $sync);
+ }
# don't use $_ here, it'll get clobbered by reindex_checkpoint
for my $ibx (@{$self->{ibx_list}}) {
diff --git a/lib/PublicInbox/V2Writable.pm b/lib/PublicInbox/V2Writable.pm
index 572eb418..97dbf328 100644
--- a/lib/PublicInbox/V2Writable.pm
+++ b/lib/PublicInbox/V2Writable.pm
@@ -884,7 +884,7 @@ sub reindex_checkpoint ($$) {
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}) {
+ if ($self->{ibx_map} && !$sync->{checkpoint_unlocks}) {
checkpoint($self, 1); # no need to release lock on pure index
} else {
$self->done; # release lock
^ permalink raw reply related [relevance 6%]
Results 1-2 of 2 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2020-12-11 3:37 [PATCH] extindex: preliminary --reindex support Eric Wong
2020-12-15 2:02 7% ` [PATCH 0/9] extindex: " Eric Wong
2020-12-15 2:02 6% ` [PATCH 6/9] extsearchidx: checkpoint releases locks Eric Wong
Code repositories for project(s) associated with this public inbox
https://80x24.org/public-inbox.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).