diff options
author | Fujii Masao <fujii@postgresql.org> | 2022-07-12 11:53:29 +0900 |
---|---|---|
committer | Fujii Masao <fujii@postgresql.org> | 2022-07-20 09:53:53 +0900 |
commit | 162ade612f1543389bd105fba82ea7e60c5b82c9 (patch) | |
tree | 8d8d0f2ec76cb2a7f7276627838b4fa3b94905da /src/backend/access/transam/xlog.c | |
parent | 5630f39b31eac67a1bd56b0e6254d7724b7bbaeb (diff) | |
download | postgresql-162ade612f1543389bd105fba82ea7e60c5b82c9.tar.gz postgresql-162ade612f1543389bd105fba82ea7e60c5b82c9.zip |
Fix assertion failure and segmentation fault in backup code.
When a non-exclusive backup is canceled, do_pg_abort_backup() is called
and resets some variables set by pg_backup_start (pg_start_backup in v14
or before). But previously it forgot to reset the session state indicating
whether a non-exclusive backup is in progress or not in this session.
This issue could cause an assertion failure when the session running
BASE_BACKUP is terminated after it executed pg_backup_start and
pg_backup_stop (pg_stop_backup in v14 or before). Also it could cause
a segmentation fault when pg_backup_stop is called after BASE_BACKUP
in the same session is canceled.
This commit fixes the issue by making do_pg_abort_backup reset
that session state.
Back-patch to all supported branches.
Author: Fujii Masao
Reviewed-by: Kyotaro Horiguchi, Masahiko Sawada, Michael Paquier, Robert Haas
Discussion: https://postgr.es/m/3374718f-9fbf-a950-6d66-d973e027f44c@oss.nttdata.com
Diffstat (limited to 'src/backend/access/transam/xlog.c')
-rw-r--r-- | src/backend/access/transam/xlog.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8870ac3b0ed..32f1022c294 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -11645,6 +11645,8 @@ do_pg_abort_backup(int code, Datum arg) { XLogCtl->Insert.forcePageWrites = false; } + + sessionBackupState = SESSION_BACKUP_NONE; WALInsertLockRelease(); if (emit_warning) |