Based on discussion in https://www.postgresql.org/message-id/CAE1wr-w%3DLE1cK5uG_rmAh-VBxc4_Bnw-gAE3qSqL-%3DtWwvLvjQ%40mail.gmail.com .
Tested via regression tests. To be applied in master only and to be included in 10.0. -- Vladimir Rusinov Storage SRE, Google Ireland Google Ireland Ltd.,Gordon House, Barrow Street, Dublin 4, Ireland Registered in Dublin, Ireland Registration Number: 368047
From 2502b9f36f08965a66f4125952f23e1f6ede4d83 Mon Sep 17 00:00:00 2001 From: Vladimir Rusinov <vrusi...@google.com> Date: Mon, 12 Dec 2016 13:23:32 +0000 Subject: [PATCH 1/1] Rename pg_switch_xlog to pg_switch_wal. Based on discussion in https://www.postgresql.org/message-id/CAE1wr-w%3DLE1cK5uG_rmAh-VBxc4_Bnw-gAE3qSqL-%3DtWwvLvjQ%40mail.gmail.com. Tested via regression tests. To be applied in master only and to be included in 10.0. Signed-off-by: Vladimir Rusinov <vrusi...@google.com> --- doc/src/sgml/backup.sgml | 2 +- doc/src/sgml/func.sgml | 8 ++++---- doc/src/sgml/high-availability.sgml | 2 +- src/backend/access/transam/xlogfuncs.c | 6 ++++-- src/backend/catalog/system_views.sql | 2 +- src/include/access/xlog_fn.h | 2 +- src/include/catalog/pg_proc.h | 2 +- src/test/recovery/t/002_archiving.pl | 2 +- src/test/recovery/t/003_recovery_targets.pl | 2 +- src/test/regress/expected/hs_standby_functions.out | 2 +- src/test/regress/sql/hs_primary_extremes.sql | 2 +- src/test/regress/sql/hs_primary_setup.sql | 2 +- src/test/regress/sql/hs_standby_functions.sql | 2 +- 13 files changed, 19 insertions(+), 17 deletions(-) diff --git a/doc/src/sgml/backup.sgml b/doc/src/sgml/backup.sgml index 6eaed1e..dc00a00 100644 --- a/doc/src/sgml/backup.sgml +++ b/doc/src/sgml/backup.sgml @@ -726,7 +726,7 @@ test ! -f /mnt/server/archivedir/00000001000000A900000065 && cp pg_wal/0 <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">. diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml index eca98df..e11aec9 100644 --- a/doc/src/sgml/func.sgml +++ b/doc/src/sgml/func.sgml @@ -17949,7 +17949,7 @@ SELECT set_config('log_statement_stats', 'off', false); <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> @@ -18043,7 +18043,7 @@ SELECT set_config('log_statement_stats', 'off', false); </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> @@ -18122,11 +18122,11 @@ postgres=# select pg_start_backup('label_goes_here'); </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> diff --git a/doc/src/sgml/high-availability.sgml b/doc/src/sgml/high-availability.sgml index 6b89507..a1dd93b 100644 --- a/doc/src/sgml/high-availability.sgml +++ b/doc/src/sgml/high-availability.sgml @@ -2201,7 +2201,7 @@ LOG: database system is ready to accept read only connections <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> diff --git a/src/backend/access/transam/xlogfuncs.c b/src/backend/access/transam/xlogfuncs.c index 01cbd90..6547b8f 100644 --- a/src/backend/access/transam/xlogfuncs.c +++ b/src/backend/access/transam/xlogfuncs.c @@ -277,13 +277,15 @@ pg_stop_backup_v2(PG_FUNCTION_ARGS) } /* - * pg_switch_xlog: switch to next xlog file + * pg_switch_wal: switch to next wal (aka xlog) file + * + * Renamed from pg_switch_xlog in 10.0 * * 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; diff --git a/src/backend/catalog/system_views.sql b/src/backend/catalog/system_views.sql index df59d18..ffd1fad 100644 --- a/src/backend/catalog/system_views.sql +++ b/src/backend/catalog/system_views.sql @@ -1039,7 +1039,7 @@ REVOKE EXECUTE ON FUNCTION pg_start_backup(text, boolean, boolean) FROM public; 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_switch_wal() 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_rotate_logfile() FROM public; diff --git a/src/include/access/xlog_fn.h b/src/include/access/xlog_fn.h index 576a4dc..7aa4e95 100644 --- a/src/include/access/xlog_fn.h +++ b/src/include/access/xlog_fn.h @@ -16,7 +16,7 @@ extern Datum pg_start_backup(PG_FUNCTION_ARGS); extern Datum pg_stop_backup(PG_FUNCTION_ARGS); extern Datum pg_stop_backup_v2(PG_FUNCTION_ARGS); -extern Datum pg_switch_xlog(PG_FUNCTION_ARGS); +extern Datum pg_switch_wal(PG_FUNCTION_ARGS); extern Datum pg_create_restore_point(PG_FUNCTION_ARGS); extern Datum pg_current_xlog_location(PG_FUNCTION_ARGS); extern Datum pg_current_xlog_insert_location(PG_FUNCTION_ARGS); diff --git a/src/include/catalog/pg_proc.h b/src/include/catalog/pg_proc.h index 96e77ec..c600c1b 100644 --- a/src/include/catalog/pg_proc.h +++ b/src/include/catalog/pg_proc.h @@ -3141,7 +3141,7 @@ DATA(insert OID = 3813 ( pg_is_in_backup PGNSP PGUID 12 1 0 0 0 f f f f t f v s 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_ )); +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 xlog 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"); diff --git a/src/test/recovery/t/002_archiving.pl b/src/test/recovery/t/002_archiving.pl index fc2bf7e..c34c6ae 100644 --- a/src/test/recovery/t/002_archiving.pl +++ b/src/test/recovery/t/002_archiving.pl @@ -36,7 +36,7 @@ my $current_lsn = $node_master->safe_psql('postgres', "SELECT pg_current_xlog_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', diff --git a/src/test/recovery/t/003_recovery_targets.pl b/src/test/recovery/t/003_recovery_targets.pl index a82545b..6f78e2a 100644 --- a/src/test/recovery/t/003_recovery_targets.pl +++ b/src/test/recovery/t/003_recovery_targets.pl @@ -97,7 +97,7 @@ $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'"); diff --git a/src/test/regress/expected/hs_standby_functions.out b/src/test/regress/expected/hs_standby_functions.out index 16d50a8..e0af677 100644 --- a/src/test/regress/expected/hs_standby_functions.out +++ b/src/test/regress/expected/hs_standby_functions.out @@ -15,7 +15,7 @@ select length(txid_current_snapshot()::text) >= 4; 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(); diff --git a/src/test/regress/sql/hs_primary_extremes.sql b/src/test/regress/sql/hs_primary_extremes.sql index 629efb4..2051e2e 100644 --- a/src/test/regress/sql/hs_primary_extremes.sql +++ b/src/test/regress/sql/hs_primary_extremes.sql @@ -70,4 +70,4 @@ SELECT count(*) > 257 FROM pg_locks; COMMIT; SELECT hs_locks_drop(257); -SELECT pg_switch_xlog(); +SELECT pg_switch_wal(); diff --git a/src/test/regress/sql/hs_primary_setup.sql b/src/test/regress/sql/hs_primary_setup.sql index a00b367..eeb4421 100644 --- a/src/test/regress/sql/hs_primary_setup.sql +++ b/src/test/regress/sql/hs_primary_setup.sql @@ -22,4 +22,4 @@ insert into hs3 values (115); DROP sequence if exists hsseq; create sequence hsseq; -SELECT pg_switch_xlog(); +SELECT pg_switch_wal(); diff --git a/src/test/regress/sql/hs_standby_functions.sql b/src/test/regress/sql/hs_standby_functions.sql index 7577045..251bac0 100644 --- a/src/test/regress/sql/hs_standby_functions.sql +++ b/src/test/regress/sql/hs_standby_functions.sql @@ -10,7 +10,7 @@ select txid_current(); 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 -- 2.8.0.rc3.226.g39d4020
smime.p7s
Description: S/MIME Cryptographic Signature