diff --git a/contrib/bloom/t/001_wal.pl b/contrib/bloom/t/001_wal.pl index dc907ba..dbba198 100644 --- a/contrib/bloom/t/001_wal.pl +++ b/contrib/bloom/t/001_wal.pl @@ -16,7 +16,7 @@ sub test_index_replay # Wait for standby to catch up my $applname = $node_standby->name; my $caughtup_query = -"SELECT pg_current_wal_location() <= write_location FROM pg_stat_replication WHERE application_name = '$applname';"; +"SELECT pg_current_wal_lsn() <= write_lsn 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"; diff --git a/contrib/test_decoding/expected/ddl.out b/contrib/test_decoding/expected/ddl.out index 275c84a..1e22c1e 100644 --- a/contrib/test_decoding/expected/ddl.out +++ b/contrib/test_decoding/expected/ddl.out @@ -58,7 +58,7 @@ SELECT 'init' FROM pg_create_logical_replication_slot('regression_slot', 'test_d 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_wal_location_diff(restart_lsn, '0/01000000') > 0 AS some_wal + pg_wal_lsn_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 -----------------+---------------+-----------+--------+------------------+-------------------+---------- diff --git a/contrib/test_decoding/sql/ddl.sql b/contrib/test_decoding/sql/ddl.sql index 49dad39..057dae0 100644 --- a/contrib/test_decoding/sql/ddl.sql +++ b/contrib/test_decoding/sql/ddl.sql @@ -29,7 +29,7 @@ SELECT 'init' FROM pg_create_logical_replication_slot('regression_slot', 'test_d 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_wal_location_diff(restart_lsn, '0/01000000') > 0 AS some_wal + pg_wal_lsn_diff(restart_lsn, '0/01000000') > 0 AS some_wal FROM pg_replication_slots; /* diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml index f06d0a9..f9d0452 100644 --- a/doc/src/sgml/func.sgml +++ b/doc/src/sgml/func.sgml @@ -17890,17 +17890,17 @@ SELECT collation for ('foo' COLLATE "de_DE"); - checkpoint_location + checkpoint_lsn pg_lsn - prior_location + prior_lsn pg_lsn - redo_location + redo_lsn pg_lsn @@ -18128,7 +18128,7 @@ SELECT collation for ('foo' COLLATE "de_DE"); - min_recovery_end_location + min_recovery_end_lsn pg_lsn @@ -18138,12 +18138,12 @@ SELECT collation for ('foo' COLLATE "de_DE"); - backup_start_location + backup_start_lsn pg_lsn - backup_end_location + backup_end_lsn pg_lsn @@ -18386,13 +18386,13 @@ SELECT set_config('log_statement_stats', 'off', false); pg_create_restore_point - pg_current_wal_flush_location + pg_current_wal_flush_lsn - pg_current_wal_insert_location + pg_current_wal_insert_lsn - pg_current_wal_location + pg_current_wal_lsn pg_start_backup @@ -18416,7 +18416,7 @@ SELECT set_config('log_statement_stats', 'off', false); pg_walfile_name_offset - pg_wal_location_diff + pg_wal_lsn_diff @@ -18424,7 +18424,7 @@ SELECT set_config('log_statement_stats', 'off', false); linkend="functions-admin-backup-table"> assist in making on-line backups. These functions cannot be executed during recovery (except pg_is_in_backup, pg_backup_start_time - and pg_wal_location_diff). + and pg_wal_lsn_diff). @@ -18445,21 +18445,21 @@ SELECT set_config('log_statement_stats', 'off', false); - pg_current_wal_flush_location() + pg_current_wal_flush_lsn() pg_lsn Get current transaction log flush location - pg_current_wal_insert_location() + pg_current_wal_insert_lsn() pg_lsn Get current transaction log insert location - pg_current_wal_location() + pg_current_wal_lsn() pg_lsn Get current transaction log write location @@ -18508,21 +18508,21 @@ SELECT set_config('log_statement_stats', 'off', false); - pg_walfile_name(location pg_lsn) + pg_walfile_name(lsn pg_lsn) text - Convert transaction log location string to file name + Convert transaction log location to file name - pg_walfile_name_offset(location pg_lsn) + pg_walfile_name_offset(lsn pg_lsn) text, integer - Convert transaction log location string to file name and decimal byte offset within file + Convert transaction log location to file name and decimal byte offset within file - pg_wal_location_diff(location pg_lsn, location pg_lsn) + pg_wal_lsn_diff(lsn pg_lsn, lsn pg_lsn) numeric Calculate the difference between two transaction log locations @@ -18605,10 +18605,10 @@ postgres=# select pg_start_backup('label_goes_here'); - pg_current_wal_location displays the current transaction log write + pg_current_wal_lsn displays the current transaction log write location in the same format used by the above functions. Similarly, - pg_current_wal_insert_location displays the current transaction log - insertion point and pg_current_wal_flush_location displays the + pg_current_wal_insert_lsn displays the current transaction log + insertion point and pg_current_wal_flush_lsn displays the current transaction log flush point. The insertion point is the 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 @@ -18640,7 +18640,7 @@ postgres=# SELECT * FROM pg_walfile_name_offset(pg_stop_backup()); - pg_wal_location_diff calculates the difference in bytes + pg_wal_lsn_diff calculates the difference in bytes between two transaction log locations. It can be used with pg_stat_replication or some functions shown in to get the replication lag. @@ -18660,10 +18660,10 @@ postgres=# SELECT * FROM pg_walfile_name_offset(pg_stop_backup()); pg_is_in_recovery - pg_last_wal_receive_location + pg_last_wal_receive_lsn - pg_last_wal_replay_location + pg_last_wal_replay_lsn pg_last_xact_replay_timestamp @@ -18695,7 +18695,7 @@ postgres=# SELECT * FROM pg_walfile_name_offset(pg_stop_backup()); - pg_last_wal_receive_location() + pg_last_wal_receive_lsn() pg_lsn Get last transaction log location received and synced to disk by @@ -18709,7 +18709,7 @@ postgres=# SELECT * FROM pg_walfile_name_offset(pg_stop_backup()); - pg_last_wal_replay_location() + pg_last_wal_replay_lsn() pg_lsn Get last transaction log location replayed during recovery. @@ -18932,7 +18932,7 @@ postgres=# SELECT * FROM pg_walfile_name_offset(pg_stop_backup()); pg_create_physical_replication_slot(slot_name name , immediately_reserve boolean, temporary boolean) - (slot_name name, wal_position pg_lsn) + (slot_name name, lsn pg_lsn) Creates a new physical replication slot named @@ -18977,7 +18977,7 @@ postgres=# SELECT * FROM pg_walfile_name_offset(pg_stop_backup()); pg_create_logical_replication_slot(slot_name name, plugin name , temporary boolean) - (slot_name name, wal_position pg_lsn) + (slot_name name, lsn pg_lsn) Creates a new logical (decoding) replication slot named @@ -19000,7 +19000,7 @@ postgres=# SELECT * FROM pg_walfile_name_offset(pg_stop_backup()); pg_logical_slot_get_changes(slot_name name, upto_lsn pg_lsn, upto_nchanges int, VARIADIC options text[]) - (location pg_lsn, xid xid, data text) + (lsn pg_lsn, xid xid, data text) Returns changes in the slot slot_name, starting @@ -19025,7 +19025,7 @@ postgres=# SELECT * FROM pg_walfile_name_offset(pg_stop_backup()); pg_logical_slot_peek_changes(slot_name name, upto_lsn pg_lsn, upto_nchanges int, VARIADIC options text[]) - (location text, xid xid, data text) + (lsn pg_lsn, xid xid, data text) Behaves just like @@ -19043,7 +19043,7 @@ postgres=# SELECT * FROM pg_walfile_name_offset(pg_stop_backup()); pg_logical_slot_get_binary_changes(slot_name name, upto_lsn pg_lsn, upto_nchanges int, VARIADIC options text[]) - (location pg_lsn, xid xid, data bytea) + (lsn pg_lsn, xid xid, data bytea) Behaves just like @@ -19060,7 +19060,7 @@ postgres=# SELECT * FROM pg_walfile_name_offset(pg_stop_backup()); pg_logical_slot_peek_binary_changes(slot_name name, upto_lsn pg_lsn, upto_nchanges int, VARIADIC options text[]) - (location pg_lsn, xid xid, data bytea) + (lsn pg_lsn, xid xid, data bytea) Behaves just like @@ -19179,7 +19179,7 @@ postgres=# SELECT * FROM pg_walfile_name_offset(pg_stop_backup()); pg_lsn - Return the replay position for the replication origin configured in + Return the replay location for the replication origin configured in the current session. The parameter flush determines whether the corresponding local transaction will be guaranteed to have been flushed to disk or not. @@ -19226,15 +19226,15 @@ postgres=# SELECT * FROM pg_walfile_name_offset(pg_stop_backup()); pg_replication_origin_advance - pg_replication_origin_advance(node_name text, pos pg_lsn) + pg_replication_origin_advance(node_name text, lsn pg_lsn) void Set replication progress for the given node to the given - position. This primarily is useful for setting up the initial position - or a new position after configuration changes and similar. Be aware + location. This primarily is useful for setting up the initial location + or a new location after configuration changes and similar. Be aware that careless use of this function can lead to inconsistently replicated data. @@ -19251,7 +19251,7 @@ postgres=# SELECT * FROM pg_walfile_name_offset(pg_stop_backup()); pg_lsn - Return the replay position for the given replication origin. The + Return the replay location for the given replication origin. The parameter flush determines whether the corresponding local transaction will be guaranteed to have been flushed to disk or not. diff --git a/doc/src/sgml/high-availability.sgml b/doc/src/sgml/high-availability.sgml index 9e2be5f..c5e3a08 100644 --- a/doc/src/sgml/high-availability.sgml +++ b/doc/src/sgml/high-availability.sgml @@ -851,8 +851,8 @@ primary_conninfo = 'host=192.168.1.50 port=5432 user=foo password=foopass' 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 - pg_current_wal_location on the primary and the - pg_last_wal_receive_location on the standby, + pg_current_wal_lsn on the primary and the + pg_last_wal_receive_lsn on the standby, respectively (see and for details). The last WAL receive location in the standby is also displayed in the @@ -863,10 +863,10 @@ primary_conninfo = 'host=192.168.1.50 port=5432 user=foo password=foopass' You can retrieve a list of WAL sender processes via the pg_stat_replication view. Large differences between - pg_current_wal_location and sent_location field + pg_current_wal_lsn and sent_lsn field might indicate that the master server is under heavy load, while - differences between sent_location and - pg_last_wal_receive_location on the standby might indicate + differences between sent_lsn and + pg_last_wal_receive_lsn on the standby might indicate network delay, or that the standby is under heavy load. @@ -927,8 +927,8 @@ primary_conninfo = 'host=192.168.1.50 port=5432 user=foo password=foopass' You can create a replication slot like this: postgres=# SELECT * FROM pg_create_physical_replication_slot('node_a_slot'); - slot_name | wal_position --------------+--------------- + slot_name | lsn +-------------+----- node_a_slot | postgres=# SELECT * FROM pg_replication_slots; diff --git a/doc/src/sgml/logicaldecoding.sgml b/doc/src/sgml/logicaldecoding.sgml index bb22f9a..2683e2e 100644 --- a/doc/src/sgml/logicaldecoding.sgml +++ b/doc/src/sgml/logicaldecoding.sgml @@ -56,8 +56,8 @@ 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 | wal_position ------------------+--------------- + slot_name | lsn +-----------------+----------- regression_slot | 0/16B1970 (1 row) diff --git a/doc/src/sgml/monitoring.sgml b/doc/src/sgml/monitoring.sgml index 2a83671..65d3086 100644 --- a/doc/src/sgml/monitoring.sgml +++ b/doc/src/sgml/monitoring.sgml @@ -1694,26 +1694,26 @@ SELECT pid, wait_event_type, wait_event FROM pg_stat_activity WHERE wait_event i - sent_location + sent_lsn pg_lsn - Last transaction log position sent on this connection + Last transaction log location sent on this connection - write_location + write_lsn pg_lsn - Last transaction log position written to disk by this standby + Last transaction log location written to disk by this standby server - flush_location + flush_lsn pg_lsn - Last transaction log position flushed to disk by this standby + Last transaction log location flushed to disk by this standby server - replay_location + replay_lsn pg_lsn - Last transaction log position replayed into the database on this + Last transaction log location replayed into the database on this standby server diff --git a/src/backend/access/transam/xlogfuncs.c b/src/backend/access/transam/xlogfuncs.c index 5041f0e..aa47b0d 100644 --- a/src/backend/access/transam/xlogfuncs.c +++ b/src/backend/access/transam/xlogfuncs.c @@ -351,7 +351,7 @@ pg_create_restore_point(PG_FUNCTION_ARGS) * to the kernel, but is not necessarily synced to disk. */ Datum -pg_current_wal_location(PG_FUNCTION_ARGS) +pg_current_wal_lsn(PG_FUNCTION_ARGS) { XLogRecPtr current_recptr; @@ -372,7 +372,7 @@ pg_current_wal_location(PG_FUNCTION_ARGS) * This function is mostly for debugging purposes. */ Datum -pg_current_wal_insert_location(PG_FUNCTION_ARGS) +pg_current_wal_insert_lsn(PG_FUNCTION_ARGS) { XLogRecPtr current_recptr; @@ -393,7 +393,7 @@ pg_current_wal_insert_location(PG_FUNCTION_ARGS) * This function is mostly for debugging purposes. */ Datum -pg_current_wal_flush_location(PG_FUNCTION_ARGS) +pg_current_wal_flush_lsn(PG_FUNCTION_ARGS) { XLogRecPtr current_recptr; @@ -415,7 +415,7 @@ pg_current_wal_flush_location(PG_FUNCTION_ARGS) * and synced to disk by walreceiver. */ Datum -pg_last_wal_receive_location(PG_FUNCTION_ARGS) +pg_last_wal_receive_lsn(PG_FUNCTION_ARGS) { XLogRecPtr recptr; @@ -434,7 +434,7 @@ pg_last_wal_receive_location(PG_FUNCTION_ARGS) * connections during recovery. */ Datum -pg_last_wal_replay_location(PG_FUNCTION_ARGS) +pg_last_wal_replay_lsn(PG_FUNCTION_ARGS) { XLogRecPtr recptr; @@ -621,7 +621,7 @@ pg_is_in_recovery(PG_FUNCTION_ARGS) * Compute the difference in bytes between two WAL locations. */ Datum -pg_wal_location_diff(PG_FUNCTION_ARGS) +pg_wal_lsn_diff(PG_FUNCTION_ARGS) { Datum result; diff --git a/src/backend/catalog/system_views.sql b/src/backend/catalog/system_views.sql index 421d51d..3040990 100644 --- a/src/backend/catalog/system_views.sql +++ b/src/backend/catalog/system_views.sql @@ -724,10 +724,10 @@ CREATE VIEW pg_stat_replication AS S.backend_start, S.backend_xmin, W.state, - W.sent_location, - W.write_location, - W.flush_location, - W.replay_location, + W.sent_lsn, + W.write_lsn, + W.flush_lsn, + W.replay_lsn, W.write_lag, W.flush_lag, W.replay_lag, @@ -1033,7 +1033,7 @@ CREATE OR REPLACE FUNCTION CREATE OR REPLACE FUNCTION pg_logical_slot_get_changes( IN slot_name name, IN upto_lsn pg_lsn, IN upto_nchanges int, VARIADIC options text[] DEFAULT '{}', - OUT location pg_lsn, OUT xid xid, OUT data text) + OUT lsn pg_lsn, OUT xid xid, OUT data text) RETURNS SETOF RECORD LANGUAGE INTERNAL VOLATILE ROWS 1000 COST 1000 @@ -1041,7 +1041,7 @@ AS 'pg_logical_slot_get_changes'; CREATE OR REPLACE FUNCTION pg_logical_slot_peek_changes( IN slot_name name, IN upto_lsn pg_lsn, IN upto_nchanges int, VARIADIC options text[] DEFAULT '{}', - OUT location pg_lsn, OUT xid xid, OUT data text) + OUT lsn pg_lsn, OUT xid xid, OUT data text) RETURNS SETOF RECORD LANGUAGE INTERNAL VOLATILE ROWS 1000 COST 1000 @@ -1049,7 +1049,7 @@ AS 'pg_logical_slot_peek_changes'; CREATE OR REPLACE FUNCTION pg_logical_slot_get_binary_changes( IN slot_name name, IN upto_lsn pg_lsn, IN upto_nchanges int, VARIADIC options text[] DEFAULT '{}', - OUT location pg_lsn, OUT xid xid, OUT data bytea) + OUT lsn pg_lsn, OUT xid xid, OUT data bytea) RETURNS SETOF RECORD LANGUAGE INTERNAL VOLATILE ROWS 1000 COST 1000 @@ -1057,7 +1057,7 @@ AS 'pg_logical_slot_get_binary_changes'; CREATE OR REPLACE FUNCTION pg_logical_slot_peek_binary_changes( IN slot_name name, IN upto_lsn pg_lsn, IN upto_nchanges int, VARIADIC options text[] DEFAULT '{}', - OUT location pg_lsn, OUT xid xid, OUT data bytea) + OUT lsn pg_lsn, OUT xid xid, OUT data bytea) RETURNS SETOF RECORD LANGUAGE INTERNAL VOLATILE ROWS 1000 COST 1000 @@ -1066,7 +1066,7 @@ AS 'pg_logical_slot_peek_binary_changes'; 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 wal_position pg_lsn) + OUT slot_name name, OUT lsn pg_lsn) RETURNS RECORD LANGUAGE INTERNAL STRICT VOLATILE @@ -1075,7 +1075,7 @@ AS 'pg_create_physical_replication_slot'; 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 wal_position pg_lsn) + OUT slot_name text, OUT lsn pg_lsn) RETURNS RECORD LANGUAGE INTERNAL STRICT VOLATILE diff --git a/src/backend/utils/misc/pg_controldata.c b/src/backend/utils/misc/pg_controldata.c index d845411..56ba301 100644 --- a/src/backend/utils/misc/pg_controldata.c +++ b/src/backend/utils/misc/pg_controldata.c @@ -91,11 +91,11 @@ pg_control_checkpoint(PG_FUNCTION_ARGS) * function's pg_proc entry! */ tupdesc = CreateTemplateTupleDesc(19, false); - TupleDescInitEntry(tupdesc, (AttrNumber) 1, "checkpoint_location", + TupleDescInitEntry(tupdesc, (AttrNumber) 1, "checkpoint_lsn", LSNOID, -1, 0); - TupleDescInitEntry(tupdesc, (AttrNumber) 2, "prior_location", + TupleDescInitEntry(tupdesc, (AttrNumber) 2, "prior_lsn", LSNOID, -1, 0); - TupleDescInitEntry(tupdesc, (AttrNumber) 3, "redo_location", + TupleDescInitEntry(tupdesc, (AttrNumber) 3, "redo_lsn", LSNOID, -1, 0); TupleDescInitEntry(tupdesc, (AttrNumber) 4, "redo_wal_file", TEXTOID, -1, 0); @@ -225,13 +225,13 @@ pg_control_recovery(PG_FUNCTION_ARGS) * function's pg_proc entry! */ tupdesc = CreateTemplateTupleDesc(5, false); - TupleDescInitEntry(tupdesc, (AttrNumber) 1, "min_recovery_end_location", + TupleDescInitEntry(tupdesc, (AttrNumber) 1, "min_recovery_end_lsn", LSNOID, -1, 0); TupleDescInitEntry(tupdesc, (AttrNumber) 2, "min_recovery_end_timeline", INT4OID, -1, 0); - TupleDescInitEntry(tupdesc, (AttrNumber) 3, "backup_start_location", + TupleDescInitEntry(tupdesc, (AttrNumber) 3, "backup_start_lsn", LSNOID, -1, 0); - TupleDescInitEntry(tupdesc, (AttrNumber) 4, "backup_end_location", + TupleDescInitEntry(tupdesc, (AttrNumber) 4, "backup_end_lsn", LSNOID, -1, 0); TupleDescInitEntry(tupdesc, (AttrNumber) 5, "end_of_backup_record_required", BOOLOID, -1, 0); diff --git a/src/bin/pg_basebackup/t/030_pg_recvlogical.pl b/src/bin/pg_basebackup/t/030_pg_recvlogical.pl index 3e66f70..c036f4b 100644 --- a/src/bin/pg_basebackup/t/030_pg_recvlogical.pl +++ b/src/bin/pg_basebackup/t/030_pg_recvlogical.pl @@ -39,7 +39,7 @@ isnt($slot->{'restart_lsn'}, '', 'restart lsn is defined for new slot'); $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_wal_insert_location()'); +my $nextlsn = $node->safe_psql('postgres', 'SELECT pg_current_wal_insert_lsn()'); chomp($nextlsn); $node->command_ok(['pg_recvlogical', '-S', 'test', '-d', $node->connstr('postgres'), '--start', '--endpos', "$nextlsn", '--no-loop', '-f', '-'], diff --git a/src/bin/pg_rewind/RewindTest.pm b/src/bin/pg_rewind/RewindTest.pm index c67212f..39a559e 100644 --- a/src/bin/pg_rewind/RewindTest.pm +++ b/src/bin/pg_rewind/RewindTest.pm @@ -156,7 +156,7 @@ sub promote_standby # Wait for the standby to receive and write all WAL. my $wal_received_query = -"SELECT pg_current_wal_location() = write_location FROM pg_stat_replication WHERE application_name = 'rewind_standby';"; +"SELECT pg_current_wal_lsn() = write_lsn 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"; diff --git a/src/bin/pg_rewind/libpq_fetch.c b/src/bin/pg_rewind/libpq_fetch.c index eb74d2f..c25367f 100644 --- a/src/bin/pg_rewind/libpq_fetch.c +++ b/src/bin/pg_rewind/libpq_fetch.c @@ -120,7 +120,7 @@ run_simple_query(const char *sql) } /* - * Calls pg_current_wal_insert_location() function + * Calls pg_current_wal_insert_lsn() function */ XLogRecPtr libpqGetCurrentXlogInsertLocation(void) @@ -130,7 +130,7 @@ libpqGetCurrentXlogInsertLocation(void) uint32 lo; char *val; - val = run_simple_query("SELECT pg_current_wal_insert_location()"); + val = run_simple_query("SELECT pg_current_wal_insert_lsn()"); if (sscanf(val, "%X/%X", &hi, &lo) != 2) pg_fatal("unrecognized result \"%s\" for current WAL insert location\n", val); diff --git a/src/include/catalog/pg_proc.h b/src/include/catalog/pg_proc.h index 82562ad..77d8ed5 100644 --- a/src/include/catalog/pg_proc.h +++ b/src/include/catalog/pg_proc.h @@ -2830,7 +2830,7 @@ DATA(insert OID = 2022 ( pg_stat_get_activity PGNSP PGUID 12 1 100 0 0 f f f DESCR("statistics: information about currently active backends"); DATA(insert OID = 3318 ( pg_stat_get_progress_info PGNSP PGUID 12 1 100 0 0 f f f f t t s r 1 0 2249 "25" "{25,23,26,26,20,20,20,20,20,20,20,20,20,20}" "{i,o,o,o,o,o,o,o,o,o,o,o,o,o}" "{cmdtype,pid,datid,relid,param1,param2,param3,param4,param5,param6,param7,param8,param9,param10}" _null_ _null_ pg_stat_get_progress_info _null_ _null_ _null_ )); DESCR("statistics: information about progress of backends running maintenance command"); -DATA(insert OID = 3099 ( pg_stat_get_wal_senders PGNSP PGUID 12 1 10 0 0 f f f f f t s r 0 0 2249 "" "{23,25,3220,3220,3220,3220,1186,1186,1186,23,25}" "{o,o,o,o,o,o,o,o,o,o,o}" "{pid,state,sent_location,write_location,flush_location,replay_location,write_lag,flush_lag,replay_lag,sync_priority,sync_state}" _null_ _null_ pg_stat_get_wal_senders _null_ _null_ _null_ )); +DATA(insert OID = 3099 ( pg_stat_get_wal_senders PGNSP PGUID 12 1 10 0 0 f f f f f t s r 0 0 2249 "" "{23,25,3220,3220,3220,3220,1186,1186,1186,23,25}" "{o,o,o,o,o,o,o,o,o,o,o}" "{pid,state,sent_lsn,write_lsn,flush_lsn,replay_lsn,write_lag,flush_lag,replay_lag,sync_priority,sync_state}" _null_ _null_ pg_stat_get_wal_senders _null_ _null_ _null_ )); DESCR("statistics: information about currently active replication"); DATA(insert OID = 3317 ( pg_stat_get_wal_receiver PGNSP PGUID 12 1 0 0 0 f f f f f f s r 0 0 2249 "" "{23,25,3220,23,3220,23,1184,1184,3220,1184,25,25}" "{o,o,o,o,o,o,o,o,o,o,o,o}" "{pid,status,receive_start_lsn,receive_start_tli,received_lsn,received_tli,last_msg_send_time,last_msg_receipt_time,latest_end_lsn,latest_end_time,slot_name,conninfo}" _null_ _null_ pg_stat_get_wal_receiver _null_ _null_ _null_ )); DESCR("statistics: information about WAL receiver"); @@ -3215,18 +3215,18 @@ DATA(insert OID = 2848 ( pg_switch_wal PGNSP PGUID 12 1 0 0 0 f f f f t f v s 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_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_ )); +DATA(insert OID = 2849 ( pg_current_wal_lsn 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_lsn _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_ )); +DATA(insert OID = 2852 ( pg_current_wal_insert_lsn 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_lsn _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_ )); +DATA(insert OID = 3330 ( pg_current_wal_flush_lsn 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_lsn _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_ )); +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}" "{lsn,file_name,file_offset}" _null_ _null_ pg_walfile_name_offset _null_ _null_ _null_ )); DESCR("wal filename and byte offset, given a 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 a 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_ )); +DATA(insert OID = 3165 ( pg_wal_lsn_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_lsn_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_ )); @@ -3235,9 +3235,9 @@ 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_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_ )); +DATA(insert OID = 3820 ( pg_last_wal_receive_lsn 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_lsn _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_ )); +DATA(insert OID = 3821 ( pg_last_wal_replay_lsn 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_lsn _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"); @@ -5285,21 +5285,21 @@ DATA(insert OID = 5016 ( spg_box_quad_leaf_consistent PGNSP PGUID 12 1 0 0 0 f 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,wal_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,lsn}" _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,wal_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,lsn}" _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_ )); +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,lsn,xid,data}" _null_ _null_ pg_logical_slot_get_changes _null_ _null_ _null_ )); DESCR("get changes from replication slot"); -DATA(insert OID = 3783 ( pg_logical_slot_get_binary_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,17}" "{i,i,i,v,o,o,o}" "{slot_name,upto_lsn,upto_nchanges,options,location,xid,data}" _null_ _null_ pg_logical_slot_get_binary_changes _null_ _null_ _null_ )); +DATA(insert OID = 3783 ( pg_logical_slot_get_binary_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,17}" "{i,i,i,v,o,o,o}" "{slot_name,upto_lsn,upto_nchanges,options,lsn,xid,data}" _null_ _null_ pg_logical_slot_get_binary_changes _null_ _null_ _null_ )); DESCR("get binary changes from replication slot"); -DATA(insert OID = 3784 ( pg_logical_slot_peek_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_peek_changes _null_ _null_ _null_ )); +DATA(insert OID = 3784 ( pg_logical_slot_peek_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,lsn,xid,data}" _null_ _null_ pg_logical_slot_peek_changes _null_ _null_ _null_ )); DESCR("peek at changes from replication slot"); -DATA(insert OID = 3785 ( pg_logical_slot_peek_binary_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,17}" "{i,i,i,v,o,o,o}" "{slot_name,upto_lsn,upto_nchanges,options,location,xid,data}" _null_ _null_ pg_logical_slot_peek_binary_changes _null_ _null_ _null_ )); +DATA(insert OID = 3785 ( pg_logical_slot_peek_binary_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,17}" "{i,i,i,v,o,o,o}" "{slot_name,upto_lsn,upto_nchanges,options,lsn,xid,data}" _null_ _null_ pg_logical_slot_peek_binary_changes _null_ _null_ _null_ )); DESCR("peek at binary changes from replication slot"); DATA(insert OID = 3577 ( pg_logical_emit_message PGNSP PGUID 12 1 0 0 0 f f f f t f v u 3 0 3220 "16 25 25" _null_ _null_ _null_ _null_ _null_ pg_logical_emit_message_text _null_ _null_ _null_ )); DESCR("emit a textual logical decoding message"); @@ -5447,10 +5447,10 @@ DESCR("pg_config binary as a function"); DATA(insert OID = 3441 ( pg_control_system PGNSP PGUID 12 1 0 0 0 f f f f t f v s 0 0 2249 "" "{23,23,20,1184}" "{o,o,o,o}" "{pg_control_version,catalog_version_no,system_identifier,pg_control_last_modified}" _null_ _null_ pg_control_system _null_ _null_ _null_ )); DESCR("pg_controldata general state information as a function"); -DATA(insert OID = 3442 ( pg_control_checkpoint PGNSP PGUID 12 1 0 0 0 f f f f t f v s 0 0 2249 "" "{3220,3220,3220,25,23,23,16,25,26,28,28,28,26,28,28,26,28,28,1184}" "{o,o,o,o,o,o,o,o,o,o,o,o,o,o,o,o,o,o,o}" "{checkpoint_location,prior_location,redo_location,redo_wal_file,timeline_id,prev_timeline_id,full_page_writes,next_xid,next_oid,next_multixact_id,next_multi_offset,oldest_xid,oldest_xid_dbid,oldest_active_xid,oldest_multi_xid,oldest_multi_dbid,oldest_commit_ts_xid,newest_commit_ts_xid,checkpoint_time}" _null_ _null_ pg_control_checkpoint _null_ _null_ _null_ )); +DATA(insert OID = 3442 ( pg_control_checkpoint PGNSP PGUID 12 1 0 0 0 f f f f t f v s 0 0 2249 "" "{3220,3220,3220,25,23,23,16,25,26,28,28,28,26,28,28,26,28,28,1184}" "{o,o,o,o,o,o,o,o,o,o,o,o,o,o,o,o,o,o,o}" "{checkpoint_lsn,prior_lsn,redo_lsn,redo_wal_file,timeline_id,prev_timeline_id,full_page_writes,next_xid,next_oid,next_multixact_id,next_multi_offset,oldest_xid,oldest_xid_dbid,oldest_active_xid,oldest_multi_xid,oldest_multi_dbid,oldest_commit_ts_xid,newest_commit_ts_xid,checkpoint_time}" _null_ _null_ pg_control_checkpoint _null_ _null_ _null_ )); DESCR("pg_controldata checkpoint state information as a function"); -DATA(insert OID = 3443 ( pg_control_recovery PGNSP PGUID 12 1 0 0 0 f f f f t f v s 0 0 2249 "" "{3220,23,3220,3220,16}" "{o,o,o,o,o}" "{min_recovery_end_location,min_recovery_end_timeline,backup_start_location,backup_end_location,end_of_backup_record_required}" _null_ _null_ pg_control_recovery _null_ _null_ _null_ )); +DATA(insert OID = 3443 ( pg_control_recovery PGNSP PGUID 12 1 0 0 0 f f f f t f v s 0 0 2249 "" "{3220,23,3220,3220,16}" "{o,o,o,o,o}" "{min_recovery_end_lsn,min_recovery_end_timeline,backup_start_lsn,backup_end_lsn,end_of_backup_record_required}" _null_ _null_ pg_control_recovery _null_ _null_ _null_ )); DESCR("pg_controldata recovery state information as a function"); DATA(insert OID = 3444 ( pg_control_init PGNSP PGUID 12 1 0 0 0 f f f f t f v s 0 0 2249 "" "{23,23,23,23,23,23,23,23,23,16,16,23}" "{o,o,o,o,o,o,o,o,o,o,o,o}" "{max_data_alignment,database_block_size,blocks_per_segment,wal_block_size,bytes_per_wal_segment,max_identifier_length,max_index_columns,max_toast_chunk_size,large_object_chunk_size,float4_pass_by_value,float8_pass_by_value,data_page_checksum_version}" _null_ _null_ pg_control_init _null_ _null_ _null_ )); diff --git a/src/test/modules/commit_ts/t/002_standby.pl b/src/test/modules/commit_ts/t/002_standby.pl index 203b75d..e7221e9 100644 --- a/src/test/modules/commit_ts/t/002_standby.pl +++ b/src/test/modules/commit_ts/t/002_standby.pl @@ -31,9 +31,9 @@ my $master_ts = $master->safe_psql('postgres', 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_wal_location()'); + $master->safe_psql('postgres', 'select pg_current_wal_lsn()'); $standby->poll_query_until('postgres', - qq{SELECT '$master_lsn'::pg_lsn <= pg_last_wal_replay_location()}) + qq{SELECT '$master_lsn'::pg_lsn <= pg_last_wal_replay_lsn()}) or die "slave never caught up"; my $standby_ts = $standby->safe_psql('postgres', @@ -45,9 +45,9 @@ $master->append_conf('postgresql.conf', 'track_commit_timestamp = off'); $master->restart; $master->safe_psql('postgres', 'checkpoint'); $master_lsn = - $master->safe_psql('postgres', 'select pg_current_wal_location()'); + $master->safe_psql('postgres', 'select pg_current_wal_lsn()'); $standby->poll_query_until('postgres', - qq{SELECT '$master_lsn'::pg_lsn <= pg_last_wal_replay_location()}) + qq{SELECT '$master_lsn'::pg_lsn <= pg_last_wal_replay_lsn()}) or die "slave never caught up"; $standby->safe_psql('postgres', 'checkpoint'); diff --git a/src/test/modules/commit_ts/t/003_standby_2.pl b/src/test/modules/commit_ts/t/003_standby_2.pl index d7898b8..2fd5611 100644 --- a/src/test/modules/commit_ts/t/003_standby_2.pl +++ b/src/test/modules/commit_ts/t/003_standby_2.pl @@ -30,9 +30,9 @@ $master->append_conf('postgresql.conf', 'track_commit_timestamp = off'); $master->restart; $master->safe_psql('postgres', 'checkpoint'); my $master_lsn = - $master->safe_psql('postgres', 'select pg_current_wal_location()'); + $master->safe_psql('postgres', 'select pg_current_wal_lsn()'); $standby->poll_query_until('postgres', - qq{SELECT '$master_lsn'::pg_lsn <= pg_last_wal_replay_location()}) + qq{SELECT '$master_lsn'::pg_lsn <= pg_last_wal_replay_lsn()}) or die "slave never caught up"; $standby->safe_psql('postgres', 'checkpoint'); diff --git a/src/test/perl/PostgresNode.pm b/src/test/perl/PostgresNode.pm index 51cbec8..e3f1089 100644 --- a/src/test/perl/PostgresNode.pm +++ b/src/test/perl/PostgresNode.pm @@ -1362,11 +1362,11 @@ mode must be specified. sub lsn { my ($self, $mode) = @_; - 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()'); + my %modes = ('insert' => 'pg_current_wal_insert_lsn()', + 'flush' => 'pg_current_wal_flush_lsn()', + 'write' => 'pg_current_wal_lsn()', + 'receive' => 'pg_last_wal_receive_lsn()', + 'replay' => 'pg_last_wal_replay_lsn()'); $mode = '' if !defined($mode); die "unknown mode for 'lsn': '$mode', valid modes are " . join(', ', keys %modes) @@ -1391,8 +1391,8 @@ sub lsn Wait for the node with application_name standby_name (usually from node->name) until its replication position in pg_stat_replication equals or passes the upstream's WAL insert point at the time this function is called. By default -the replay_location is waited for, but 'mode' may be specified to wait for any -of sent|write|flush|replay. +the replay_lsn is waited for, but 'mode' may be specified to wait for any of +sent|write|flush|replay. If there is no active replication connection from this peer, waits until poll_query_until timeout. @@ -1417,8 +1417,8 @@ sub wait_for_catchup $standby_name = $standby_name->name; } die 'target_lsn must be specified' unless defined($target_lsn); - print "Waiting for replication conn " . $standby_name . "'s " . $mode . "_location to pass " . $target_lsn . " on " . $self->name . "\n"; - my $query = qq[SELECT '$target_lsn' <= ${mode}_location FROM pg_catalog.pg_stat_replication WHERE application_name = '$standby_name';]; + print "Waiting for replication conn " . $standby_name . "'s " . $mode . "_lsn to pass " . $target_lsn . " on " . $self->name . "\n"; + my $query = qq[SELECT '$target_lsn' <= ${mode}_lsn FROM pg_catalog.pg_stat_replication WHERE application_name = '$standby_name';]; $self->poll_query_until('postgres', $query) or die "timed out waiting for catchup, current position is " . ($self->safe_psql('postgres', $query) || '(unknown)'); print "done\n"; diff --git a/src/test/recovery/t/002_archiving.pl b/src/test/recovery/t/002_archiving.pl index e4a643d..42a9afb 100644 --- a/src/test/recovery/t/002_archiving.pl +++ b/src/test/recovery/t/002_archiving.pl @@ -31,7 +31,7 @@ $node_standby->start; $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_wal_location();"); + $node_master->safe_psql('postgres', "SELECT pg_current_wal_lsn();"); # Force archiving of WAL file to make it present on master $node_master->safe_psql('postgres', "SELECT pg_switch_wal()"); @@ -42,7 +42,7 @@ $node_master->safe_psql('postgres', # Wait until necessary replay has been done on standby my $caughtup_query = - "SELECT '$current_lsn'::pg_lsn <= pg_last_wal_replay_location()"; + "SELECT '$current_lsn'::pg_lsn <= pg_last_wal_replay_lsn()"; $node_standby->poll_query_until('postgres', $caughtup_query) or die "Timed out while waiting for standby to catch up"; diff --git a/src/test/recovery/t/003_recovery_targets.pl b/src/test/recovery/t/003_recovery_targets.pl index 203a464..66025cd 100644 --- a/src/test/recovery/t/003_recovery_targets.pl +++ b/src/test/recovery/t/003_recovery_targets.pl @@ -30,7 +30,7 @@ sub test_recovery_standby # Wait until standby has replayed enough data my $caughtup_query = - "SELECT '$until_lsn'::pg_lsn <= pg_last_wal_replay_location()"; + "SELECT '$until_lsn'::pg_lsn <= pg_last_wal_replay_lsn()"; $node_standby->poll_query_until('postgres', $caughtup_query) or die "Timed out while waiting for standby to catch up"; @@ -55,7 +55,7 @@ $node_master->start; $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_wal_location();"); + $node_master->safe_psql('postgres', "SELECT pg_current_wal_lsn();"); # Take backup from which all operations will be run $node_master->backup('my_backup'); @@ -65,14 +65,14 @@ $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_wal_location(), txid_current();"); + "SELECT pg_current_wal_lsn(), 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_wal_location(), now();"); + "SELECT pg_current_wal_lsn(), now();"); my ($lsn3, $recovery_time) = split /\|/, $ret; # Even more data, this time with a recovery target name @@ -80,16 +80,16 @@ $node_master->safe_psql('postgres', "INSERT INTO tab_int VALUES (generate_series(3001,4000))"); my $recovery_name = "my_target"; my $lsn4 = - $node_master->safe_psql('postgres', "SELECT pg_current_wal_location();"); + $node_master->safe_psql('postgres', "SELECT pg_current_wal_lsn();"); $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_wal_location()"); +my $recovery_lsn = $node_master->safe_psql('postgres', "SELECT pg_current_wal_lsn()"); my $lsn5 = - $node_master->safe_psql('postgres', "SELECT pg_current_wal_location();"); + $node_master->safe_psql('postgres', "SELECT pg_current_wal_lsn();"); $node_master->safe_psql('postgres', "INSERT INTO tab_int VALUES (generate_series(5001,6000))"); diff --git a/src/test/recovery/t/005_replay_delay.pl b/src/test/recovery/t/005_replay_delay.pl index cd9e8f5..4185f58 100644 --- a/src/test/recovery/t/005_replay_delay.pl +++ b/src/test/recovery/t/005_replay_delay.pl @@ -42,7 +42,7 @@ $node_master->safe_psql('postgres', # 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_wal_location()"); + $node_master->safe_psql('postgres', "SELECT pg_current_wal_lsn()"); my $remaining = 90; while ($remaining-- > 0) @@ -50,7 +50,7 @@ while ($remaining-- > 0) # Done waiting? my $replay_status = $node_standby->safe_psql('postgres', - "SELECT (pg_last_wal_replay_location() - '$until_lsn'::pg_lsn) >= 0" + "SELECT (pg_last_wal_replay_lsn() - '$until_lsn'::pg_lsn) >= 0" ); last if $replay_status eq 't'; diff --git a/src/test/recovery/t/006_logical_decoding.pl b/src/test/recovery/t/006_logical_decoding.pl index bf9b50a..31b1218 100644 --- a/src/test/recovery/t/006_logical_decoding.pl +++ b/src/test/recovery/t/006_logical_decoding.pl @@ -53,7 +53,7 @@ COMMIT}; my $stdout_sql = $node_master->safe_psql('postgres', qq[SELECT data FROM pg_logical_slot_peek_changes('test_slot', NULL, NULL, 'include-xids', '0', 'skip-empty-xacts', '1');]); is($stdout_sql, $expected, 'got expected output from SQL decoding session'); -my $endpos = $node_master->safe_psql('postgres', "SELECT location FROM pg_logical_slot_peek_changes('test_slot', NULL, NULL) ORDER BY location DESC LIMIT 1;"); +my $endpos = $node_master->safe_psql('postgres', "SELECT lsn FROM pg_logical_slot_peek_changes('test_slot', NULL, NULL) ORDER BY lsn DESC LIMIT 1;"); print "waiting to replay $endpos\n"; my $stdout_recv = $node_master->pg_recvlogical_upto('postgres', 'test_slot', $endpos, 10, 'include-xids' => '0', 'skip-empty-xacts' => '1'); @@ -66,7 +66,7 @@ is($stdout_recv, '', 'pg_recvlogical acknowledged changes, nothing pending on sl $node_master->safe_psql('postgres', 'CREATE DATABASE otherdb'); -is($node_master->psql('otherdb', "SELECT location FROM pg_logical_slot_peek_changes('test_slot', NULL, NULL) ORDER BY location DESC LIMIT 1;"), 3, +is($node_master->psql('otherdb', "SELECT lsn FROM pg_logical_slot_peek_changes('test_slot', NULL, NULL) ORDER BY lsn DESC LIMIT 1;"), 3, 'replaying logical slot from another database fails'); $node_master->safe_psql('otherdb', qq[SELECT pg_create_logical_replication_slot('otherdb_slot', 'test_decoding');]); diff --git a/src/test/recovery/t/008_fsm_truncation.pl b/src/test/recovery/t/008_fsm_truncation.pl index 8aa8a4f..055cac3 100644 --- a/src/test/recovery/t/008_fsm_truncation.pl +++ b/src/test/recovery/t/008_fsm_truncation.pl @@ -68,11 +68,11 @@ vacuum verbose testtab; $node_master->psql('postgres', 'checkpoint'); my $until_lsn = - $node_master->safe_psql('postgres', "SELECT pg_current_wal_location();"); + $node_master->safe_psql('postgres', "SELECT pg_current_wal_lsn();"); # Wait long enough for standby to receive and apply all WAL my $caughtup_query = - "SELECT '$until_lsn'::pg_lsn <= pg_last_wal_replay_location()"; + "SELECT '$until_lsn'::pg_lsn <= pg_last_wal_replay_lsn()"; $node_standby->poll_query_until('postgres', $caughtup_query) or die "Timed out while waiting for standby to catch up"; diff --git a/src/test/recovery/t/010_logical_decoding_timelines.pl b/src/test/recovery/t/010_logical_decoding_timelines.pl index cdddb4d..e168cbc 100644 --- a/src/test/recovery/t/010_logical_decoding_timelines.pl +++ b/src/test/recovery/t/010_logical_decoding_timelines.pl @@ -169,7 +169,7 @@ is($stderr, '', 'replay from slot before_basebackup produces no stderr'); # pg_recvlogical we should get complete results. First, find out the commit lsn # of the last transaction. There's no max(pg_lsn), so: -my $endpos = $node_replica->safe_psql('postgres', "SELECT location FROM pg_logical_slot_peek_changes('before_basebackup', NULL, NULL) ORDER BY location DESC LIMIT 1;"); +my $endpos = $node_replica->safe_psql('postgres', "SELECT lsn FROM pg_logical_slot_peek_changes('before_basebackup', NULL, NULL) ORDER BY lsn DESC LIMIT 1;"); # now use the walsender protocol to peek the slot changes and make sure we see # the same results. diff --git a/src/test/regress/expected/rules.out b/src/test/regress/expected/rules.out index 0165471..fd74bde 100644 --- a/src/test/regress/expected/rules.out +++ b/src/test/regress/expected/rules.out @@ -1851,17 +1851,17 @@ pg_stat_replication| SELECT s.pid, s.backend_start, s.backend_xmin, w.state, - w.sent_location, - w.write_location, - w.flush_location, - w.replay_location, + w.sent_lsn, + w.write_lsn, + w.flush_lsn, + w.replay_lsn, w.write_lag, w.flush_lag, w.replay_lag, w.sync_priority, w.sync_state FROM ((pg_stat_get_activity(NULL::integer) s(datid, pid, usesysid, application_name, state, query, wait_event_type, wait_event, xact_start, query_start, backend_start, state_change, client_addr, client_hostname, client_port, backend_xid, backend_xmin, backend_type, ssl, sslversion, sslcipher, sslbits, sslcompression, sslclientdn) - JOIN pg_stat_get_wal_senders() w(pid, state, sent_location, write_location, flush_location, replay_location, write_lag, flush_lag, replay_lag, sync_priority, sync_state) ON ((s.pid = w.pid))) + JOIN pg_stat_get_wal_senders() w(pid, state, sent_lsn, write_lsn, flush_lsn, replay_lsn, write_lag, flush_lag, replay_lag, sync_priority, sync_state) ON ((s.pid = w.pid))) LEFT JOIN pg_authid u ON ((s.usesysid = u.oid))); pg_stat_ssl| SELECT s.pid, s.ssl, diff --git a/src/test/subscription/t/001_rep_changes.pl b/src/test/subscription/t/001_rep_changes.pl index d1817f5..a7a9e0e 100644 --- a/src/test/subscription/t/001_rep_changes.pl +++ b/src/test/subscription/t/001_rep_changes.pl @@ -52,7 +52,7 @@ $node_subscriber->safe_psql('postgres', # Wait for subscriber to finish initialization my $caughtup_query = -"SELECT pg_current_wal_location() <= replay_location FROM pg_stat_replication WHERE application_name = '$appname';"; +"SELECT pg_current_wal_lsn() <= replay_lsn 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"; diff --git a/src/test/subscription/t/002_types.pl b/src/test/subscription/t/002_types.pl index ad15e85..16e8b47 100644 --- a/src/test/subscription/t/002_types.pl +++ b/src/test/subscription/t/002_types.pl @@ -107,7 +107,7 @@ $node_subscriber->safe_psql('postgres', # Wait for subscriber to finish initialization my $caughtup_query = -"SELECT pg_current_wal_location() <= replay_location FROM pg_stat_replication WHERE application_name = '$appname';"; +"SELECT pg_current_wal_lsn() <= replay_lsn 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"; diff --git a/src/test/subscription/t/003_constraints.pl b/src/test/subscription/t/003_constraints.pl index 11b8254..074fdb1 100644 --- a/src/test/subscription/t/003_constraints.pl +++ b/src/test/subscription/t/003_constraints.pl @@ -38,7 +38,7 @@ $node_subscriber->safe_psql('postgres', # Wait for subscriber to finish initialization my $caughtup_query = -"SELECT pg_current_wal_location() <= replay_location FROM pg_stat_replication WHERE application_name = '$appname';"; +"SELECT pg_current_wal_lsn() <= replay_lsn 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"; diff --git a/src/test/subscription/t/004_sync.pl b/src/test/subscription/t/004_sync.pl index fa0bf7f..ceeb7a3 100644 --- a/src/test/subscription/t/004_sync.pl +++ b/src/test/subscription/t/004_sync.pl @@ -37,7 +37,7 @@ $node_subscriber->safe_psql('postgres', # Wait for subscriber to finish initialization my $caughtup_query = -"SELECT pg_current_wal_location() <= replay_location FROM pg_stat_replication WHERE application_name = '$appname';"; +"SELECT pg_current_wal_lsn() <= replay_lsn 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"; diff --git a/src/test/subscription/t/005_encoding.pl b/src/test/subscription/t/005_encoding.pl index 42a4eee..7a62e05 100644 --- a/src/test/subscription/t/005_encoding.pl +++ b/src/test/subscription/t/005_encoding.pl @@ -10,7 +10,7 @@ sub wait_for_caught_up my ($node, $appname) = @_; $node->poll_query_until('postgres', - "SELECT pg_current_wal_location() <= replay_location FROM pg_stat_replication WHERE application_name = '$appname';") + "SELECT pg_current_wal_lsn() <= replay_lsn FROM pg_stat_replication WHERE application_name = '$appname';") or die "Timed out while waiting for subscriber to catch up"; }