unofficial mirror of meta@public-inbox.org
 help / color / mirror / Atom feed
From: Eric Wong <e@80x24.org>
To: meta@public-inbox.org
Subject: [PATCH 05/10] v2writable: less expensive checkpoint for extindex
Date: Sat,  7 Nov 2020 10:56:55 +0000	[thread overview]
Message-ID: <20201107105700.12586-6-e@80x24.org> (raw)
In-Reply-To: <20201107105700.12586-1-e@80x24.org>

Since extindex holds no locks on parallel inbox writers,
we can simply use "barrier" IPC shard commands to checkpoint
and avoid respawning shard or git processes.
---
 lib/PublicInbox/V2Writable.pm | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/lib/PublicInbox/V2Writable.pm b/lib/PublicInbox/V2Writable.pm
index 0364857f..224675ab 100644
--- a/lib/PublicInbox/V2Writable.pm
+++ b/lib/PublicInbox/V2Writable.pm
@@ -620,13 +620,13 @@ sub checkpoint ($;$) {
 
 		# Now deal with Xapian
 		if ($wait) {
-			my $barrier = $self->barrier_init(scalar @$shards);
+			my $barrier = barrier_init($self, scalar @$shards);
 
 			# each shard needs to issue a barrier command
 			$_->shard_barrier for @$shards;
 
 			# wait for each Xapian shard
-			$self->barrier_wait($barrier);
+			barrier_wait($self, $barrier);
 		} else {
 			$_->shard_commit for @$shards;
 		}
@@ -860,11 +860,16 @@ sub atfork_child {
 sub reindex_checkpoint ($$) {
 	my ($self, $sync) = @_;
 
-	$self->git->cleanup; # *async_wait
+	$self->git->async_wait_all;
 	${$sync->{need_checkpoint}} = 0;
 	my $mm_tmp = $sync->{mm_tmp};
 	$mm_tmp->atfork_prepare if $mm_tmp;
-	$self->done; # release lock
+	die 'BUG: {im} during reindex' if $self->{im};
+	if ($self->{ibx_map}) {
+		checkpoint($self, 1); # no need to release lock on pure index
+	} else {
+		$self->done; # release lock
+	}
 
 	if (my $pr = $sync->{-opt}->{-progress}) {
 		$pr->(sprintf($sync->{-regen_fmt}, ${$sync->{nr}}));

  parent reply	other threads:[~2020-11-07 10:57 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-07 10:56 [PATCH 00/10] extindex: another round of updates Eric Wong
2020-11-07 10:56 ` [PATCH 01/10] extsearch: rename -eindex to -extindex Eric Wong
2020-11-07 10:56 ` [PATCH 02/10] extsearchidx: avoid needless alternates rewrite in ALL.git Eric Wong
2020-11-07 10:56 ` [PATCH 03/10] searchidxshard: reduce syscalls when writing ->eidx_key Eric Wong
2020-11-07 10:56 ` [PATCH 04/10] searchidxshard: further improve {current_info} readability Eric Wong
2020-11-07 10:56 ` Eric Wong [this message]
2020-11-07 10:56 ` [PATCH 06/10] extsearchidx: quiet warning for unindexed `d' messages Eric Wong
2020-11-07 10:56 ` [PATCH 07/10] extsearch: canonicalize topdir Eric Wong
2020-11-07 10:56 ` [PATCH 08/10] v2writable: more accurate {current_info} warnings/progress Eric Wong
2020-11-07 10:56 ` [PATCH 09/10] extindex: SIGUSR1 supports checkpoint Eric Wong
2020-11-07 10:57 ` [PATCH 10/10] extindex: fix --batch-size support Eric Wong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://public-inbox.org/README

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201107105700.12586-6-e@80x24.org \
    --to=e@80x24.org \
    --cc=meta@public-inbox.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).