Skip to content

Commit 58af7a3

Browse files
committed
000_vacuum_full.pl
1 parent 56886b2 commit 58af7a3

File tree

1 file changed

+59
-0
lines changed

1 file changed

+59
-0
lines changed

t/000_vacuum_full.pl

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
use strict;
2+
use warnings;
3+
4+
use Cluster;
5+
use TestLib;
6+
use Test::More tests => 1;
7+
use IPC::Run qw(start finish);
8+
use Cwd;
9+
10+
my $nnodes = 2;
11+
my $cluster = new Cluster($nnodes);
12+
13+
$cluster->init();
14+
$cluster->configure();
15+
$cluster->start();
16+
diag("sleeping 10");
17+
sleep(10);
18+
19+
my ($in, $out, $err, $rc);
20+
my $seconds = 30;
21+
$in = '';
22+
$out = '';
23+
24+
my @init_argv = (
25+
'pgbench',
26+
'-i',
27+
-h => $cluster->{nodes}->[0]->host(),
28+
-p => $cluster->{nodes}->[0]->port(),
29+
'postgres',
30+
);
31+
diag("running pgbench init");
32+
my $init_run = start(\@init_argv, $in, $out);
33+
finish($init_run) || BAIL_OUT("pgbench exited with $?");
34+
35+
my @bench_argv = (
36+
'pgbench',
37+
'-T 30',
38+
'-N',
39+
'-c 8',
40+
-h => $cluster->{nodes}->[0]->host(),
41+
-p => $cluster->{nodes}->[0]->port(),
42+
'postgres',
43+
);
44+
diag("running pgbench: " . join(' ', @bench_argv));
45+
my $bench_run = start(\@bench_argv, $in, $out);
46+
47+
my $started = time();
48+
while (time() - $started < $seconds)
49+
{
50+
($rc, $out, $err) = $cluster->psql(2, 'postgres', "vacuum full;");
51+
if ($rc != 0)
52+
{
53+
BAIL_OUT("vacuum full failed");
54+
}
55+
}
56+
57+
finish($bench_run) || BAIL_OUT("pgbench exited with $?");
58+
ok($cluster->stop('fast'), "cluster stops");
59+
1;

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy