mirror of
https://github.com/postgres/postgres.git
synced 2025-09-09 13:09:39 +03:00
Fix backup canceling
Assert-enabled build crashes but without asserts it works by wrong way: it may not reset forcing full page write and preventing from starting exclusive backup with the same name as cancelled. Patch replaces pair of booleans nonexclusive_backup_running/exclusive_backup_running to single enum to correctly describe backup state. Backpatch to 9.6 where bug was introduced Reported-by: David Steele Authors: Michael Paquier, David Steele Reviewed-by: Anastasia Lubennikova https://commitfest.postgresql.org/13/1068/
This commit is contained in:
@@ -288,8 +288,26 @@ extern void assign_max_wal_size(int newval, void *extra);
|
||||
extern void assign_checkpoint_completion_target(double newval, void *extra);
|
||||
|
||||
/*
|
||||
* Starting/stopping a base backup
|
||||
* Routines to start, stop, and get status of a base backup.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Session-level status of base backups
|
||||
*
|
||||
* This is used in parallel with the shared memory status to control parallel
|
||||
* execution of base backup functions for a given session, be it a backend
|
||||
* dedicated to replication or a normal backend connected to a database. The
|
||||
* update of the session-level status happens at the same time as the shared
|
||||
* memory counters to keep a consistent global and local state of the backups
|
||||
* running.
|
||||
*/
|
||||
typedef enum SessionBackupState
|
||||
{
|
||||
SESSION_BACKUP_NONE,
|
||||
SESSION_BACKUP_EXCLUSIVE,
|
||||
SESSION_BACKUP_NON_EXCLUSIVE
|
||||
} SessionBackupState;
|
||||
|
||||
extern XLogRecPtr do_pg_start_backup(const char *backupidstr, bool fast,
|
||||
TimeLineID *starttli_p, StringInfo labelfile, DIR *tblspcdir,
|
||||
List **tablespaces, StringInfo tblspcmapfile, bool infotbssize,
|
||||
@@ -297,6 +315,7 @@ extern XLogRecPtr do_pg_start_backup(const char *backupidstr, bool fast,
|
||||
extern XLogRecPtr do_pg_stop_backup(char *labelfile, bool waitforarchive,
|
||||
TimeLineID *stoptli_p);
|
||||
extern void do_pg_abort_backup(void);
|
||||
extern SessionBackupState get_backup_status(void);
|
||||
|
||||
/* File path names (all relative to $PGDATA) */
|
||||
#define BACKUP_LABEL_FILE "backup_label"
|
||||
|
Reference in New Issue
Block a user