From 3eec2f7792040f75f3988c520f308e2445baf645 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Mon, 7 Mar 2022 10:57:37 +0000 Subject: index|extindex: support --dangerous flag 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. --- t/extsearch.t | 5 +++-- t/indexlevels-mirror.t | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) (limited to 't') diff --git a/t/extsearch.t b/t/extsearch.t index dfc190e2..09cbdabe 100644 --- a/t/extsearch.t +++ b/t/extsearch.t @@ -1,5 +1,5 @@ #!perl -w -# Copyright (C) 2020-2021 all contributors +# Copyright (C) all contributors # License: AGPL-3.0+ use strict; use Test::More; @@ -54,7 +54,8 @@ run_script(['-mda', '--no-precheck'], $env, { 0 => $fh }) or BAIL_OUT '-mda'; 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'); diff --git a/t/indexlevels-mirror.t b/t/indexlevels-mirror.t index e606e79b..ac85643d 100644 --- a/t/indexlevels-mirror.t +++ b/t/indexlevels-mirror.t @@ -1,5 +1,5 @@ #!perl -w -# Copyright (C) 2019-2021 all contributors +# Copyright (C) all contributors # License: AGPL-3.0+ use strict; use v5.10.1; @@ -34,7 +34,7 @@ my $import_index_incremental = sub { 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({ -- cgit v1.2.3-24-ge0c7