From: Eric Wong <e@80x24.org>
Date: Fri, 25 Dec 2020 10:21:13 +0000 (+0000)
Subject: index: fix --no-fsync flag propagation to extindex
X-Git-Tag: v1.7.0~1495
X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=66518051763825d491d0c1df6837d4266edc180a;p=public-inbox.git

index: fix --no-fsync flag propagation to extindex

Negation in flag names are confusing, but trying to deviate from
the DB_NO_SYNC name used by Xapian is also confusing.
---

diff --git a/lib/PublicInbox/ExtSearchIdx.pm b/lib/PublicInbox/ExtSearchIdx.pm
index 3f197973..e7fdae48 100644
--- a/lib/PublicInbox/ExtSearchIdx.pm
+++ b/lib/PublicInbox/ExtSearchIdx.pm
@@ -54,7 +54,7 @@ sub new {
 	}, __PACKAGE__;
 	$self->{shards} = $self->count_shards || nproc_shards($opt->{creat});
 	my $oidx = PublicInbox::OverIdx->new("$self->{xpfx}/over.sqlite3");
-	$oidx->{-no_fsync} = 1 if $opt->{-no_fsync};
+	$self->{-no_fsync} = $oidx->{-no_fsync} = 1 if !$opt->{fsync};
 	$self->{oidx} = $oidx;
 	$self
 }
diff --git a/script/public-inbox-index b/script/public-inbox-index
index a17bf615..c68f9224 100755
--- a/script/public-inbox-index
+++ b/script/public-inbox-index
@@ -85,7 +85,7 @@ for my $ei_name (@$update_extindex) {
 		die "extindex `$ei_name' not configured or found\n";
 	}
 	$eidx_seen{$topdir} //=
-		push(@eidx, PublicInbox::ExtSearchIdx->new($topdir));
+		push(@eidx, PublicInbox::ExtSearchIdx->new($topdir, $opt));
 }
 my $mods = {};
 my @eidx_unconfigured;
@@ -141,7 +141,6 @@ EOL
 		$eidx->attach_inbox($ibx);
 	}
 }
-$opt->{-no_fsync} = 1 if !$opt->{fsync};
 my $pr = $opt->{-progress};
 for my $eidx (@eidx) {
 	$pr->("indexing $eidx->{topdir} ...\n") if $pr;