# Wait for standby to catch up
my $applname = $node_standby->name;
my $caughtup_query =
-"SELECT pg_current_xlog_location() <= write_location FROM pg_stat_replication WHERE application_name = '$applname';";
+"SELECT pg_current_wal_location() <= write_location FROM pg_stat_replication WHERE application_name = '$applname';";
$node_master->poll_query_until('postgres', $caughtup_query)
or die "Timed out while waiting for standby 1 to catch up";
SELECT slot_name, plugin, slot_type, active,
NOT catalog_xmin IS NULL AS catalog_xmin_set,
xmin IS NULl AS data_xmin_not_set,
- pg_xlog_location_diff(restart_lsn, '0/01000000') > 0 AS some_wal
+ pg_wal_location_diff(restart_lsn, '0/01000000') > 0 AS some_wal
FROM pg_replication_slots;
slot_name | plugin | slot_type | active | catalog_xmin_set | data_xmin_not_set | some_wal
-----------------+---------------+-----------+--------+------------------+-------------------+----------
SELECT slot_name, plugin, slot_type, active,
NOT catalog_xmin IS NULL AS catalog_xmin_set,
xmin IS NULl AS data_xmin_not_set,
- pg_xlog_location_diff(restart_lsn, '0/01000000') > 0 AS some_wal
+ pg_wal_location_diff(restart_lsn, '0/01000000') > 0 AS some_wal
FROM pg_replication_slots;
/*
<para>
Also, you can force a segment switch manually with
- <function>pg_switch_xlog</> if you want to ensure that a
+ <function>pg_switch_wal</> if you want to ensure that a
just-finished transaction is archived as soon as possible. Other utility
functions related to WAL management are listed in <xref
linkend="functions-admin-backup-table">.
<primary>pg_create_restore_point</primary>
</indexterm>
<indexterm>
- <primary>pg_current_xlog_flush_location</primary>
+ <primary>pg_current_wal_flush_location</primary>
</indexterm>
<indexterm>
- <primary>pg_current_xlog_insert_location</primary>
+ <primary>pg_current_wal_insert_location</primary>
</indexterm>
<indexterm>
- <primary>pg_current_xlog_location</primary>
+ <primary>pg_current_wal_location</primary>
</indexterm>
<indexterm>
<primary>pg_start_backup</primary>
<primary>pg_backup_start_time</primary>
</indexterm>
<indexterm>
- <primary>pg_switch_xlog</primary>
+ <primary>pg_switch_wal</primary>
</indexterm>
<indexterm>
- <primary>pg_xlogfile_name</primary>
+ <primary>pg_walfile_name</primary>
</indexterm>
<indexterm>
- <primary>pg_xlogfile_name_offset</primary>
+ <primary>pg_walfile_name_offset</primary>
</indexterm>
<indexterm>
- <primary>pg_xlog_location_diff</primary>
+ <primary>pg_wal_location_diff</primary>
</indexterm>
<para>
linkend="functions-admin-backup-table"> assist in making on-line backups.
These functions cannot be executed during recovery (except
<function>pg_is_in_backup</function>, <function>pg_backup_start_time</function>
- and <function>pg_xlog_location_diff</function>).
+ and <function>pg_wal_location_diff</function>).
</para>
<table id="functions-admin-backup-table">
</row>
<row>
<entry>
- <literal><function>pg_current_xlog_flush_location()</function></literal>
+ <literal><function>pg_current_wal_flush_location()</function></literal>
</entry>
<entry><type>pg_lsn</type></entry>
<entry>Get current transaction log flush location</entry>
</row>
<row>
<entry>
- <literal><function>pg_current_xlog_insert_location()</function></literal>
+ <literal><function>pg_current_wal_insert_location()</function></literal>
</entry>
<entry><type>pg_lsn</type></entry>
<entry>Get current transaction log insert location</entry>
</row>
<row>
<entry>
- <literal><function>pg_current_xlog_location()</function></literal>
+ <literal><function>pg_current_wal_location()</function></literal>
</entry>
<entry><type>pg_lsn</type></entry>
<entry>Get current transaction log write location</entry>
</row>
<row>
<entry>
- <literal><function>pg_switch_xlog()</function></literal>
+ <literal><function>pg_switch_wal()</function></literal>
</entry>
<entry><type>pg_lsn</type></entry>
<entry>Force switch to a new transaction log file (restricted to superusers by default, but other users can be granted EXECUTE to run the function)</entry>
</row>
<row>
<entry>
- <literal><function>pg_xlogfile_name(<parameter>location</> <type>pg_lsn</>)</function></literal>
+ <literal><function>pg_walfile_name(<parameter>location</> <type>pg_lsn</>)</function></literal>
</entry>
<entry><type>text</type></entry>
<entry>Convert transaction log location string to file name</entry>
</row>
<row>
<entry>
- <literal><function>pg_xlogfile_name_offset(<parameter>location</> <type>pg_lsn</>)</function></literal>
+ <literal><function>pg_walfile_name_offset(<parameter>location</> <type>pg_lsn</>)</function></literal>
</entry>
<entry><type>text</>, <type>integer</></entry>
<entry>Convert transaction log location string to file name and decimal byte offset within file</entry>
</row>
<row>
<entry>
- <literal><function>pg_xlog_location_diff(<parameter>location</> <type>pg_lsn</>, <parameter>location</> <type>pg_lsn</>)</function></literal>
+ <literal><function>pg_wal_location_diff(<parameter>location</> <type>pg_lsn</>, <parameter>location</> <type>pg_lsn</>)</function></literal>
</entry>
<entry><type>numeric</></entry>
<entry>Calculate the difference between two transaction log locations</entry>
</para>
<para>
- <function>pg_switch_xlog</> moves to the next transaction log file, allowing the
+ <function>pg_switch_wal</> moves to the next transaction log file, allowing the
current file to be archived (assuming you are using continuous archiving).
The return value is the ending transaction log location + 1 within the just-completed transaction log file.
If there has been no transaction log activity since the last transaction log switch,
- <function>pg_switch_xlog</> does nothing and returns the start location
+ <function>pg_switch_wal</> does nothing and returns the start location
of the transaction log file currently in use.
</para>
</para>
<para>
- <function>pg_current_xlog_location</> displays the current transaction log write
+ <function>pg_current_wal_location</> displays the current transaction log write
location in the same format used by the above functions. Similarly,
- <function>pg_current_xlog_insert_location</> displays the current transaction log
- insertion point and <function>pg_current_xlog_flush_location</> displays the
+ <function>pg_current_wal_insert_location</> displays the current transaction log
+ insertion point and <function>pg_current_wal_flush_location</> displays the
current transaction log flush point. The insertion point is the <quote>logical</>
end of the transaction log at any instant, while the write location is the end of
what has actually been written out from the server's internal buffers and flush
</para>
<para>
- You can use <function>pg_xlogfile_name_offset</> to extract the
+ You can use <function>pg_walfile_name_offset</> to extract the
corresponding transaction log file name and byte offset from the results of any of the
above functions. For example:
<programlisting>
-postgres=# SELECT * FROM pg_xlogfile_name_offset(pg_stop_backup());
+postgres=# SELECT * FROM pg_walfile_name_offset(pg_stop_backup());
file_name | file_offset
--------------------------+-------------
00000001000000000000000D | 4039624
(1 row)
</programlisting>
- Similarly, <function>pg_xlogfile_name</> extracts just the transaction log file name.
+ Similarly, <function>pg_walfile_name</> extracts just the transaction log file name.
When the given transaction log location is exactly at a transaction log file boundary, both
these functions return the name of the preceding transaction log file.
This is usually the desired behavior for managing transaction log archiving
</para>
<para>
- <function>pg_xlog_location_diff</> calculates the difference in bytes
+ <function>pg_wal_location_diff</> calculates the difference in bytes
between two transaction log locations. It can be used with
<structname>pg_stat_replication</structname> or some functions shown in
<xref linkend="functions-admin-backup-table"> to get the replication lag.
<primary>pg_is_in_recovery</primary>
</indexterm>
<indexterm>
- <primary>pg_last_xlog_receive_location</primary>
+ <primary>pg_last_wal_receive_location</primary>
</indexterm>
<indexterm>
- <primary>pg_last_xlog_replay_location</primary>
+ <primary>pg_last_wal_replay_location</primary>
</indexterm>
<indexterm>
<primary>pg_last_xact_replay_timestamp</primary>
</row>
<row>
<entry>
- <literal><function>pg_last_xlog_receive_location()</function></literal>
+ <literal><function>pg_last_wal_receive_location()</function></literal>
</entry>
<entry><type>pg_lsn</type></entry>
<entry>Get last transaction log location received and synced to disk by
</row>
<row>
<entry>
- <literal><function>pg_last_xlog_replay_location()</function></literal>
+ <literal><function>pg_last_wal_replay_location()</function></literal>
</entry>
<entry><type>pg_lsn</type></entry>
<entry>Get last transaction log location replayed during recovery.
</table>
<indexterm>
- <primary>pg_is_xlog_replay_paused</primary>
+ <primary>pg_is_wal_replay_paused</primary>
</indexterm>
<indexterm>
- <primary>pg_xlog_replay_pause</primary>
+ <primary>pg_wal_replay_pause</primary>
</indexterm>
<indexterm>
- <primary>pg_xlog_replay_resume</primary>
+ <primary>pg_wal_replay_resume</primary>
</indexterm>
<para>
<tbody>
<row>
<entry>
- <literal><function>pg_is_xlog_replay_paused()</function></literal>
+ <literal><function>pg_is_wal_replay_paused()</function></literal>
</entry>
<entry><type>bool</type></entry>
<entry>True if recovery is paused.
</row>
<row>
<entry>
- <literal><function>pg_xlog_replay_pause()</function></literal>
+ <literal><function>pg_wal_replay_pause()</function></literal>
</entry>
<entry><type>void</type></entry>
<entry>Pauses recovery immediately (restricted to superusers by default, but other users can be granted EXECUTE to run the function).
</row>
<row>
<entry>
- <literal><function>pg_xlog_replay_resume()</function></literal>
+ <literal><function>pg_wal_replay_resume()</function></literal>
</entry>
<entry><type>void</type></entry>
<entry>Restarts recovery if it was paused (restricted to superusers by default, but other users can be granted EXECUTE to run the function).
<literal><function>pg_create_physical_replication_slot(<parameter>slot_name</parameter> <type>name</type> <optional>, <parameter>immediately_reserve</> <type>boolean</>, <parameter>temporary</> <type>boolean</></optional>)</function></literal>
</entry>
<entry>
- (<parameter>slot_name</parameter> <type>name</type>, <parameter>xlog_position</parameter> <type>pg_lsn</type>)
+ (<parameter>slot_name</parameter> <type>name</type>, <parameter>wal_position</parameter> <type>pg_lsn</type>)
</entry>
<entry>
Creates a new physical replication slot named
<literal><function>pg_create_logical_replication_slot(<parameter>slot_name</parameter> <type>name</type>, <parameter>plugin</parameter> <type>name</type> <optional>, <parameter>temporary</> <type>boolean</></optional>)</function></literal>
</entry>
<entry>
- (<parameter>slot_name</parameter> <type>name</type>, <parameter>xlog_position</parameter> <type>pg_lsn</type>)
+ (<parameter>slot_name</parameter> <type>name</type>, <parameter>wal_position</parameter> <type>pg_lsn</type>)
</entry>
<entry>
Creates a new logical (decoding) replication slot named
standby. You can calculate this lag by comparing the current WAL write
location on the primary with the last WAL location received by the
standby. They can be retrieved using
- <function>pg_current_xlog_location</> on the primary and the
- <function>pg_last_xlog_receive_location</> on the standby,
+ <function>pg_current_wal_location</> on the primary and the
+ <function>pg_last_wal_receive_location</> on the standby,
respectively (see <xref linkend="functions-admin-backup-table"> and
<xref linkend="functions-recovery-info-table"> for details).
The last WAL receive location in the standby is also displayed in the
You can retrieve a list of WAL sender processes via the
<link linkend="monitoring-stats-views-table">
<literal>pg_stat_replication</></link> view. Large differences between
- <function>pg_current_xlog_location</> and <literal>sent_location</> field
+ <function>pg_current_wal_location</> and <literal>sent_location</> field
might indicate that the master server is under heavy load, while
differences between <literal>sent_location</> and
- <function>pg_last_xlog_receive_location</> on the standby might indicate
+ <function>pg_last_wal_receive_location</> on the standby might indicate
network delay, or that the standby is under heavy load.
</para>
</sect3>
You can create a replication slot like this:
<programlisting>
postgres=# SELECT * FROM pg_create_physical_replication_slot('node_a_slot');
- slot_name | xlog_position
+ slot_name | wal_position
-------------+---------------
node_a_slot |
</para>
<para>
- An external program can call the <function>pg_xlogfile_name_offset()</>
+ An external program can call the <function>pg_walfile_name_offset()</>
function (see <xref linkend="functions-admin">)
to find out the file name and the exact byte offset within it of
the current end of WAL. It can then access the WAL file directly
<para>
WAL file control commands will not work during recovery,
- e.g. <function>pg_start_backup</>, <function>pg_switch_xlog</> etc.
+ e.g. <function>pg_start_backup</>, <function>pg_switch_wal</> etc.
</para>
<para>
<programlisting>
postgres=# -- Create a slot named 'regression_slot' using the output plugin 'test_decoding'
postgres=# SELECT * FROM pg_create_logical_replication_slot('regression_slot', 'test_decoding');
- slot_name | xlog_position
+ slot_name | wal_position
-----------------+---------------
regression_slot | 0/16B1970
(1 row)
to be executed against the database to check if this recovery target
is the most desirable point for recovery.
The paused state can be resumed by
- using <function>pg_xlog_replay_resume()</> (see
+ using <function>pg_wal_replay_resume()</> (see
<xref linkend="functions-recovery-control-table">), which then
causes recovery to end. If this recovery target is not the
desired stopping point, then shut down the server, change the
#
# If recovery_target_action = 'pause', recovery will pause when the
# recovery target is reached. The pause state will continue until
-# pg_xlog_replay_resume() is called. This setting has no effect if
+# pg_wal_replay_resume() is called. This setting has no effect if
# no recovery target is set. If hot_standby is not enabled then the
# server will shutdown instead, though you may request this in
# any case by specifying 'shutdown'.
ereport(LOG,
(errmsg("recovery has paused"),
- errhint("Execute pg_xlog_replay_resume() to continue.")));
+ errhint("Execute pg_wal_replay_resume() to continue.")));
while (RecoveryIsPaused())
{
}
/*
- * pg_switch_xlog: switch to next xlog file
+ * pg_switch_wal: switch to next xlog file
*
* Permission checking for this function is managed through the normal
* GRANT system.
*/
Datum
-pg_switch_xlog(PG_FUNCTION_ARGS)
+pg_switch_wal(PG_FUNCTION_ARGS)
{
XLogRecPtr switchpoint;
* to the kernel, but is not necessarily synced to disk.
*/
Datum
-pg_current_xlog_location(PG_FUNCTION_ARGS)
+pg_current_wal_location(PG_FUNCTION_ARGS)
{
XLogRecPtr current_recptr;
* This function is mostly for debugging purposes.
*/
Datum
-pg_current_xlog_insert_location(PG_FUNCTION_ARGS)
+pg_current_wal_insert_location(PG_FUNCTION_ARGS)
{
XLogRecPtr current_recptr;
* This function is mostly for debugging purposes.
*/
Datum
-pg_current_xlog_flush_location(PG_FUNCTION_ARGS)
+pg_current_wal_flush_location(PG_FUNCTION_ARGS)
{
XLogRecPtr current_recptr;
* and synced to disk by walreceiver.
*/
Datum
-pg_last_xlog_receive_location(PG_FUNCTION_ARGS)
+pg_last_wal_receive_location(PG_FUNCTION_ARGS)
{
XLogRecPtr recptr;
* connections during recovery.
*/
Datum
-pg_last_xlog_replay_location(PG_FUNCTION_ARGS)
+pg_last_wal_replay_location(PG_FUNCTION_ARGS)
{
XLogRecPtr recptr;
* expected usage is to determine which xlog file(s) are ready to archive.
*/
Datum
-pg_xlogfile_name_offset(PG_FUNCTION_ARGS)
+pg_walfile_name_offset(PG_FUNCTION_ARGS)
{
XLogSegNo xlogsegno;
uint32 xrecoff;
ereport(ERROR,
(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
errmsg("recovery is in progress"),
- errhint("pg_xlogfile_name_offset() cannot be executed during recovery.")));
+ errhint("pg_walfile_name_offset() cannot be executed during recovery.")));
/*
* Construct a tuple descriptor for the result row. This must match this
* such as is returned by pg_stop_backup() or pg_xlog_switch().
*/
Datum
-pg_xlogfile_name(PG_FUNCTION_ARGS)
+pg_walfile_name(PG_FUNCTION_ARGS)
{
XLogSegNo xlogsegno;
XLogRecPtr locationpoint = PG_GETARG_LSN(0);
ereport(ERROR,
(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
errmsg("recovery is in progress"),
- errhint("pg_xlogfile_name() cannot be executed during recovery.")));
+ errhint("pg_walfile_name() cannot be executed during recovery.")));
XLByteToPrevSeg(locationpoint, xlogsegno);
XLogFileName(xlogfilename, ThisTimeLineID, xlogsegno);
}
/*
- * pg_xlog_replay_pause - pause recovery now
+ * pg_wal_replay_pause - pause recovery now
*
* Permission checking for this function is managed through the normal
* GRANT system.
*/
Datum
-pg_xlog_replay_pause(PG_FUNCTION_ARGS)
+pg_wal_replay_pause(PG_FUNCTION_ARGS)
{
if (!RecoveryInProgress())
ereport(ERROR,
}
/*
- * pg_xlog_replay_resume - resume recovery now
+ * pg_wal_replay_resume - resume recovery now
*
* Permission checking for this function is managed through the normal
* GRANT system.
*/
Datum
-pg_xlog_replay_resume(PG_FUNCTION_ARGS)
+pg_wal_replay_resume(PG_FUNCTION_ARGS)
{
if (!RecoveryInProgress())
ereport(ERROR,
}
/*
- * pg_is_xlog_replay_paused
+ * pg_is_wal_replay_paused
*/
Datum
-pg_is_xlog_replay_paused(PG_FUNCTION_ARGS)
+pg_is_wal_replay_paused(PG_FUNCTION_ARGS)
{
if (!RecoveryInProgress())
ereport(ERROR,
* Compute the difference in bytes between two WAL locations.
*/
Datum
-pg_xlog_location_diff(PG_FUNCTION_ARGS)
+pg_wal_location_diff(PG_FUNCTION_ARGS)
{
Datum result;
CREATE OR REPLACE FUNCTION pg_create_physical_replication_slot(
IN slot_name name, IN immediately_reserve boolean DEFAULT false,
IN temporary boolean DEFAULT false,
- OUT slot_name name, OUT xlog_position pg_lsn)
+ OUT slot_name name, OUT wal_position pg_lsn)
RETURNS RECORD
LANGUAGE INTERNAL
STRICT VOLATILE
CREATE OR REPLACE FUNCTION pg_create_logical_replication_slot(
IN slot_name name, IN plugin name,
IN temporary boolean DEFAULT false,
- OUT slot_name text, OUT xlog_position pg_lsn)
+ OUT slot_name text, OUT wal_position pg_lsn)
RETURNS RECORD
LANGUAGE INTERNAL
STRICT VOLATILE
REVOKE EXECUTE ON FUNCTION pg_stop_backup() FROM public;
REVOKE EXECUTE ON FUNCTION pg_stop_backup(boolean) FROM public;
REVOKE EXECUTE ON FUNCTION pg_create_restore_point(text) FROM public;
-REVOKE EXECUTE ON FUNCTION pg_switch_xlog() FROM public;
-REVOKE EXECUTE ON FUNCTION pg_xlog_replay_pause() FROM public;
-REVOKE EXECUTE ON FUNCTION pg_xlog_replay_resume() FROM public;
+REVOKE EXECUTE ON FUNCTION pg_switch_wal() FROM public;
+REVOKE EXECUTE ON FUNCTION pg_wal_replay_pause() FROM public;
+REVOKE EXECUTE ON FUNCTION pg_wal_replay_resume() FROM public;
REVOKE EXECUTE ON FUNCTION pg_rotate_logfile() FROM public;
REVOKE EXECUTE ON FUNCTION pg_reload_conf() FROM public;
$node->psql('postgres', 'CREATE TABLE test_table(x integer)');
$node->psql('postgres', 'INSERT INTO test_table(x) SELECT y FROM generate_series(1, 10) a(y);');
-my $nextlsn = $node->safe_psql('postgres', 'SELECT pg_current_xlog_insert_location()');
+my $nextlsn = $node->safe_psql('postgres', 'SELECT pg_current_wal_insert_location()');
chomp($nextlsn);
$node->command_ok(['pg_recvlogical', '-S', 'test', '-d', $node->connstr('postgres'), '--start', '--endpos', "$nextlsn", '--no-loop', '-f', '-'],
# Wait for the standby to receive and write all WAL.
my $wal_received_query =
-"SELECT pg_current_xlog_location() = write_location FROM pg_stat_replication WHERE application_name = 'rewind_standby';";
+"SELECT pg_current_wal_location() = write_location FROM pg_stat_replication WHERE application_name = 'rewind_standby';";
$node_master->poll_query_until('postgres', $wal_received_query)
or die "Timed out while waiting for standby to receive and write WAL";
}
/*
- * Calls pg_current_xlog_insert_location() function
+ * Calls pg_current_wal_insert_location() function
*/
XLogRecPtr
libpqGetCurrentXlogInsertLocation(void)
uint32 lo;
char *val;
- val = run_simple_query("SELECT pg_current_xlog_insert_location()");
+ val = run_simple_query("SELECT pg_current_wal_insert_location()");
if (sscanf(val, "%X/%X", &hi, &lo) != 2)
pg_fatal("unrecognized result \"%s\" for current WAL insert location\n", val);
*/
/* yyyymmddN */
-#define CATALOG_VERSION_NO 201701301
+#define CATALOG_VERSION_NO 201701309
#endif
DESCR("true if server is in online backup");
DATA(insert OID = 3814 ( pg_backup_start_time PGNSP PGUID 12 1 0 0 0 f f f f t f s s 0 0 1184 "" _null_ _null_ _null_ _null_ _null_ pg_backup_start_time _null_ _null_ _null_ ));
DESCR("start time of an online backup");
-DATA(insert OID = 2848 ( pg_switch_xlog PGNSP PGUID 12 1 0 0 0 f f f f t f v s 0 0 3220 "" _null_ _null_ _null_ _null_ _null_ pg_switch_xlog _null_ _null_ _null_ ));
-DESCR("switch to new xlog file");
+DATA(insert OID = 2848 ( pg_switch_wal PGNSP PGUID 12 1 0 0 0 f f f f t f v s 0 0 3220 "" _null_ _null_ _null_ _null_ _null_ pg_switch_wal _null_ _null_ _null_ ));
+DESCR("switch to new wal file");
DATA(insert OID = 3098 ( pg_create_restore_point PGNSP PGUID 12 1 0 0 0 f f f f t f v s 1 0 3220 "25" _null_ _null_ _null_ _null_ _null_ pg_create_restore_point _null_ _null_ _null_ ));
DESCR("create a named restore point");
-DATA(insert OID = 2849 ( pg_current_xlog_location PGNSP PGUID 12 1 0 0 0 f f f f t f v s 0 0 3220 "" _null_ _null_ _null_ _null_ _null_ pg_current_xlog_location _null_ _null_ _null_ ));
-DESCR("current xlog write location");
-DATA(insert OID = 2852 ( pg_current_xlog_insert_location PGNSP PGUID 12 1 0 0 0 f f f f t f v s 0 0 3220 "" _null_ _null_ _null_ _null_ _null_ pg_current_xlog_insert_location _null_ _null_ _null_ ));
-DESCR("current xlog insert location");
-DATA(insert OID = 3330 ( pg_current_xlog_flush_location PGNSP PGUID 12 1 0 0 0 f f f f t f v s 0 0 3220 "" _null_ _null_ _null_ _null_ _null_ pg_current_xlog_flush_location _null_ _null_ _null_ ));
-DESCR("current xlog flush location");
-DATA(insert OID = 2850 ( pg_xlogfile_name_offset PGNSP PGUID 12 1 0 0 0 f f f f t f i s 1 0 2249 "3220" "{3220,25,23}" "{i,o,o}" "{wal_location,file_name,file_offset}" _null_ _null_ pg_xlogfile_name_offset _null_ _null_ _null_ ));
-DESCR("xlog filename and byte offset, given an xlog location");
-DATA(insert OID = 2851 ( pg_xlogfile_name PGNSP PGUID 12 1 0 0 0 f f f f t f i s 1 0 25 "3220" _null_ _null_ _null_ _null_ _null_ pg_xlogfile_name _null_ _null_ _null_ ));
-DESCR("xlog filename, given an xlog location");
-
-DATA(insert OID = 3165 ( pg_xlog_location_diff PGNSP PGUID 12 1 0 0 0 f f f f t f i s 2 0 1700 "3220 3220" _null_ _null_ _null_ _null_ _null_ pg_xlog_location_diff _null_ _null_ _null_ ));
-DESCR("difference in bytes, given two xlog locations");
+DATA(insert OID = 2849 ( pg_current_wal_location PGNSP PGUID 12 1 0 0 0 f f f f t f v s 0 0 3220 "" _null_ _null_ _null_ _null_ _null_ pg_current_wal_location _null_ _null_ _null_ ));
+DESCR("current wal write location");
+DATA(insert OID = 2852 ( pg_current_wal_insert_location PGNSP PGUID 12 1 0 0 0 f f f f t f v s 0 0 3220 "" _null_ _null_ _null_ _null_ _null_ pg_current_wal_insert_location _null_ _null_ _null_ ));
+DESCR("current wal insert location");
+DATA(insert OID = 3330 ( pg_current_wal_flush_location PGNSP PGUID 12 1 0 0 0 f f f f t f v s 0 0 3220 "" _null_ _null_ _null_ _null_ _null_ pg_current_wal_flush_location _null_ _null_ _null_ ));
+DESCR("current wal flush location");
+DATA(insert OID = 2850 ( pg_walfile_name_offset PGNSP PGUID 12 1 0 0 0 f f f f t f i s 1 0 2249 "3220" "{3220,25,23}" "{i,o,o}" "{wal_location,file_name,file_offset}" _null_ _null_ pg_walfile_name_offset _null_ _null_ _null_ ));
+DESCR("wal filename and byte offset, given an wal location");
+DATA(insert OID = 2851 ( pg_walfile_name PGNSP PGUID 12 1 0 0 0 f f f f t f i s 1 0 25 "3220" _null_ _null_ _null_ _null_ _null_ pg_walfile_name _null_ _null_ _null_ ));
+DESCR("wal filename, given an wal location");
+
+DATA(insert OID = 3165 ( pg_wal_location_diff PGNSP PGUID 12 1 0 0 0 f f f f t f i s 2 0 1700 "3220 3220" _null_ _null_ _null_ _null_ _null_ pg_wal_location_diff _null_ _null_ _null_ ));
+DESCR("difference in bytes, given two wal locations");
DATA(insert OID = 3809 ( pg_export_snapshot PGNSP PGUID 12 1 0 0 0 f f f f t f v u 0 0 25 "" _null_ _null_ _null_ _null_ _null_ pg_export_snapshot _null_ _null_ _null_ ));
DESCR("export a snapshot");
DATA(insert OID = 3810 ( pg_is_in_recovery PGNSP PGUID 12 1 0 0 0 f f f f t f v s 0 0 16 "" _null_ _null_ _null_ _null_ _null_ pg_is_in_recovery _null_ _null_ _null_ ));
DESCR("true if server is in recovery");
-DATA(insert OID = 3820 ( pg_last_xlog_receive_location PGNSP PGUID 12 1 0 0 0 f f f f t f v s 0 0 3220 "" _null_ _null_ _null_ _null_ _null_ pg_last_xlog_receive_location _null_ _null_ _null_ ));
-DESCR("current xlog flush location");
-DATA(insert OID = 3821 ( pg_last_xlog_replay_location PGNSP PGUID 12 1 0 0 0 f f f f t f v s 0 0 3220 "" _null_ _null_ _null_ _null_ _null_ pg_last_xlog_replay_location _null_ _null_ _null_ ));
-DESCR("last xlog replay location");
+DATA(insert OID = 3820 ( pg_last_wal_receive_location PGNSP PGUID 12 1 0 0 0 f f f f t f v s 0 0 3220 "" _null_ _null_ _null_ _null_ _null_ pg_last_wal_receive_location _null_ _null_ _null_ ));
+DESCR("current wal flush location");
+DATA(insert OID = 3821 ( pg_last_wal_replay_location PGNSP PGUID 12 1 0 0 0 f f f f t f v s 0 0 3220 "" _null_ _null_ _null_ _null_ _null_ pg_last_wal_replay_location _null_ _null_ _null_ ));
+DESCR("last wal replay location");
DATA(insert OID = 3830 ( pg_last_xact_replay_timestamp PGNSP PGUID 12 1 0 0 0 f f f f t f v s 0 0 1184 "" _null_ _null_ _null_ _null_ _null_ pg_last_xact_replay_timestamp _null_ _null_ _null_ ));
DESCR("timestamp of last replay xact");
-DATA(insert OID = 3071 ( pg_xlog_replay_pause PGNSP PGUID 12 1 0 0 0 f f f f t f v s 0 0 2278 "" _null_ _null_ _null_ _null_ _null_ pg_xlog_replay_pause _null_ _null_ _null_ ));
-DESCR("pause xlog replay");
-DATA(insert OID = 3072 ( pg_xlog_replay_resume PGNSP PGUID 12 1 0 0 0 f f f f t f v s 0 0 2278 "" _null_ _null_ _null_ _null_ _null_ pg_xlog_replay_resume _null_ _null_ _null_ ));
-DESCR("resume xlog replay, if it was paused");
-DATA(insert OID = 3073 ( pg_is_xlog_replay_paused PGNSP PGUID 12 1 0 0 0 f f f f t f v s 0 0 16 "" _null_ _null_ _null_ _null_ _null_ pg_is_xlog_replay_paused _null_ _null_ _null_ ));
-DESCR("true if xlog replay is paused");
+DATA(insert OID = 3071 ( pg_wal_replay_pause PGNSP PGUID 12 1 0 0 0 f f f f t f v s 0 0 2278 "" _null_ _null_ _null_ _null_ _null_ pg_wal_replay_pause _null_ _null_ _null_ ));
+DESCR("pause wal replay");
+DATA(insert OID = 3072 ( pg_wal_replay_resume PGNSP PGUID 12 1 0 0 0 f f f f t f v s 0 0 2278 "" _null_ _null_ _null_ _null_ _null_ pg_wal_replay_resume _null_ _null_ _null_ ));
+DESCR("resume wal replay, if it was paused");
+DATA(insert OID = 3073 ( pg_is_wal_replay_paused PGNSP PGUID 12 1 0 0 0 f f f f t f v s 0 0 16 "" _null_ _null_ _null_ _null_ _null_ pg_is_wal_replay_paused _null_ _null_ _null_ ));
+DESCR("true if wal replay is paused");
DATA(insert OID = 2621 ( pg_reload_conf PGNSP PGUID 12 1 0 0 0 f f f f t f v s 0 0 16 "" _null_ _null_ _null_ _null_ _null_ pg_reload_conf _null_ _null_ _null_ ));
DESCR("reload configuration files");
DESCR("SP-GiST support for quad tree over box");
/* replication slots */
-DATA(insert OID = 3779 ( pg_create_physical_replication_slot PGNSP PGUID 12 1 0 0 0 f f f f t f v u 3 0 2249 "19 16 16" "{19,16,16,19,3220}" "{i,i,i,o,o}" "{slot_name,immediately_reserve,temporary,slot_name,xlog_position}" _null_ _null_ pg_create_physical_replication_slot _null_ _null_ _null_ ));
+DATA(insert OID = 3779 ( pg_create_physical_replication_slot PGNSP PGUID 12 1 0 0 0 f f f f t f v u 3 0 2249 "19 16 16" "{19,16,16,19,3220}" "{i,i,i,o,o}" "{slot_name,immediately_reserve,temporary,slot_name,wal_position}" _null_ _null_ pg_create_physical_replication_slot _null_ _null_ _null_ ));
DESCR("create a physical replication slot");
DATA(insert OID = 3780 ( pg_drop_replication_slot PGNSP PGUID 12 1 0 0 0 f f f f t f v u 1 0 2278 "19" _null_ _null_ _null_ _null_ _null_ pg_drop_replication_slot _null_ _null_ _null_ ));
DESCR("drop a replication slot");
DATA(insert OID = 3781 ( pg_get_replication_slots PGNSP PGUID 12 1 10 0 0 f f f f f t s s 0 0 2249 "" "{19,19,25,26,16,16,23,28,28,3220,3220}" "{o,o,o,o,o,o,o,o,o,o,o}" "{slot_name,plugin,slot_type,datoid,temporary,active,active_pid,xmin,catalog_xmin,restart_lsn,confirmed_flush_lsn}" _null_ _null_ pg_get_replication_slots _null_ _null_ _null_ ));
DESCR("information about replication slots currently in use");
-DATA(insert OID = 3786 ( pg_create_logical_replication_slot PGNSP PGUID 12 1 0 0 0 f f f f t f v u 3 0 2249 "19 19 16" "{19,19,16,25,3220}" "{i,i,i,o,o}" "{slot_name,plugin,temporary,slot_name,xlog_position}" _null_ _null_ pg_create_logical_replication_slot _null_ _null_ _null_ ));
+DATA(insert OID = 3786 ( pg_create_logical_replication_slot PGNSP PGUID 12 1 0 0 0 f f f f t f v u 3 0 2249 "19 19 16" "{19,19,16,25,3220}" "{i,i,i,o,o}" "{slot_name,plugin,temporary,slot_name,wal_position}" _null_ _null_ pg_create_logical_replication_slot _null_ _null_ _null_ ));
DESCR("set up a logical replication slot");
DATA(insert OID = 3782 ( pg_logical_slot_get_changes PGNSP PGUID 12 1000 1000 25 0 f f f f f t v u 4 0 2249 "19 3220 23 1009" "{19,3220,23,1009,3220,28,25}" "{i,i,i,v,o,o,o}" "{slot_name,upto_lsn,upto_nchanges,options,location,xid,data}" _null_ _null_ pg_logical_slot_get_changes _null_ _null_ _null_ ));
DESCR("get changes from replication slot");
qq{SELECT ts.* FROM pg_class, pg_xact_commit_timestamp(xmin) AS ts WHERE relname = 't10'}
);
my $master_lsn =
- $master->safe_psql('postgres', 'select pg_current_xlog_location()');
+ $master->safe_psql('postgres', 'select pg_current_wal_location()');
$standby->poll_query_until('postgres',
- qq{SELECT '$master_lsn'::pg_lsn <= pg_last_xlog_replay_location()})
+ qq{SELECT '$master_lsn'::pg_lsn <= pg_last_wal_replay_location()})
or die "slave never caught up";
my $standby_ts = $standby->safe_psql('postgres',
$master->restart;
$master->safe_psql('postgres', 'checkpoint');
$master_lsn =
- $master->safe_psql('postgres', 'select pg_current_xlog_location()');
+ $master->safe_psql('postgres', 'select pg_current_wal_location()');
$standby->poll_query_until('postgres',
- qq{SELECT '$master_lsn'::pg_lsn <= pg_last_xlog_replay_location()})
+ qq{SELECT '$master_lsn'::pg_lsn <= pg_last_wal_replay_location()})
or die "slave never caught up";
$standby->safe_psql('postgres', 'checkpoint');
$master->restart;
$master->safe_psql('postgres', 'checkpoint');
my $master_lsn =
- $master->safe_psql('postgres', 'select pg_current_xlog_location()');
+ $master->safe_psql('postgres', 'select pg_current_wal_location()');
$standby->poll_query_until('postgres',
- qq{SELECT '$master_lsn'::pg_lsn <= pg_last_xlog_replay_location()})
+ qq{SELECT '$master_lsn'::pg_lsn <= pg_last_wal_replay_location()})
or die "slave never caught up";
$standby->safe_psql('postgres', 'checkpoint');
sub lsn
{
my ($self, $mode) = @_;
- my %modes = ('insert' => 'pg_current_xlog_insert_location()',
- 'flush' => 'pg_current_xlog_flush_location()',
- 'write' => 'pg_current_xlog_location()',
- 'receive' => 'pg_last_xlog_receive_location()',
- 'replay' => 'pg_last_xlog_replay_location()');
+ my %modes = ('insert' => 'pg_current_wal_insert_location()',
+ 'flush' => 'pg_current_wal_flush_location()',
+ 'write' => 'pg_current_wal_location()',
+ 'receive' => 'pg_last_wal_receive_location()',
+ 'replay' => 'pg_last_wal_replay_location()');
$mode = '<undef>' if !defined($mode);
die "unknown mode for 'lsn': '$mode', valid modes are " . join(', ', keys %modes)
$node_master->safe_psql('postgres',
"CREATE TABLE tab_int AS SELECT generate_series(1,1000) AS a");
my $current_lsn =
- $node_master->safe_psql('postgres', "SELECT pg_current_xlog_location();");
+ $node_master->safe_psql('postgres', "SELECT pg_current_wal_location();");
# Force archiving of WAL file to make it present on master
-$node_master->safe_psql('postgres', "SELECT pg_switch_xlog()");
+$node_master->safe_psql('postgres', "SELECT pg_switch_wal()");
# Add some more content, it should not be present on standby
$node_master->safe_psql('postgres',
# Wait until necessary replay has been done on standby
my $caughtup_query =
- "SELECT '$current_lsn'::pg_lsn <= pg_last_xlog_replay_location()";
+ "SELECT '$current_lsn'::pg_lsn <= pg_last_wal_replay_location()";
$node_standby->poll_query_until('postgres', $caughtup_query)
or die "Timed out while waiting for standby to catch up";
# Wait until standby has replayed enough data
my $caughtup_query =
- "SELECT '$until_lsn'::pg_lsn <= pg_last_xlog_replay_location()";
+ "SELECT '$until_lsn'::pg_lsn <= pg_last_wal_replay_location()";
$node_standby->poll_query_until('postgres', $caughtup_query)
or die "Timed out while waiting for standby to catch up";
$node_master->safe_psql('postgres',
"CREATE TABLE tab_int AS SELECT generate_series(1,1000) AS a");
my $lsn1 =
- $node_master->safe_psql('postgres', "SELECT pg_current_xlog_location();");
+ $node_master->safe_psql('postgres', "SELECT pg_current_wal_location();");
# Take backup from which all operations will be run
$node_master->backup('my_backup');
$node_master->safe_psql('postgres',
"INSERT INTO tab_int VALUES (generate_series(1001,2000))");
my $ret = $node_master->safe_psql('postgres',
- "SELECT pg_current_xlog_location(), txid_current();");
+ "SELECT pg_current_wal_location(), txid_current();");
my ($lsn2, $recovery_txid) = split /\|/, $ret;
# More data, with recovery target timestamp
$node_master->safe_psql('postgres',
"INSERT INTO tab_int VALUES (generate_series(2001,3000))");
$ret = $node_master->safe_psql('postgres',
- "SELECT pg_current_xlog_location(), now();");
+ "SELECT pg_current_wal_location(), now();");
my ($lsn3, $recovery_time) = split /\|/, $ret;
# Even more data, this time with a recovery target name
"INSERT INTO tab_int VALUES (generate_series(3001,4000))");
my $recovery_name = "my_target";
my $lsn4 =
- $node_master->safe_psql('postgres', "SELECT pg_current_xlog_location();");
+ $node_master->safe_psql('postgres', "SELECT pg_current_wal_location();");
$node_master->safe_psql('postgres',
"SELECT pg_create_restore_point('$recovery_name');");
# And now for a recovery target LSN
$node_master->safe_psql('postgres',
"INSERT INTO tab_int VALUES (generate_series(4001,5000))");
-my $recovery_lsn = $node_master->safe_psql('postgres', "SELECT pg_current_xlog_location()");
+my $recovery_lsn = $node_master->safe_psql('postgres', "SELECT pg_current_wal_location()");
my $lsn5 =
- $node_master->safe_psql('postgres', "SELECT pg_current_xlog_location();");
+ $node_master->safe_psql('postgres', "SELECT pg_current_wal_location();");
$node_master->safe_psql('postgres',
"INSERT INTO tab_int VALUES (generate_series(5001,6000))");
# Force archiving of WAL file
-$node_master->safe_psql('postgres', "SELECT pg_switch_xlog()");
+$node_master->safe_psql('postgres', "SELECT pg_switch_wal()");
# Test recovery targets
my @recovery_params = ("recovery_target = 'immediate'");
# Now wait for replay to complete on standby. We're done waiting when the
# slave has replayed up to the previously saved master LSN.
my $until_lsn =
- $node_master->safe_psql('postgres', "SELECT pg_current_xlog_location()");
+ $node_master->safe_psql('postgres', "SELECT pg_current_wal_location()");
my $remaining = 90;
while ($remaining-- > 0)
# Done waiting?
my $replay_status = $node_standby->safe_psql('postgres',
- "SELECT (pg_last_xlog_replay_location() - '$until_lsn'::pg_lsn) >= 0"
+ "SELECT (pg_last_wal_replay_location() - '$until_lsn'::pg_lsn) >= 0"
);
last if $replay_status eq 't';
$node_master->psql('postgres', 'checkpoint');
my $until_lsn =
- $node_master->safe_psql('postgres', "SELECT pg_current_xlog_location();");
+ $node_master->safe_psql('postgres', "SELECT pg_current_wal_location();");
# Wait long enough for standby to receive and apply all WAL
my $caughtup_query =
- "SELECT '$until_lsn'::pg_lsn <= pg_last_xlog_replay_location()";
+ "SELECT '$until_lsn'::pg_lsn <= pg_last_wal_replay_location()";
$node_standby->poll_query_until('postgres', $caughtup_query)
or die "Timed out while waiting for standby to catch up";
select pg_start_backup('should fail');
ERROR: recovery is in progress
HINT: WAL control functions cannot be executed during recovery.
-select pg_switch_xlog();
+select pg_switch_wal();
ERROR: recovery is in progress
HINT: WAL control functions cannot be executed during recovery.
select pg_stop_backup();
COMMIT;
SELECT hs_locks_drop(257);
-SELECT pg_switch_xlog();
+SELECT pg_switch_wal();
DROP sequence if exists hsseq;
create sequence hsseq;
-SELECT pg_switch_xlog();
+SELECT pg_switch_wal();
select length(txid_current_snapshot()::text) >= 4;
select pg_start_backup('should fail');
-select pg_switch_xlog();
+select pg_switch_wal();
select pg_stop_backup();
-- should return no rows
# Wait for subscriber to finish initialization
my $caughtup_query =
-"SELECT pg_current_xlog_location() <= replay_location FROM pg_stat_replication WHERE application_name = '$appname';";
+"SELECT pg_current_wal_location() <= replay_location FROM pg_stat_replication WHERE application_name = '$appname';";
$node_publisher->poll_query_until('postgres', $caughtup_query)
or die "Timed out while waiting for subscriber to catch up";
# Wait for subscriber to finish initialization
my $caughtup_query =
-"SELECT pg_current_xlog_location() <= replay_location FROM pg_stat_replication WHERE application_name = '$appname';";
+"SELECT pg_current_wal_location() <= replay_location FROM pg_stat_replication WHERE application_name = '$appname';";
$node_publisher->poll_query_until('postgres', $caughtup_query)
or die "Timed out while waiting for subscriber to catch up";