While playing with a proposed patch, I noticed that a session crashes
after a failed call to pg_backup_start().
postgres=# select pg_backup_start(repeat('x', 1026));
ERROR: backup label too long (max 1024 bytes)
postgres=# \q
> TRAP: failed Assert("during_backup_start ^ (sessionBackupState ==
> SESSION_BACKUP_RUNNING)"), File: "xlog.c", Line: 8846, PID: 165835
Surprisingly this happens by a series of succussful calls to
pg_backup_start and stop.
postgres=# select pg_backup_start('x');
postgres=# select pg_backup_top();
postgres=# \q
> TRAP: failed Assert("durin..
>> do_pg_abort_backup(int code, Datum arg)
> /* Only one of these conditions can be true */
> Assert(during_backup_start ^
> (sessionBackupState == SESSION_BACKUP_RUNNING));
It seems to me that the comment is true and the condition is a thinko.
This is introduced by df3737a651 so it is master only.
Please find the attached fix.
regards.
--
Kyotaro Horiguchi
NTT Open Source Software Center
diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c
index dea978a962..888f5b1bff 100644
--- a/src/backend/access/transam/xlog.c
+++ b/src/backend/access/transam/xlog.c
@@ -8842,8 +8842,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));
+ Assert(!(during_backup_start &&
+ (sessionBackupState == SESSION_BACKUP_RUNNING)));
if (during_backup_start || sessionBackupState != SESSION_BACKUP_NONE)
{