use PublicInbox::Xapcmd;
my $compact_opt;
-my $opt = { quiet => -1, compact => 0, maxsize => undef, sync => 1 };
-GetOptions($opt, qw(verbose|v+ reindex rethread compact|c+ jobs|j=i prune sync!
- xapianonly|xapian-only
+my $opt = { quiet => -1, compact => 0, maxsize => undef, fsync => 1 };
+GetOptions($opt, qw(verbose|v+ reindex rethread compact|c+ jobs|j=i prune
+ fsync|sync! xapianonly|xapian-only
indexlevel|L=s maxsize|max-size=s batchsize|batch-size=s
sequentialshard|seq-shard|sequential-shard))
or die "bad command-line args\n$usage";
die "`publicInbox.indexMaxSize=$max_size' not parsed\n";
}
-if (my $bs = $opt->{batchsize} // $cfg->{lc('publicInbox.indexBatchSize')}) {
+my $bs = $opt->{batchsize} // $cfg->{lc('publicInbox.indexBatchSize')};
+if (defined $bs) {
PublicInbox::Admin::parse_unsigned(\$bs) or
die "`publicInbox.indexBatchSize=$bs' not parsed\n";
- $PublicInbox::SearchIdx::BATCH_BYTES = $bs;
}
+local $PublicInbox::SearchIdx::BATCH_BYTES = $bs if defined($bs);
+
+# out-of-the-box builds of Xapian 1.4.x are still limited to 32-bit
+# https://getting-started-with-xapian.readthedocs.io/en/latest/concepts/indexing/limitations.html
+local $ENV{XAPIAN_FLUSH_THRESHOLD} ||= '4294967295' if defined($bs);
my $s = $opt->{sequentialshard} //
$cfg->{lc('publicInbox.indexSequentialShard')};
if ($opt->{compact} >= 2) {
PublicInbox::Xapcmd::run($ibx, 'compact', $compact_opt);
}
- $ibx->{-no_sync} = 1 if !$opt->{sync};
+ $ibx->{-no_fsync} = 1 if !$opt->{fsync};
my $ibx_opt = $opt;
if (defined(my $s = $ibx->{indexsequentialshard})) {
$ibx_opt = { %$opt, sequentialshard => $v };
}
PublicInbox::Admin::index_inbox($ibx, undef, $ibx_opt);
- PublicInbox::Xapcmd::run($ibx, 'compact', $compact_opt) if $compact_opt;
+ if ($compact_opt) {
+ local $compact_opt->{jobs} = 0 if $ibx_opt->{sequentialshard};
+ PublicInbox::Xapcmd::run($ibx, 'compact', $compact_opt);
+ }
}