This enables Xapian::DB_DANGEROUS to support in-place updates.
This can speed up the initial index and reduce I/O at the cost
of preventing concurrent readers and being unsafe in the face of
any abnormal terminations. This is more dangerous than
--no-fsync. --no-fsync is only unsafe in the event of a power
loss or kernel crash; --dangerous is unsafe even on SIGKILL.
=item --jobs=JOBS
-... TODO, see L<public-inbox-index(5)>
+=item --no-fsync
+
+=item --dangerous
+
+=item --rethread
+
+=item --max-size SIZE
+
+=item --batch-size SIZE
+
+These switches behave as they do for L<public-inbox-index(1)>
=item --all
=head1 COPYRIGHT
-Copyright 2021 all contributors L<mailto:meta@public-inbox.org>
+Copyright all contributors L<mailto:meta@public-inbox.org>
License: AGPL-3.0+ L<https://www.gnu.org/licenses/agpl-3.0.txt>
Available in public-inbox 1.6.0+.
+=item --dangerous
+
+Speed up initial index by using in-place updates and denying support for
+concurrent readers. This is only effective with Xapian 1.4+.
+
+Available in public-inbox 1.8.0+
+
=item --sequential-shard
Sets or overrides L</publicinbox.indexSequentialShard> on a
=head1 COPYRIGHT
-Copyright 2016-2021 all contributors L<mailto:meta@public-inbox.org>
+Copyright all contributors L<mailto:meta@public-inbox.org>
License: AGPL-3.0+ L<https://www.gnu.org/licenses/agpl-3.0.txt>
-# Copyright (C) 2020-2021 all contributors <meta@public-inbox.org>
+# Copyright (C) all contributors <meta@public-inbox.org>
# License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
# Detached/external index cross inbox search indexing support
nproc_shards({ nproc => $opt->{jobs} });
my $oidx = PublicInbox::OverIdx->new("$self->{xpfx}/over.sqlite3");
$self->{-no_fsync} = $oidx->{-no_fsync} = 1 if !$opt->{fsync};
+ $self->{-dangerous} = 1 if $opt->{dangerous};
$self->{oidx} = $oidx;
$self
}
PublicInbox::Syscall::nodatacow_dir($mi_dir);
my $flags = $PublicInbox::SearchIdx::DB_CREATE_OR_OPEN;
$flags |= $PublicInbox::SearchIdx::DB_NO_SYNC if $eidx->{-no_fsync};
+ $flags |= $PublicInbox::SearchIdx::DB_DANGEROUS if $eidx->{-dangerous};
$json //= PublicInbox::Config::json();
bless {
mi_dir => $mi_dir,
my $X = \%PublicInbox::Search::X;
our ($DB_CREATE_OR_OPEN, $DB_OPEN);
our $DB_NO_SYNC = 0;
+our $DB_DANGEROUS = 0;
our $BATCH_BYTES = $ENV{XAPIAN_FLUSH_THRESHOLD} ? 0x7fffffff :
# assume a typical 64-bit system has 8x more RAM than a
# typical 32-bit system:
my $ver = (eval($xap.'::major_version()') << 16) |
(eval($xap.'::minor_version()') << 8) |
eval($xap.'::revision()');
- $DB_NO_SYNC = 0x4 if $ver >= 0x10400;
+ if ($ver >= 0x10400) {
+ $DB_NO_SYNC = 0x4;
+ $DB_DANGEROUS = 0x10;
+ }
# Xapian v1.2.21..v1.2.24 were missing close-on-exec on OFD locks
$X->{CLOEXEC_UNSET} = 1 if $ver >= 0x010215 && $ver <= 0x010218;
1;
require PublicInbox::Syscall;
PublicInbox::Syscall::nodatacow_dir($dir);
$self->{-set_has_threadid_once} = 1;
+ if (($self->{ibx} // $self->{eidx})->{-dangerous}) {
+ $flag |= $DB_DANGEROUS;
+ }
}
}
return unless defined $flag;
#!perl -w
-# Copyright (C) 2020-2021 all contributors <meta@public-inbox.org>
+# Copyright (C) all contributors <meta@public-inbox.org>
# License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
use strict;
use v5.10.1;
EOF
my $opt = { quiet => -1, compact => 0, fsync => 1, scan => 1 };
GetOptions($opt, qw(verbose|v+ reindex rethread compact|c+ jobs|j=i
- fsync|sync! fast
+ fsync|sync! fast dangerous
indexlevel|index-level|L=s max_size|max-size=s
batch_size|batch-size=s
dedupe:s@ gc commit-interval=i watch scan! dry-run|n
'update-extindex' => [], # ":s@" optional arg sets '' if no arg given
};
GetOptions($opt, qw(verbose|v+ reindex rethread compact|c+ jobs|j=i prune
- fsync|sync! xapian_only|xapian-only
+ fsync|sync! xapian_only|xapian-only dangerous
indexlevel|index-level|L=s max_size|max-size=s
batch_size|batch-size=s
since|after=s until|before=s
PublicInbox::Xapcmd::run($ibx, 'compact', $opt->{compact_opt});
}
$ibx->{-no_fsync} = 1 if !$opt->{fsync};
+ $ibx->{-dangerous} = 1 if $opt->{dangerous};
$ibx->{-skip_docdata} //= $opt->{'skip-docdata'};
my $ibx_opt = $opt;
#!perl -w
-# Copyright (C) 2020-2021 all contributors <meta@public-inbox.org>
+# Copyright (C) all contributors <meta@public-inbox.org>
# License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
use strict;
use Test::More;
run_script([qw(-index -Lbasic), "$home/v1test"]) or BAIL_OUT "index $?";
-ok(run_script([qw(-extindex --all), "$home/extindex"]), 'extindex init');
+ok(run_script([qw(-extindex --dangerous --all), "$home/extindex"]),
+ 'extindex init');
{
my $es = PublicInbox::ExtSearch->new("$home/extindex");
ok($es->has_threadid, '->has_threadid');
#!perl -w
-# Copyright (C) 2019-2021 all contributors <meta@public-inbox.org>
+# Copyright (C) all contributors <meta@public-inbox.org>
# License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
use strict;
use v5.10.1;
local $ENV{PI_CONFIG} = "$tmpdir/config";
# index master (required for v1)
- my @cmd = (qw(-index -j0), $ibx->{inboxdir}, "-L$level");
+ my @cmd = (qw(-index -j0 --dangerous), $ibx->{inboxdir}, "-L$level");
push @cmd, '-c' if have_xapian_compact;
ok(run_script(\@cmd, undef, { 2 => \$err }), 'index master');
my $ro_master = PublicInbox::Inbox->new({