Re: Backup command and functions can cause assertion failure and segmentation fault
Fujii Masao <masao.fujii@oss.nttdata.com>
From: Fujii Masao <masao.fujii@oss.nttdata.com>
To: Masahiko Sawada <sawada.mshk@gmail.com>
Cc: pgsql-hackers@lists.postgresql.org
Date: 2022-07-01T06:32:50Z
Lists: pgsql-hackers
Attachments
- fix_assertion_failure_and_segv_when_backup_v2.patch (text/plain) patch v2
On 2022/07/01 15:09, Masahiko Sawada wrote:
> The change looks good to me. I've also confirmed the change fixed the issues.
Thanks for the review and test!
> @@ -233,6 +233,12 @@ perform_base_backup(basebackup_options *opt, bbsink *sink)
> StringInfo labelfile;
> StringInfo tblspc_map_file;
> backup_manifest_info manifest;
> + SessionBackupState status = get_backup_status();
> +
> + if (status == SESSION_BACKUP_RUNNING)
> + ereport(ERROR,
> + (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
> + errmsg("a backup is already in progress in this session")));
>
> I think we can move it to the beginning of SendBaseBackup() so we can
> avoid bbsink initialization and cleanup in the error case.
Sounds good idea to me. I updated the patch in that way. Attached.
Regards,
--
Fujii Masao
Advanced Computing Technology Center
Research and Development Headquarters
NTT DATA CORPORATION
Commits
-
Add more TAP tests with BASE_BACKUP and pg_backup_start/stop
- ad341469b423 16.0 landed
-
Fix assertion failure and segmentation fault in backup code.
- 0829cc43ed69 15.0 landed
- b24b2be119c4 16.0 landed
- 2497d2b77091 10.22 landed
- 80c3ea918526 11.17 landed
- f0eb83f81447 12.12 landed
- 162ade612f15 13.8 landed
- be2e842c8a79 14.5 landed
-
Prevent BASE_BACKUP in the middle of another backup in the same session.
- 286793b9889f 15.0 landed
- ee79647769f5 16.0 landed
- dd831afc44bf 10.22 landed
- 87e504487740 11.17 landed
- 9fa00e312b31 12.12 landed
- 5630f39b31ea 13.8 landed
- 2aedf25eb4d0 14.5 landed