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. --- script/public-inbox-extindex | 4 ++-- script/public-inbox-index | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) (limited to 'script') diff --git a/script/public-inbox-extindex b/script/public-inbox-extindex index c63f5dc2..bee824b1 100755 --- a/script/public-inbox-extindex +++ b/script/public-inbox-extindex @@ -1,5 +1,5 @@ #!perl -w -# Copyright (C) 2020-2021 all contributors +# Copyright (C) all contributors # License: AGPL-3.0+ use strict; use v5.10.1; @@ -28,7 +28,7 @@ See public-inbox-extindex(1) man page for full documentation. 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 diff --git a/script/public-inbox-index b/script/public-inbox-index index 053d8b94..a04be9fc 100755 --- a/script/public-inbox-index +++ b/script/public-inbox-index @@ -39,7 +39,7 @@ my $opt = { '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 @@ -126,6 +126,7 @@ for my $ibx (@ibxs) { 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; -- cgit v1.2.3-24-ge0c7