1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-21 16:02:15 +03:00

Fix recently added incorrect assertion

Commit df3737a651 added an incorrect assertion about the preconditions
for invoking the backup cleanup callback: it misfires at session end in
case a backup completes successfully.  Fix it, using coding from Michaël
Paquier.  Also add some tests for the various cases.

Reported by Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Discussion: https://postgr.es/m/20221021.161038.1277961198945653224.horikyota.ntt@gmail.com
This commit is contained in:
Alvaro Herrera
2022-10-24 12:02:33 +02:00
parent 2e0d80c5bb
commit 8328a15f8f
2 changed files with 16 additions and 3 deletions

View File

@ -8841,9 +8841,8 @@ do_pg_abort_backup(int code, Datum arg)
{
bool during_backup_start = DatumGetBool(arg);
/* Only one of these conditions can be true */
Assert(during_backup_start ^
(sessionBackupState == SESSION_BACKUP_RUNNING));
/* If called during backup start, there shouldn't be one already running */
Assert(!during_backup_start || sessionBackupState == SESSION_BACKUP_NONE);
if (during_backup_start || sessionBackupState != SESSION_BACKUP_NONE)
{