From ec0c6db858d34a3a63cf86ddd090e28c28cfca3a Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Wed, 3 May 2023 03:11:14 +0000 Subject: compact: support codesearch indices This is much easier to support than xcpdb since it's 1:1 and doesn't follow a different sharding scheme than the inboxes and extindices. --- script/public-inbox-compact | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'script') diff --git a/script/public-inbox-compact b/script/public-inbox-compact index 80d0224b..1062be5a 100755 --- a/script/public-inbox-compact +++ b/script/public-inbox-compact @@ -1,12 +1,12 @@ #!perl -w -# Copyright (C) 2018-2021 all contributors +# Copyright (C) all contributors # License: AGPL-3.0+ -use strict; -use v5.10.1; +use v5.12; use Getopt::Long qw(:config gnu_getopt no_ignore_case auto_abbrev); -my $opt = { compact => 1, -coarse_lock => 1, -eidx_ok => 1 }; +my $opt = { compact => 1, -coarse_lock => 1, + -eidx_ok => 1, -cidx_ok => 1 }; my $help = < +usage: public-inbox-compact Compact Xapian DBs in an inbox @@ -31,12 +31,14 @@ PublicInbox::Admin::progress_prepare($opt); require PublicInbox::InboxWritable; require PublicInbox::Xapcmd; my $cfg = PublicInbox::Config->new; -my ($ibxs, $eidxs) = PublicInbox::Admin::resolve_inboxes(\@ARGV, $opt, $cfg); -unless ($ibxs) { print STDERR $help; exit 1 } +my ($ibxs, $eidxs, $cidxs) = + PublicInbox::Admin::resolve_inboxes(\@ARGV, $opt, $cfg); +unless (@$ibxs || @$eidxs || @$cidxs) { 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); +for my $ibxish (@$eidxs, @$cidxs) { + my $restore = $ibxish->can('prep_umask') ? $ibxish->prep_umask : undef; + PublicInbox::Xapcmd::run($ibxish, 'compact', $opt); } -- cgit v1.2.3-24-ge0c7