1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-28 23:42:10 +03:00

Move some code from RewindTest into PostgresNode

Some code in the RewindTest test suite is more generally useful than
just for that suite, so put it where other test suites can reach it.

Some postgresql.conf parameters change their default values when a
cluster is initialized with 'allows_streaming' than the previous
behavior; most notably, autovacuum is no longer turned off.

(Also, we no longer call pg_ctl promote with -w, but that flag doesn't
actually do anything in promote so there's no behavior change.)

Author: Michael Paquier
This commit is contained in:
Alvaro Herrera
2016-02-26 13:24:22 -03:00
parent 7bea19d0a9
commit 89ac7004da
2 changed files with 65 additions and 25 deletions

View File

@ -114,24 +114,9 @@ sub check_query
sub setup_cluster
{
# Initialize master, data checksums are mandatory
$node_master = get_new_node('master');
$node_master->init;
# Custom parameters for master's postgresql.conf
$node_master->append_conf(
"postgresql.conf", qq(
wal_level = hot_standby
max_wal_senders = 2
wal_keep_segments = 20
max_wal_size = 200MB
shared_buffers = 1MB
wal_log_hints = on
hot_standby = on
autovacuum = off
max_connections = 10
));
$node_master->init(allows_streaming => 1);
}
sub start_master
@ -177,7 +162,7 @@ sub promote_standby
# Now promote slave and insert some new data on master, this will put
# the master out-of-sync with the standby. Wait until the standby is
# out of recovery mode, and is ready to accept read-write connections.
system_or_bail('pg_ctl', '-w', '-D', $node_standby->data_dir, 'promote');
$node_standby->promote;
$node_standby->poll_query_until('postgres',
"SELECT NOT pg_is_in_recovery()")
or die "Timed out while waiting for promotion of standby";