From cab22861f2a22482b74d20c05afbd6108a4590cb Mon Sep 17 00:00:00 2001 From: "Eric Wong (Contractor, The Linux Foundation)" Date: Tue, 6 Mar 2018 07:28:56 +0000 Subject: v2writable: detect and use previous partition count We need to detect the number of partitions the repository was created with to ensure Xapian DBs can work across different machines (or even CPU affinity changes) without leaving messages unaffected by search. --- t/v2writable.t | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 't') diff --git a/t/v2writable.t b/t/v2writable.t index 2d35aca3..404c8651 100644 --- a/t/v2writable.t +++ b/t/v2writable.t @@ -30,7 +30,11 @@ my $mime = PublicInbox::MIME->create( body => "hello world\n", ); -my $im = PublicInbox::V2Writable->new($ibx, 1); +my $im = eval { + local $ENV{NPROC} = '1'; + PublicInbox::V2Writable->new($ibx, 1); +}; +is($im->{partitions}, 1, 'one partition when forced'); ok($im->add($mime), 'ordinary message added'); if ('ensure git configs are correct') { @@ -182,5 +186,10 @@ EOF } is_deeply([sort keys %nn], [sort keys %uniq]); }; +{ + local $ENV{NPROC} = 2; + $im = PublicInbox::V2Writable->new($ibx, 1); + is($im->{partitions}, 1, 'detected single partition from previous'); +} done_testing(); -- cgit v1.2.3-24-ge0c7