my $lc = $src->get_metadata('last_commit');
$dst->set_metadata('last_commit', $lc) if $lc;
- # only the first xapian shard (0) gets 'indexlevel'
+ # only the first xapian shard (0) gets metadata
if ($new =~ m!/(?:xapian[0-9]+|(?:ei|xap)[0-9]+/0)\b!) {
my $l = $src->get_metadata('indexlevel');
$l eq 'medium' and
$dst->set_metadata('indexlevel', $l);
+ for my $k (qw(has_threadid skip_docdata)) {
+ my $v = $src->get_metadata($k);
+ $dst->set_metadata($k, $v) if $v;
+ }
}
if ($pr_data) {
my $tot = $src->get_doccount;
#!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;
ok(run_script($cmd, $env), "xcpdb -R$R");
my @new_shards = grep(m!/\d+\z!, glob("$ibx->{inboxdir}/xap*/*"));
is(scalar(@new_shards), $R, 'resharded to two shards');
+ is $ibx->search->xdb->get_metadata('has_threadid'),
+ '1', 'has_threadid set';
+ is $ibx->search->xdb->get_metadata('indexlevel'),
+ 'medium', 'indexlevel preserved';
my $mset = $ibx->search->mset('s:this');
my $msgs = $ibx->search->mset_to_smsg($ibx, $mset);
is(scalar(@$msgs), $ndoc, 'got expected docs after resharding');