user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
From: "Eric Wong (Contractor, The Linux Foundation)" <e@80x24.org>
To: meta@public-inbox.org
Subject: [PATCH] v2writable: fix parallel termination
Date: Sun,  1 Apr 2018 23:23:07 +0000	[thread overview]
Message-ID: <20180401232307.5220-1-e@80x24.org> (raw)

I was too aggressively disabling parallelization to speed up
the test suite and broke this :x  Re-enable parallelization
for the v2reindex test so we can catch it later.
---
 lib/PublicInbox/V2Writable.pm | 10 +++++++---
 t/v2reindex.t                 |  3 +--
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/lib/PublicInbox/V2Writable.pm b/lib/PublicInbox/V2Writable.pm
index c8869bd..51723e5 100644
--- a/lib/PublicInbox/V2Writable.pm
+++ b/lib/PublicInbox/V2Writable.pm
@@ -204,9 +204,13 @@ sub idx_init {
 
 		# need to create all parts before initializing msgmap FD
 		my $max = $self->{partitions} - 1;
-		@{$self->{idx_parts}} = map {
-			PublicInbox::SearchIdxPart->new($self, $_, $skel);
-		} (0..$max);
+
+		# idx_parts must be visible to all forked processes
+		my $idx = $self->{idx_parts} = [];
+		for my $i (0..$max) {
+			push @$idx,
+			     PublicInbox::SearchIdxPart->new($self, $i, $skel);
+		}
 
 		# Now that all subprocesses are up, we can open the FD for SQLite:
 		$skel->_msgmap_init->{dbh}->begin_work;
diff --git a/t/v2reindex.t b/t/v2reindex.t
index b9540e4..bf44fa0 100644
--- a/t/v2reindex.t
+++ b/t/v2reindex.t
@@ -30,9 +30,8 @@ my $mime = PublicInbox::MIME->create(
 	],
 	body => "hello world\n",
 );
-
+local $ENV{NPROC} = 2;
 my $im = PublicInbox::V2Writable->new($ibx, 1);
-$im->{parallel} = 0;
 foreach my $i (1..10) {
 	$mime->header_set('Message-Id', "<$i\@example.com>");
 	ok($im->add($mime), "message $i added");
-- 
EW


                 reply	other threads:[~2018-04-01 23:23 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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: http://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=20180401232307.5220-1-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.
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).