From d10c626de47d8b048b663471c7785603a2ec8641 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Thu, 11 May 2017 11:49:59 -0400 Subject: Rename WAL-related functions and views to use "lsn" not "location". Per discussion, "location" is a rather vague term that could refer to multiple concepts. "LSN" is an unambiguous term for WAL locations and should be preferred. Some function names, view column names, and function output argument names used "lsn" already, but others used "location", as well as yet other terms such as "wal_position". Since we've already renamed a lot of things in this area from "xlog" to "wal" for v10, we may as well incur a bit more compatibility pain and make these names all consistent. David Rowley, minor additional docs hacking by me Discussion: https://postgr.es/m/CAKJS1f8O0njDKe8ePFQ-LK5-EjwThsDws6ohJ-+c6nWK+oUxtg@mail.gmail.com --- src/test/perl/PostgresNode.pm | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) (limited to 'src/test/perl/PostgresNode.pm') diff --git a/src/test/perl/PostgresNode.pm b/src/test/perl/PostgresNode.pm index 51cbec8e5d9..e2274681b10 100644 --- a/src/test/perl/PostgresNode.pm +++ b/src/test/perl/PostgresNode.pm @@ -1347,13 +1347,13 @@ sub run_log =item $node->lsn(mode) -Look up WAL positions on the server: +Look up WAL locations on the server: - * insert position (master only, error on replica) - * write position (master only, error on replica) - * flush position (master only, error on replica) - * receive position (always undef on master) - * replay position (always undef on master) + * insert location (master only, error on replica) + * write location (master only, error on replica) + * flush location (master only, error on replica) + * receive location (always undef on master) + * replay location (always undef on master) mode must be specified. @@ -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) @@ -1389,10 +1389,10 @@ sub lsn =item $node->wait_for_catchup(standby_name, mode, target_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 +until its replication location 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,10 +1417,10 @@ 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)'); + or die "timed out waiting for catchup, current location is " . ($self->safe_psql('postgres', $query) || '(unknown)'); print "done\n"; } @@ -1429,7 +1429,7 @@ sub wait_for_catchup =item $node->wait_for_slot_catchup(slot_name, mode, target_lsn) Wait for the named replication slot to equal or pass the supplied target_lsn. -The position used is the restart_lsn unless mode is given, in which case it may +The location used is the restart_lsn unless mode is given, in which case it may be 'restart' or 'confirmed_flush'. Requires that the 'postgres' db exists and is accessible. @@ -1456,7 +1456,7 @@ sub wait_for_slot_catchup print "Waiting for replication slot " . $slot_name . "'s " . $mode . "_lsn to pass " . $target_lsn . " on " . $self->name . "\n"; my $query = qq[SELECT '$target_lsn' <= ${mode}_lsn FROM pg_catalog.pg_replication_slots WHERE slot_name = '$slot_name';]; $self->poll_query_until('postgres', $query) - or die "timed out waiting for catchup, current position is " . ($self->safe_psql('postgres', $query) || '(unknown)'); + or die "timed out waiting for catchup, current location is " . ($self->safe_psql('postgres', $query) || '(unknown)'); print "done\n"; } -- cgit v1.2.3