Skip to content

Commit 8d60549

Browse files
committed
Disable fsync throughout TAP test suites.
Most suites already did so via start_test_server(), but the pg_rewind, pg_ctl and pg_controldata suites ran a postmaster or initdb with fsync enabled. This halves the pg_rewind suite's runtime on buildfarm member tern. It makes tern and that machine's other buildfarm members less vulnerable to noise failures from postmaster startup overrunning the 60s pg_ctl timeout. Back-patch to 9.5, where pg_rewind was introduced.
1 parent e2e78ac commit 8d60549

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

src/bin/pg_controldata/t/001_pg_controldata.pl

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@
1111
command_fails(['pg_controldata'], 'pg_controldata without arguments fails');
1212
command_fails([ 'pg_controldata', 'nonexistent' ],
1313
'pg_controldata with nonexistent directory fails');
14-
system_or_bail 'initdb', '-D', "$tempdir/data", '-A', 'trust';
14+
standard_initdb "$tempdir/data";
1515
command_like([ 'pg_controldata', "$tempdir/data" ],
1616
qr/checkpoint/, 'pg_controldata produces output');

src/bin/pg_ctl/t/001_start_stop.pl

+3-1
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,16 @@
1313
command_exit_is([ 'pg_ctl', 'start', '-D', "$tempdir/nonexistent" ],
1414
1, 'pg_ctl start with nonexistent directory');
1515

16-
command_ok([ 'pg_ctl', 'initdb', '-D', "$tempdir/data" ], 'pg_ctl initdb');
16+
command_ok([ 'pg_ctl', 'initdb', '-D', "$tempdir/data", '-o', '-N' ],
17+
'pg_ctl initdb');
1718
command_ok(
1819
[ "$ENV{top_builddir}/src/test/regress/pg_regress", '--config-auth',
1920
"$tempdir/data" ],
2021
'configure authentication');
2122
open CONF, ">>$tempdir/data/postgresql.conf";
2223
print CONF "listen_addresses = ''\n";
2324
print CONF "unix_socket_directories = '$tempdir_short'\n";
25+
print CONF "fsync = off\n";
2426
close CONF;
2527
command_ok([ 'pg_ctl', 'start', '-D', "$tempdir/data", '-w' ],
2628
'pg_ctl start -w');

src/test/perl/TestLib.pm

+6-1
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,11 @@ sub standard_initdb
123123
system_or_bail('initdb', '-D', "$pgdata", '-A' , 'trust', '-N');
124124
system_or_bail("$ENV{top_builddir}/src/test/regress/pg_regress",
125125
'--config-auth', $pgdata);
126+
127+
open CONF, ">>$pgdata/postgresql.conf";
128+
print CONF "\n# Added by TestLib.pm)\n";
129+
print CONF "fsync = off\n";
130+
close CONF;
126131
}
127132

128133
my ($test_server_datadir, $test_server_logfile);
@@ -138,7 +143,7 @@ sub start_test_server
138143
standard_initdb "$tempdir/pgdata";
139144
$ret = system_log('pg_ctl', '-D', "$tempdir/pgdata", '-w', '-l',
140145
"$log_path/postmaster.log", '-o',
141-
"--fsync=off -k \"$tempdir_short\" --listen-addresses='' --log-statement=all",
146+
"-k \"$tempdir_short\" --listen-addresses='' --log-statement=all",
142147
'start');
143148
if ($ret != 0)
144149
{

0 commit comments

Comments
 (0)