diff options
author | Stephen Frost | 2022-04-06 18:41:03 +0000 |
---|---|---|
committer | Stephen Frost | 2022-04-06 18:41:03 +0000 |
commit | 39969e2a1e4d7f5a37f3ef37d53bbfe171e7d77a (patch) | |
tree | 7b1e10c1147783ef0a21b76d78657921696be791 /src/include | |
parent | 14d3f24fa8a21f8a7e66f1fc60253a1e11410bf3 (diff) |
Remove exclusive backup mode
Exclusive-mode backups have been deprecated since 9.6 (when
non-exclusive backups were introduced) due to the issues
they can cause should the system crash while one is running and
generally because non-exclusive provides a much better interface.
Further, exclusive backup mode wasn't really being tested (nor was most
of the related code- like being able to log in just to stop an exclusive
backup and the bits of the state machine related to that) and having to
possibly deal with an exclusive backup and the backup_label file
existing during pg_basebackup, pg_rewind, etc, added other complexities
that we are better off without.
This patch removes the exclusive backup mode, the various special cases
for dealing with it, and greatly simplifies the online backup code and
documentation.
Authors: David Steele, Nathan Bossart
Reviewed-by: Chapman Flack
Discussion: https://postgr.es/m/ac7339ca-3718-3c93-929f-99e725d1172c@pgmasters.net
https://postgr.es/m/CAHg+QDfiM+WU61tF6=nPZocMZvHDzCK47Kneyb0ZRULYzV5sKQ@mail.gmail.com
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/access/xlog.h | 7 | ||||
-rw-r--r-- | src/include/catalog/pg_control.h | 4 | ||||
-rw-r--r-- | src/include/catalog/pg_proc.dat | 28 | ||||
-rw-r--r-- | src/include/libpq/libpq-be.h | 3 | ||||
-rw-r--r-- | src/include/miscadmin.h | 4 |
5 files changed, 14 insertions, 32 deletions
diff --git a/src/include/access/xlog.h b/src/include/access/xlog.h index 09f6464331b..b81917f243d 100644 --- a/src/include/access/xlog.h +++ b/src/include/access/xlog.h @@ -276,14 +276,13 @@ extern void XLogShutdownWalRcv(void); typedef enum SessionBackupState { SESSION_BACKUP_NONE, - SESSION_BACKUP_EXCLUSIVE, - SESSION_BACKUP_NON_EXCLUSIVE + SESSION_BACKUP_RUNNING, } SessionBackupState; -extern XLogRecPtr do_pg_start_backup(const char *backupidstr, bool fast, +extern XLogRecPtr do_pg_backup_start(const char *backupidstr, bool fast, TimeLineID *starttli_p, StringInfo labelfile, List **tablespaces, StringInfo tblspcmapfile); -extern XLogRecPtr do_pg_stop_backup(char *labelfile, bool waitforarchive, +extern XLogRecPtr do_pg_backup_stop(char *labelfile, bool waitforarchive, TimeLineID *stoptli_p); extern void do_pg_abort_backup(int code, Datum arg); extern void register_persistent_abort_backup_handler(void); diff --git a/src/include/catalog/pg_control.h b/src/include/catalog/pg_control.h index 1f3dc24ac11..06368e23667 100644 --- a/src/include/catalog/pg_control.h +++ b/src/include/catalog/pg_control.h @@ -161,9 +161,7 @@ typedef struct ControlFileData * * If backupEndRequired is true, we know for sure that we're restoring * from a backup, and must see a backup-end record before we can safely - * start up. If it's false, but backupStartPoint is set, a backup_label - * file was found at startup but it may have been a leftover from a stray - * pg_start_backup() call, not accompanied by pg_stop_backup(). + * start up. */ XLogRecPtr minRecoveryPoint; TimeLineID minRecoveryPointTLI; diff --git a/src/include/catalog/pg_proc.dat b/src/include/catalog/pg_proc.dat index 4d285ece8bf..e8f89a7b180 100644 --- a/src/include/catalog/pg_proc.dat +++ b/src/include/catalog/pg_proc.dat @@ -6274,26 +6274,16 @@ proargtypes => 'int4 int8', proargnames => '{pid,timeout}', prosrc => 'pg_terminate_backend' }, { oid => '2172', descr => 'prepare for taking an online backup', - proname => 'pg_start_backup', provolatile => 'v', proparallel => 'r', - prorettype => 'pg_lsn', proargtypes => 'text bool bool', - prosrc => 'pg_start_backup' }, -{ oid => '2173', descr => 'finish taking an online backup', - proname => 'pg_stop_backup', provolatile => 'v', proparallel => 'r', - prorettype => 'pg_lsn', proargtypes => '', prosrc => 'pg_stop_backup' }, + proname => 'pg_backup_start', provolatile => 'v', proparallel => 'r', + prorettype => 'pg_lsn', proargtypes => 'text bool', + prosrc => 'pg_backup_start' }, { oid => '2739', descr => 'finish taking an online backup', - proname => 'pg_stop_backup', provolatile => 'v', proparallel => 'r', - prorettype => 'record', proargtypes => 'bool bool', - proallargtypes => '{bool,bool,pg_lsn,text,text}', - proargmodes => '{i,i,o,o,o}', - proargnames => '{exclusive,wait_for_archive,lsn,labelfile,spcmapfile}', - prosrc => 'pg_stop_backup_v2' }, -{ oid => '3813', descr => 'true if server is in online backup', - proname => 'pg_is_in_backup', provolatile => 'v', prorettype => 'bool', - proargtypes => '', prosrc => 'pg_is_in_backup' }, -{ oid => '3814', descr => 'start time of an online backup', - proname => 'pg_backup_start_time', provolatile => 's', - prorettype => 'timestamptz', proargtypes => '', - prosrc => 'pg_backup_start_time' }, + proname => 'pg_backup_stop', provolatile => 'v', proparallel => 'r', + prorettype => 'record', proargtypes => 'bool', + proallargtypes => '{bool,pg_lsn,text,text}', + proargmodes => '{i,o,o,o}', + proargnames => '{wait_for_archive,lsn,labelfile,spcmapfile}', + prosrc => 'pg_backup_stop' }, { oid => '3436', descr => 'promote standby server', proname => 'pg_promote', provolatile => 'v', prorettype => 'bool', proargtypes => 'bool int4', proargnames => '{wait,wait_seconds}', diff --git a/src/include/libpq/libpq-be.h b/src/include/libpq/libpq-be.h index dd3e5efba3a..c3bf5146528 100644 --- a/src/include/libpq/libpq-be.h +++ b/src/include/libpq/libpq-be.h @@ -75,8 +75,7 @@ typedef enum CAC_state CAC_SHUTDOWN, CAC_RECOVERY, CAC_NOTCONSISTENT, - CAC_TOOMANY, - CAC_SUPERUSER + CAC_TOOMANY } CAC_state; diff --git a/src/include/miscadmin.h b/src/include/miscadmin.h index 0abc3ad5405..9321d7f264b 100644 --- a/src/include/miscadmin.h +++ b/src/include/miscadmin.h @@ -481,10 +481,6 @@ extern void process_session_preload_libraries(void); extern void pg_bindtextdomain(const char *domain); extern bool has_rolreplication(Oid roleid); -/* in access/transam/xlog.c */ -extern bool BackupInProgress(void); -extern void CancelBackup(void); - /* in executor/nodeHash.c */ extern size_t get_hash_memory_limit(void); |