- is(system(@xcpdb, "-R$R", $ibx->{mainrepo}), 0, "xcpdb -R$R");
- my @new_parts = grep(m!/\d+\z!, glob("$ibx->{mainrepo}/xap*/*"));
- is(scalar(@new_parts), $R, 'repartitioned to two parts');
- my $msgs = $ibx->search->query('s:this');
- is(scalar(@$msgs), $ndoc, 'got expected docs after repartitioning');
+ my $cmd = [@xcpdb, "-R$R", $ibx->{inboxdir}];
+ push @$cmd, '--compact' if $R == 1 && have_xapian_compact;
+ ok(run_script($cmd), "xcpdb -R$R");
+ my @new_shards = grep(m!/\d+\z!, glob("$ibx->{inboxdir}/xap*/*"));
+ is(scalar(@new_shards), $R, 'resharded to two shards');
+ 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');