Remove uses of "slave" in replication contexts
This affects mostly code comments, some documentation, and tests. Official APIs already used "standby".
This commit is contained in:
parent
d6391b03b3
commit
a1ef920e27
@ -270,7 +270,7 @@ SELECT *
|
||||
FROM dblink('SELECT * FROM foo') AS t(a int, b text, c text[])
|
||||
WHERE t.a > 7;
|
||||
ERROR: connection not available
|
||||
-- put more data into our slave table, first using arbitrary connection syntax
|
||||
-- put more data into our table, first using arbitrary connection syntax
|
||||
-- but truncate the actual return value so we can use diff to check for success
|
||||
SELECT substr(dblink_exec(connection_parameters(),'INSERT INTO foo VALUES(10,''k'',''{"a10","b10","c10"}'')'),1,6);
|
||||
substr
|
||||
@ -285,7 +285,7 @@ SELECT dblink_connect(connection_parameters());
|
||||
OK
|
||||
(1 row)
|
||||
|
||||
-- put more data into our slave table, using persistent connection syntax
|
||||
-- put more data into our table, using persistent connection syntax
|
||||
-- but truncate the actual return value so we can use diff to check for success
|
||||
SELECT substr(dblink_exec('INSERT INTO foo VALUES(11,''l'',''{"a11","b11","c11"}'')'),1,6);
|
||||
substr
|
||||
@ -610,7 +610,7 @@ SELECT dblink_connect('myconn',connection_parameters());
|
||||
OK
|
||||
(1 row)
|
||||
|
||||
-- put more data into our slave table, using named persistent connection syntax
|
||||
-- put more data into our table, using named persistent connection syntax
|
||||
-- but truncate the actual return value so we can use diff to check for success
|
||||
SELECT substr(dblink_exec('myconn','INSERT INTO foo VALUES(11,''l'',''{"a11","b11","c11"}'')'),1,6);
|
||||
substr
|
||||
|
@ -160,14 +160,14 @@ SELECT *
|
||||
FROM dblink('SELECT * FROM foo') AS t(a int, b text, c text[])
|
||||
WHERE t.a > 7;
|
||||
|
||||
-- put more data into our slave table, first using arbitrary connection syntax
|
||||
-- put more data into our table, first using arbitrary connection syntax
|
||||
-- but truncate the actual return value so we can use diff to check for success
|
||||
SELECT substr(dblink_exec(connection_parameters(),'INSERT INTO foo VALUES(10,''k'',''{"a10","b10","c10"}'')'),1,6);
|
||||
|
||||
-- create a persistent connection
|
||||
SELECT dblink_connect(connection_parameters());
|
||||
|
||||
-- put more data into our slave table, using persistent connection syntax
|
||||
-- put more data into our table, using persistent connection syntax
|
||||
-- but truncate the actual return value so we can use diff to check for success
|
||||
SELECT substr(dblink_exec('INSERT INTO foo VALUES(11,''l'',''{"a11","b11","c11"}'')'),1,6);
|
||||
|
||||
@ -316,7 +316,7 @@ WHERE t.a > 7;
|
||||
-- create a named persistent connection
|
||||
SELECT dblink_connect('myconn',connection_parameters());
|
||||
|
||||
-- put more data into our slave table, using named persistent connection syntax
|
||||
-- put more data into our table, using named persistent connection syntax
|
||||
-- but truncate the actual return value so we can use diff to check for success
|
||||
SELECT substr(dblink_exec('myconn','INSERT INTO foo VALUES(11,''l'',''{"a11","b11","c11"}'')'),1,6);
|
||||
|
||||
|
@ -40,7 +40,7 @@
|
||||
server to modify the data. Servers that can modify data are
|
||||
called read/write, <firstterm>master</> or <firstterm>primary</> servers.
|
||||
Servers that track changes in the master are called <firstterm>standby</>
|
||||
or <firstterm>slave</> servers. A standby server that cannot be connected
|
||||
or <firstterm>secondary</> servers. A standby server that cannot be connected
|
||||
to until it is promoted to a master server is called a <firstterm>warm
|
||||
standby</> server, and one that can accept connections and serves read-only
|
||||
queries is called a <firstterm>hot standby</> server.
|
||||
|
@ -483,7 +483,7 @@ pg_upgrade.exe
|
||||
|
||||
<para>
|
||||
From a directory that is above the old and new database cluster
|
||||
directories, run this for each slave:
|
||||
directories, run this for each standby:
|
||||
|
||||
<programlisting>
|
||||
rsync --archive --delete --hard-links --size-only old_pgdata new_pgdata remote_dir
|
||||
@ -517,7 +517,7 @@ rsync --archive --delete --hard-links --size-only old_pgdata new_pgdata remote_d
|
||||
<para>
|
||||
Configure the servers for log shipping. (You do not need to run
|
||||
<function>pg_start_backup()</> and <function>pg_stop_backup()</>
|
||||
or take a file system backup as the slaves are still synchronized
|
||||
or take a file system backup as the standbys are still synchronized
|
||||
with the master.)
|
||||
</para>
|
||||
</step>
|
||||
|
@ -621,7 +621,7 @@ CommitTsParameterChange(bool newvalue, bool oldvalue)
|
||||
*
|
||||
* The reason why this SLRU needs separate activation/deactivation functions is
|
||||
* that it can be enabled/disabled during start and the activation/deactivation
|
||||
* on master is propagated to slave via replay. Other SLRUs don't have this
|
||||
* on master is propagated to standby via replay. Other SLRUs don't have this
|
||||
* property and they can be just initialized during normal startup.
|
||||
*
|
||||
* This is in charge of creating the currently active segment, if it's not
|
||||
|
@ -939,7 +939,7 @@ GetNewMultiXactId(int nmembers, MultiXactOffset *offset)
|
||||
|
||||
debug_elog3(DEBUG2, "GetNew: for %d xids", nmembers);
|
||||
|
||||
/* safety check, we should never get this far in a HS slave */
|
||||
/* safety check, we should never get this far in a HS standby */
|
||||
if (RecoveryInProgress())
|
||||
elog(ERROR, "cannot assign MultiXactIds during recovery");
|
||||
|
||||
|
@ -67,7 +67,7 @@ GetNewTransactionId(bool isSubXact)
|
||||
return BootstrapTransactionId;
|
||||
}
|
||||
|
||||
/* safety check, we should never get this far in a HS slave */
|
||||
/* safety check, we should never get this far in a HS standby */
|
||||
if (RecoveryInProgress())
|
||||
elog(ERROR, "cannot assign TransactionIds during recovery");
|
||||
|
||||
@ -468,7 +468,7 @@ GetNewObjectId(void)
|
||||
{
|
||||
Oid result;
|
||||
|
||||
/* safety check, we should never get this far in a HS slave */
|
||||
/* safety check, we should never get this far in a HS standby */
|
||||
if (RecoveryInProgress())
|
||||
elog(ERROR, "cannot assign OIDs during recovery");
|
||||
|
||||
|
@ -3802,10 +3802,10 @@ InitTempTableNamespace(void)
|
||||
get_database_name(MyDatabaseId))));
|
||||
|
||||
/*
|
||||
* Do not allow a Hot Standby slave session to make temp tables. Aside
|
||||
* Do not allow a Hot Standby session to make temp tables. Aside
|
||||
* from problems with modifying the system catalogs, there is a naming
|
||||
* conflict: pg_temp_N belongs to the session with BackendId N on the
|
||||
* master, not to a slave session with the same BackendId. We should not
|
||||
* master, not to a hot standby session with the same BackendId. We should not
|
||||
* be able to get here anyway due to XactReadOnly checks, but let's just
|
||||
* make real sure. Note that this also backstops various operations that
|
||||
* allow XactReadOnly transactions to modify temp tables; they'd need
|
||||
|
@ -472,8 +472,8 @@ show_log_timezone(void)
|
||||
* We allow idempotent changes (r/w -> r/w and r/o -> r/o) at any time, and
|
||||
* we also always allow changes from read-write to read-only. However,
|
||||
* read-only may be changed to read-write only when in a top-level transaction
|
||||
* that has not yet taken an initial snapshot. Can't do it in a hot standby
|
||||
* slave, either.
|
||||
* that has not yet taken an initial snapshot. Can't do it in a hot standby,
|
||||
* either.
|
||||
*
|
||||
* If we are not in a transaction at all, just allow the change; it means
|
||||
* nothing since XactReadOnly will be reset by the next StartTransaction().
|
||||
|
@ -759,8 +759,8 @@ ExecCheckRTEPermsModified(Oid relOid, Oid userid, Bitmapset *modifiedCols,
|
||||
* unless we're in parallel mode, in which case don't even allow writes
|
||||
* to temp tables.
|
||||
*
|
||||
* Note: in a Hot Standby slave this would need to reject writes to temp
|
||||
* tables just as we do in parallel mode; but an HS slave can't have created
|
||||
* Note: in a Hot Standby this would need to reject writes to temp
|
||||
* tables just as we do in parallel mode; but an HS standby can't have created
|
||||
* any temp tables in the first place, so no need to check that.
|
||||
*/
|
||||
static void
|
||||
|
@ -2572,7 +2572,7 @@ XLogSendPhysical(void)
|
||||
* fsync'd to disk. We cannot go further than what's been written out
|
||||
* given the current implementation of XLogRead(). And in any case
|
||||
* it's unsafe to send WAL that is not securely down to disk on the
|
||||
* master: if the master subsequently crashes and restarts, slaves
|
||||
* master: if the master subsequently crashes and restarts, standbys
|
||||
* must not have applied any WAL that got lost on the master.
|
||||
*/
|
||||
SendRqstPtr = GetFlushRecPtr();
|
||||
|
@ -1408,7 +1408,7 @@ GetOldestXmin(Relation rel, int flags)
|
||||
* being careful not to generate a "permanent" XID.
|
||||
*
|
||||
* vacuum_defer_cleanup_age provides some additional "slop" for the
|
||||
* benefit of hot standby queries on slave servers. This is quick and
|
||||
* benefit of hot standby queries on standby servers. This is quick and
|
||||
* dirty, and perhaps not all that useful unless the master has a
|
||||
* predictable transaction rate, but it offers some protection when
|
||||
* there's no walsender connection. Note that we are assuming
|
||||
|
@ -264,7 +264,7 @@ PreventCommandIfParallelMode(const char *cmdname)
|
||||
/*
|
||||
* PreventCommandDuringRecovery: throw error if RecoveryInProgress
|
||||
*
|
||||
* The majority of operations that are unsafe in a Hot Standby slave
|
||||
* The majority of operations that are unsafe in a Hot Standby
|
||||
* will be rejected by XactReadOnly tests. However there are a few
|
||||
* commands that are allowed in "read-only" xacts but cannot be allowed
|
||||
* in Hot Standby mode. Those commands should call this function.
|
||||
|
@ -676,7 +676,7 @@ main(int argc, char **argv)
|
||||
dopt.no_security_labels = 1;
|
||||
|
||||
/*
|
||||
* On hot standby slaves, never try to dump unlogged table data, since it
|
||||
* On hot standbys, never try to dump unlogged table data, since it
|
||||
* will just throw an error.
|
||||
*/
|
||||
if (fout->isStandby)
|
||||
|
@ -160,7 +160,7 @@ sub promote_standby
|
||||
$node_master->poll_query_until('postgres', $wal_received_query)
|
||||
or die "Timed out while waiting for standby to receive and write WAL";
|
||||
|
||||
# Now promote slave and insert some new data on master, this will put
|
||||
# Now promote standby and insert some new data on master, this will put
|
||||
# the master out-of-sync with the standby.
|
||||
$node_standby->promote;
|
||||
|
||||
|
@ -34,7 +34,7 @@ my $master_lsn =
|
||||
$master->safe_psql('postgres', 'select pg_current_wal_lsn()');
|
||||
$standby->poll_query_until('postgres',
|
||||
qq{SELECT '$master_lsn'::pg_lsn <= pg_last_wal_replay_lsn()})
|
||||
or die "slave never caught up";
|
||||
or die "standby never caught up";
|
||||
|
||||
my $standby_ts = $standby->safe_psql('postgres',
|
||||
qq{select ts.* from pg_class, pg_xact_commit_timestamp(xmin) ts where relname = 't10'}
|
||||
@ -47,7 +47,7 @@ $master->safe_psql('postgres', 'checkpoint');
|
||||
$master_lsn = $master->safe_psql('postgres', 'select pg_current_wal_lsn()');
|
||||
$standby->poll_query_until('postgres',
|
||||
qq{SELECT '$master_lsn'::pg_lsn <= pg_last_wal_replay_lsn()})
|
||||
or die "slave never caught up";
|
||||
or die "standby never caught up";
|
||||
$standby->safe_psql('postgres', 'checkpoint');
|
||||
|
||||
# This one should raise an error now
|
||||
|
@ -33,7 +33,7 @@ my $master_lsn =
|
||||
$master->safe_psql('postgres', 'select pg_current_wal_lsn()');
|
||||
$standby->poll_query_until('postgres',
|
||||
qq{SELECT '$master_lsn'::pg_lsn <= pg_last_wal_replay_lsn()})
|
||||
or die "slave never caught up";
|
||||
or die "standby never caught up";
|
||||
|
||||
$standby->safe_psql('postgres', 'checkpoint');
|
||||
$standby->restart;
|
||||
|
@ -16,7 +16,7 @@ my $backup_name = 'my_backup';
|
||||
# Start it
|
||||
$node_master->start;
|
||||
|
||||
# Take backup for slave
|
||||
# Take backup for standby
|
||||
$node_master->backup($backup_name);
|
||||
|
||||
# Initialize standby node from backup, fetching WAL from archives
|
||||
|
@ -40,7 +40,7 @@ $node_master->safe_psql('postgres',
|
||||
"INSERT INTO tab_int VALUES (generate_series(11, 20))");
|
||||
|
||||
# Now wait for replay to complete on standby. We're done waiting when the
|
||||
# slave has replayed up to the previously saved master LSN.
|
||||
# standby has replayed up to the previously saved master LSN.
|
||||
my $until_lsn =
|
||||
$node_master->safe_psql('postgres', "SELECT pg_current_wal_lsn()");
|
||||
|
||||
|
@ -23,7 +23,7 @@ sub configure_and_reload
|
||||
is($psql_out, 't', "reload node $name with $parameter");
|
||||
}
|
||||
|
||||
# Set up two nodes, which will alternately be master and replication slave.
|
||||
# Set up two nodes, which will alternately be master and replication standby.
|
||||
|
||||
# Setup london node
|
||||
my $node_london = get_new_node("london");
|
||||
@ -46,9 +46,9 @@ $node_paris->start;
|
||||
configure_and_reload($node_london, "synchronous_standby_names = 'paris'");
|
||||
configure_and_reload($node_paris, "synchronous_standby_names = 'london'");
|
||||
|
||||
# Set up nonce names for current master and slave nodes
|
||||
note "Initially, london is master and paris is slave";
|
||||
my ($cur_master, $cur_slave) = ($node_london, $node_paris);
|
||||
# Set up nonce names for current master and standby nodes
|
||||
note "Initially, london is master and paris is standby";
|
||||
my ($cur_master, $cur_standby) = ($node_london, $node_paris);
|
||||
my $cur_master_name = $cur_master->name;
|
||||
|
||||
# Create table we'll use in the test transactions
|
||||
@ -163,7 +163,7 @@ is($psql_rc, '0', "Cleanup of shared memory state for 2PC commit");
|
||||
$cur_master->psql('postgres', "COMMIT PREPARED 'xact_009_7'");
|
||||
|
||||
###############################################################################
|
||||
# Check that WAL replay will cleanup its shared memory state on running slave.
|
||||
# Check that WAL replay will cleanup its shared memory state on running standby.
|
||||
###############################################################################
|
||||
|
||||
$cur_master->psql(
|
||||
@ -174,7 +174,7 @@ $cur_master->psql(
|
||||
INSERT INTO t_009_tbl VALUES (18, 'issued to ${cur_master_name}');
|
||||
PREPARE TRANSACTION 'xact_009_8';
|
||||
COMMIT PREPARED 'xact_009_8';");
|
||||
$cur_slave->psql(
|
||||
$cur_standby->psql(
|
||||
'postgres',
|
||||
"SELECT count(*) FROM pg_prepared_xacts",
|
||||
stdout => \$psql_out);
|
||||
@ -182,7 +182,7 @@ is($psql_out, '0',
|
||||
"Cleanup of shared memory state on running standby without checkpoint");
|
||||
|
||||
###############################################################################
|
||||
# Same as in previous case, but let's force checkpoint on slave between
|
||||
# Same as in previous case, but let's force checkpoint on standby between
|
||||
# prepare and commit to use on-disk twophase files.
|
||||
###############################################################################
|
||||
|
||||
@ -193,9 +193,9 @@ $cur_master->psql(
|
||||
SAVEPOINT s1;
|
||||
INSERT INTO t_009_tbl VALUES (20, 'issued to ${cur_master_name}');
|
||||
PREPARE TRANSACTION 'xact_009_9';");
|
||||
$cur_slave->psql('postgres', "CHECKPOINT");
|
||||
$cur_standby->psql('postgres', "CHECKPOINT");
|
||||
$cur_master->psql('postgres', "COMMIT PREPARED 'xact_009_9'");
|
||||
$cur_slave->psql(
|
||||
$cur_standby->psql(
|
||||
'postgres',
|
||||
"SELECT count(*) FROM pg_prepared_xacts",
|
||||
stdout => \$psql_out);
|
||||
@ -203,7 +203,7 @@ is($psql_out, '0',
|
||||
"Cleanup of shared memory state on running standby after checkpoint");
|
||||
|
||||
###############################################################################
|
||||
# Check that prepared transactions can be committed on promoted slave.
|
||||
# Check that prepared transactions can be committed on promoted standby.
|
||||
###############################################################################
|
||||
|
||||
$cur_master->psql(
|
||||
@ -214,26 +214,26 @@ $cur_master->psql(
|
||||
INSERT INTO t_009_tbl VALUES (22, 'issued to ${cur_master_name}');
|
||||
PREPARE TRANSACTION 'xact_009_10';");
|
||||
$cur_master->teardown_node;
|
||||
$cur_slave->promote;
|
||||
$cur_standby->promote;
|
||||
|
||||
# change roles
|
||||
note "Now paris is master and london is slave";
|
||||
($cur_master, $cur_slave) = ($node_paris, $node_london);
|
||||
note "Now paris is master and london is standby";
|
||||
($cur_master, $cur_standby) = ($node_paris, $node_london);
|
||||
$cur_master_name = $cur_master->name;
|
||||
|
||||
# because london is not running at this point, we can't use syncrep commit
|
||||
# on this command
|
||||
$psql_rc = $cur_master->psql('postgres',
|
||||
"SET synchronous_commit = off; COMMIT PREPARED 'xact_009_10'");
|
||||
is($psql_rc, '0', "Restore of prepared transaction on promoted slave");
|
||||
is($psql_rc, '0', "Restore of prepared transaction on promoted standby");
|
||||
|
||||
# restart old master as new slave
|
||||
$cur_slave->enable_streaming($cur_master);
|
||||
$cur_slave->append_conf(
|
||||
# restart old master as new standby
|
||||
$cur_standby->enable_streaming($cur_master);
|
||||
$cur_standby->append_conf(
|
||||
'recovery.conf', qq(
|
||||
recovery_target_timeline='latest'
|
||||
));
|
||||
$cur_slave->start;
|
||||
$cur_standby->start;
|
||||
|
||||
###############################################################################
|
||||
# Check that prepared transactions are replayed after soft restart of standby
|
||||
@ -250,12 +250,12 @@ $cur_master->psql(
|
||||
INSERT INTO t_009_tbl VALUES (24, 'issued to ${cur_master_name}');
|
||||
PREPARE TRANSACTION 'xact_009_11';");
|
||||
$cur_master->stop;
|
||||
$cur_slave->restart;
|
||||
$cur_slave->promote;
|
||||
$cur_standby->restart;
|
||||
$cur_standby->promote;
|
||||
|
||||
# change roles
|
||||
note "Now london is master and paris is slave";
|
||||
($cur_master, $cur_slave) = ($node_london, $node_paris);
|
||||
note "Now london is master and paris is standby";
|
||||
($cur_master, $cur_standby) = ($node_london, $node_paris);
|
||||
$cur_master_name = $cur_master->name;
|
||||
|
||||
$cur_master->psql(
|
||||
@ -265,18 +265,18 @@ $cur_master->psql(
|
||||
is($psql_out, '1',
|
||||
"Restore prepared transactions from files with master down");
|
||||
|
||||
# restart old master as new slave
|
||||
$cur_slave->enable_streaming($cur_master);
|
||||
$cur_slave->append_conf(
|
||||
# restart old master as new standby
|
||||
$cur_standby->enable_streaming($cur_master);
|
||||
$cur_standby->append_conf(
|
||||
'recovery.conf', qq(
|
||||
recovery_target_timeline='latest'
|
||||
));
|
||||
$cur_slave->start;
|
||||
$cur_standby->start;
|
||||
|
||||
$cur_master->psql('postgres', "COMMIT PREPARED 'xact_009_11'");
|
||||
|
||||
###############################################################################
|
||||
# Check that prepared transactions are correctly replayed after slave hard
|
||||
# Check that prepared transactions are correctly replayed after standby hard
|
||||
# restart while master is down.
|
||||
###############################################################################
|
||||
|
||||
@ -289,13 +289,13 @@ $cur_master->psql(
|
||||
PREPARE TRANSACTION 'xact_009_12';
|
||||
");
|
||||
$cur_master->stop;
|
||||
$cur_slave->teardown_node;
|
||||
$cur_slave->start;
|
||||
$cur_slave->promote;
|
||||
$cur_standby->teardown_node;
|
||||
$cur_standby->start;
|
||||
$cur_standby->promote;
|
||||
|
||||
# change roles
|
||||
note "Now paris is master and london is slave";
|
||||
($cur_master, $cur_slave) = ($node_paris, $node_london);
|
||||
note "Now paris is master and london is standby";
|
||||
($cur_master, $cur_standby) = ($node_paris, $node_london);
|
||||
$cur_master_name = $cur_master->name;
|
||||
|
||||
$cur_master->psql(
|
||||
@ -305,13 +305,13 @@ $cur_master->psql(
|
||||
is($psql_out, '1',
|
||||
"Restore prepared transactions from records with master down");
|
||||
|
||||
# restart old master as new slave
|
||||
$cur_slave->enable_streaming($cur_master);
|
||||
$cur_slave->append_conf(
|
||||
# restart old master as new standby
|
||||
$cur_standby->enable_streaming($cur_master);
|
||||
$cur_standby->append_conf(
|
||||
'recovery.conf', qq(
|
||||
recovery_target_timeline='latest'
|
||||
));
|
||||
$cur_slave->start;
|
||||
$cur_standby->start;
|
||||
|
||||
$cur_master->psql('postgres', "COMMIT PREPARED 'xact_009_12'");
|
||||
|
||||
@ -332,7 +332,7 @@ $cur_master->psql(
|
||||
CHECKPOINT;
|
||||
COMMIT PREPARED 'xact_009_13';");
|
||||
|
||||
$cur_slave->psql(
|
||||
$cur_standby->psql(
|
||||
'postgres',
|
||||
"SELECT count(*) FROM t_009_tbl2",
|
||||
stdout => \$psql_out);
|
||||
@ -383,13 +383,13 @@ $cur_master->psql(
|
||||
is($psql_out, qq{27|issued to paris},
|
||||
"Check expected t_009_tbl2 data on master");
|
||||
|
||||
$cur_slave->psql(
|
||||
$cur_standby->psql(
|
||||
'postgres',
|
||||
"SELECT count(*) FROM pg_prepared_xacts",
|
||||
stdout => \$psql_out);
|
||||
is($psql_out, '0', "No uncommitted prepared transactions on slave");
|
||||
is($psql_out, '0', "No uncommitted prepared transactions on standby");
|
||||
|
||||
$cur_slave->psql(
|
||||
$cur_standby->psql(
|
||||
'postgres',
|
||||
"SELECT * FROM t_009_tbl ORDER BY id",
|
||||
stdout => \$psql_out);
|
||||
@ -415,11 +415,11 @@ is($psql_out, qq{1|issued to london
|
||||
24|issued to paris
|
||||
25|issued to london
|
||||
26|issued to london},
|
||||
"Check expected t_009_tbl data on slave");
|
||||
"Check expected t_009_tbl data on standby");
|
||||
|
||||
$cur_slave->psql(
|
||||
$cur_standby->psql(
|
||||
'postgres',
|
||||
"SELECT * FROM t_009_tbl2",
|
||||
stdout => \$psql_out);
|
||||
is($psql_out, qq{27|issued to paris},
|
||||
"Check expected t_009_tbl2 data on slave");
|
||||
"Check expected t_009_tbl2 data on standby");
|
||||
|
@ -18,11 +18,11 @@ $node_master->start;
|
||||
$node_master->backup('master_backup');
|
||||
$node_master->psql('postgres', "CREATE TABLE t_012_tbl (id int)");
|
||||
|
||||
# Setup slave node
|
||||
my $node_slave = get_new_node('slave');
|
||||
$node_slave->init_from_backup($node_master, 'master_backup',
|
||||
# Setup standby node
|
||||
my $node_standby = get_new_node('standby');
|
||||
$node_standby->init_from_backup($node_master, 'master_backup',
|
||||
has_streaming => 1);
|
||||
$node_slave->start;
|
||||
$node_standby->start;
|
||||
|
||||
# Switch to synchronous replication
|
||||
$node_master->append_conf(
|
||||
@ -100,31 +100,31 @@ $node_master->psql(
|
||||
BEGIN;
|
||||
SELECT hs_subxids(127);
|
||||
COMMIT;");
|
||||
$node_master->wait_for_catchup($node_slave, 'replay',
|
||||
$node_master->wait_for_catchup($node_standby, 'replay',
|
||||
$node_master->lsn('insert'));
|
||||
$node_slave->psql(
|
||||
$node_standby->psql(
|
||||
'postgres',
|
||||
"SELECT coalesce(sum(id),-1) FROM t_012_tbl",
|
||||
stdout => \$psql_out);
|
||||
is($psql_out, '8128', "Visible");
|
||||
$node_master->stop;
|
||||
$node_slave->promote;
|
||||
$node_standby->promote;
|
||||
|
||||
$node_slave->psql(
|
||||
$node_standby->psql(
|
||||
'postgres',
|
||||
"SELECT coalesce(sum(id),-1) FROM t_012_tbl",
|
||||
stdout => \$psql_out);
|
||||
is($psql_out, '8128', "Visible");
|
||||
|
||||
# restore state
|
||||
($node_master, $node_slave) = ($node_slave, $node_master);
|
||||
$node_slave->enable_streaming($node_master);
|
||||
$node_slave->append_conf(
|
||||
($node_master, $node_standby) = ($node_standby, $node_master);
|
||||
$node_standby->enable_streaming($node_master);
|
||||
$node_standby->append_conf(
|
||||
'recovery.conf', qq(
|
||||
recovery_target_timeline='latest'
|
||||
));
|
||||
$node_slave->start;
|
||||
$node_slave->psql(
|
||||
$node_standby->start;
|
||||
$node_standby->psql(
|
||||
'postgres',
|
||||
"SELECT coalesce(sum(id),-1) FROM t_012_tbl",
|
||||
stdout => \$psql_out);
|
||||
@ -151,33 +151,33 @@ $node_master->psql(
|
||||
BEGIN;
|
||||
SELECT hs_subxids(127);
|
||||
PREPARE TRANSACTION 'xact_012_1';");
|
||||
$node_master->wait_for_catchup($node_slave, 'replay',
|
||||
$node_master->wait_for_catchup($node_standby, 'replay',
|
||||
$node_master->lsn('insert'));
|
||||
$node_slave->psql(
|
||||
$node_standby->psql(
|
||||
'postgres',
|
||||
"SELECT coalesce(sum(id),-1) FROM t_012_tbl",
|
||||
stdout => \$psql_out);
|
||||
is($psql_out, '-1', "Not visible");
|
||||
$node_master->stop;
|
||||
$node_slave->promote;
|
||||
$node_standby->promote;
|
||||
|
||||
$node_slave->psql(
|
||||
$node_standby->psql(
|
||||
'postgres',
|
||||
"SELECT coalesce(sum(id),-1) FROM t_012_tbl",
|
||||
stdout => \$psql_out);
|
||||
is($psql_out, '-1', "Not visible");
|
||||
|
||||
# restore state
|
||||
($node_master, $node_slave) = ($node_slave, $node_master);
|
||||
$node_slave->enable_streaming($node_master);
|
||||
$node_slave->append_conf(
|
||||
($node_master, $node_standby) = ($node_standby, $node_master);
|
||||
$node_standby->enable_streaming($node_master);
|
||||
$node_standby->append_conf(
|
||||
'recovery.conf', qq(
|
||||
recovery_target_timeline='latest'
|
||||
));
|
||||
$node_slave->start;
|
||||
$node_standby->start;
|
||||
$psql_rc = $node_master->psql('postgres', "COMMIT PREPARED 'xact_012_1'");
|
||||
is($psql_rc, '0',
|
||||
"Restore of PGPROC_MAX_CACHED_SUBXIDS+ prepared transaction on promoted slave"
|
||||
"Restore of PGPROC_MAX_CACHED_SUBXIDS+ prepared transaction on promoted standby"
|
||||
);
|
||||
|
||||
$node_master->psql(
|
||||
@ -192,33 +192,33 @@ $node_master->psql(
|
||||
BEGIN;
|
||||
SELECT hs_subxids(201);
|
||||
PREPARE TRANSACTION 'xact_012_1';");
|
||||
$node_master->wait_for_catchup($node_slave, 'replay',
|
||||
$node_master->wait_for_catchup($node_standby, 'replay',
|
||||
$node_master->lsn('insert'));
|
||||
$node_slave->psql(
|
||||
$node_standby->psql(
|
||||
'postgres',
|
||||
"SELECT coalesce(sum(id),-1) FROM t_012_tbl",
|
||||
stdout => \$psql_out);
|
||||
is($psql_out, '-1', "Not visible");
|
||||
$node_master->stop;
|
||||
$node_slave->promote;
|
||||
$node_standby->promote;
|
||||
|
||||
$node_slave->psql(
|
||||
$node_standby->psql(
|
||||
'postgres',
|
||||
"SELECT coalesce(sum(id),-1) FROM t_012_tbl",
|
||||
stdout => \$psql_out);
|
||||
is($psql_out, '-1', "Not visible");
|
||||
|
||||
# restore state
|
||||
($node_master, $node_slave) = ($node_slave, $node_master);
|
||||
$node_slave->enable_streaming($node_master);
|
||||
$node_slave->append_conf(
|
||||
($node_master, $node_standby) = ($node_standby, $node_master);
|
||||
$node_standby->enable_streaming($node_master);
|
||||
$node_standby->append_conf(
|
||||
'recovery.conf', qq(
|
||||
recovery_target_timeline='latest'
|
||||
));
|
||||
$node_slave->start;
|
||||
$node_standby->start;
|
||||
$psql_rc = $node_master->psql('postgres', "ROLLBACK PREPARED 'xact_012_1'");
|
||||
is($psql_rc, '0',
|
||||
"Rollback of PGPROC_MAX_CACHED_SUBXIDS+ prepared transaction on promoted slave"
|
||||
"Rollback of PGPROC_MAX_CACHED_SUBXIDS+ prepared transaction on promoted standby"
|
||||
);
|
||||
|
||||
$node_master->psql(
|
||||
|
Loading…
x
Reference in New Issue
Block a user