diff options
author | Eric Wong <e@80x24.org> | 2021-07-30 12:18:55 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2021-07-31 00:14:20 +0000 |
commit | dd80dcaa1e46543893de533938a1651639f91f10 (patch) | |
tree | 5adc2105b766957782d9d876f4c7914e9bf89c38 /script | |
parent | b38ffe92ee5ccb5eb4e5892e8cafba85303cadfc (diff) | |
download | public-inbox-dd80dcaa1e46543893de533938a1651639f91f10.tar.gz |
Since extindex uses Xapian shards in a similar way to v2 inboxes, we'll support -xcpdb (reshard+upgrade) and -compact all the same to give admins tuning+upgrade options.
Diffstat (limited to 'script')
-rwxr-xr-x | script/public-inbox-compact | 16 | ||||
-rwxr-xr-x | script/public-inbox-xcpdb | 18 |
2 files changed, 21 insertions, 13 deletions
diff --git a/script/public-inbox-compact b/script/public-inbox-compact index ab1d1e5e..6e34aaeb 100755 --- a/script/public-inbox-compact +++ b/script/public-inbox-compact @@ -4,9 +4,9 @@ use strict; use v5.10.1; use Getopt::Long qw(:config gnu_getopt no_ignore_case auto_abbrev); -my $opt = { compact => 1, -coarse_lock => 1 }; +my $opt = { compact => 1, -coarse_lock => 1, -eidx_ok => 1 }; my $help = <<EOF; # the following should fit w/o scrolling in 80x24 term: -usage: public-inbox-compact INBOX_DIR +usage: public-inbox-compact <INBOX_DIR|EXTINDEX_DIR> Compact Xapian DBs in an inbox @@ -29,9 +29,13 @@ PublicInbox::Admin::progress_prepare($opt); require PublicInbox::InboxWritable; require PublicInbox::Xapcmd; -my @ibxs = PublicInbox::Admin::resolve_inboxes(\@ARGV, $opt); -unless (@ibxs) { print STDERR $help; exit 1 } -foreach (@ibxs) { - my $ibx = PublicInbox::InboxWritable->new($_); +my $cfg = PublicInbox::Config->new; +my ($ibxs, $eidxs) = PublicInbox::Admin::resolve_inboxes(\@ARGV, $opt, $cfg); +unless ($ibxs) { print STDERR $help; exit 1 } +for my $ibx (@$ibxs) { + $ibx = PublicInbox::InboxWritable->new($ibx); PublicInbox::Xapcmd::run($ibx, 'compact', $opt); } +for my $eidx (@$eidxs) { + PublicInbox::Xapcmd::run($eidx, 'compact', $opt); +} diff --git a/script/public-inbox-xcpdb b/script/public-inbox-xcpdb index 768dc2ba..81d1a85b 100755 --- a/script/public-inbox-xcpdb +++ b/script/public-inbox-xcpdb @@ -5,7 +5,7 @@ use strict; use v5.10.1; use Getopt::Long qw(:config gnu_getopt no_ignore_case auto_abbrev); my $help = <<EOF; # the following should fit w/o scrolling in 80x24 term: -usage: public-inbox-xcpdb [options] INBOX_DIR +usage: public-inbox-xcpdb [options] <INBOX_DIR|EXTINDEX_DIR> upgrade or reshard Xapian DB(s) used by public-inbox @@ -26,7 +26,7 @@ index options (see public-inbox-index(1) man page for full description): See public-inbox-xcpdb(1) man page for full documentation. EOF -my $opt = { quiet => -1, compact => 0, fsync => 1 }; +my $opt = { quiet => -1, compact => 0, fsync => 1, -eidx_ok => 1 }; GetOptions($opt, qw( fsync|sync! compact|c reshard|R=i max_size|max-size=s batch_size|batch-size=s @@ -41,8 +41,8 @@ PublicInbox::Admin::require_or_die('-search'); require PublicInbox::Config; my $cfg = PublicInbox::Config->new; -my @ibxs = PublicInbox::Admin::resolve_inboxes(\@ARGV, $opt, $cfg) or - die $help; +my ($ibxs, $eidxs) = PublicInbox::Admin::resolve_inboxes(\@ARGV, $opt, $cfg); +unless ($ibxs) { print STDERR $help; exit 1 } my $idx_env = PublicInbox::Admin::index_prepare($opt, $cfg); # we only set XAPIAN_FLUSH_THRESHOLD for index, since cpdb doesn't @@ -56,8 +56,12 @@ if ($opt->{'sequential-shard'} && ($opt->{jobs} // 1) > 1) { require PublicInbox::InboxWritable; require PublicInbox::Xapcmd; -foreach (@ibxs) { - my $ibx = PublicInbox::InboxWritable->new($_); - # we rely on --no-renumber to keep docids synched for NNTP +# we rely on --no-renumber to keep docids synched for NNTP(artnum) + IMAP(UID) +for my $ibx (@$ibxs) { + $ibx = PublicInbox::InboxWritable->new($ibx); PublicInbox::Xapcmd::run($ibx, 'cpdb', $opt); } + +for my $eidx (@$eidxs) { + PublicInbox::Xapcmd::run($eidx, 'cpdb', $opt); +} |