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

Commit8328a15

Browse files
committed
Fix recently added incorrect assertion
Commitdf3737a added an incorrect assertion about the preconditionsfor invoking the backup cleanup callback: it misfires at session end incase a backup completes successfully. Fix it, using coding from MichaëlPaquier. 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
1 parent2e0d80c commit8328a15

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

‎src/backend/access/transam/xlog.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8841,9 +8841,8 @@ do_pg_abort_backup(int code, Datum arg)
88418841
{
88428842
boolduring_backup_start=DatumGetBool(arg);
88438843

8844-
/* Only one of these conditions can be true */
8845-
Assert(during_backup_start ^
8846-
(sessionBackupState==SESSION_BACKUP_RUNNING));
8844+
/* If called during backup start, there shouldn't be one already running */
8845+
Assert(!during_backup_start||sessionBackupState==SESSION_BACKUP_NONE);
88478846

88488847
if (during_backup_start||sessionBackupState!=SESSION_BACKUP_NONE)
88498848
{

‎src/test/recovery/t/020_archive_status.pl

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,4 +248,18 @@
248248
ok($logfile =~qr/archiver process shutting down/,
249249
'check shutdown callback of shell archive module');
250250

251+
# Test that we can enter and leave backup mode without crashes
252+
my ($stderr,$cmdret);
253+
$cmdret =$primary->psql(
254+
'postgres',
255+
"SELECT pg_backup_start('onebackup');"
256+
."SELECT pg_backup_stop();"
257+
."SELECT pg_backup_start(repeat('x', 1026))",
258+
stderr=> \$stderr);
259+
is($cmdret, 3,"psql fails correctly");
260+
like($stderr,qr/backup label too long/,"pg_backup_start fails gracefully");
261+
$primary->safe_psql('postgres',
262+
"SELECT pg_backup_start('onebackup'); SELECT pg_backup_stop();");
263+
$primary->safe_psql('postgres',"SELECT pg_backup_start('twobackup')");
264+
251265
done_testing();

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp