Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit2aedf25

Browse files
committed
Prevent BASE_BACKUP in the middle of another backup in the same session.
Multiple non-exclusive backups are able to be run conrrently in differentsessions. But, in the same session, only one non-exclusive backup can berun at the same moment. If pg_backup_start (pg_start_backup in v14 or before)is called in the middle of another non-exclusive backup in the same session,an error is thrown.However, previously, in logical replication walsender mode, even if thatwalsender session had already called pg_backup_start and starteda non-exclusive backup, it could execute BASE_BACKUP command andstart another non-exclusive backup. Which caused subsequent pg_backup_stopto throw an error because BASE_BACKUP unexpectedly reset the session statemarked by pg_backup_start.This commit prevents BASE_BACKUP command in the middle of anothernon-exclusive backup in the same session.Back-patch to all supported branches.Author: Fujii MasaoReviewed-by: Kyotaro Horiguchi, Masahiko Sawada, Michael Paquier, Robert HaasDiscussion:https://postgr.es/m/3374718f-9fbf-a950-6d66-d973e027f44c@oss.nttdata.com
1 parent8657946 commit2aedf25

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

‎src/backend/replication/basebackup.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -932,6 +932,12 @@ void
932932
SendBaseBackup(BaseBackupCmd*cmd)
933933
{
934934
basebackup_optionsopt;
935+
SessionBackupStatestatus=get_backup_status();
936+
937+
if (status==SESSION_BACKUP_NON_EXCLUSIVE)
938+
ereport(ERROR,
939+
(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
940+
errmsg("a backup is already in progress in this session")));
935941

936942
parse_basebackup_options(cmd->options,&opt);
937943

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp