Skip to content

Commit 79a9891

Browse files
committed
fix achive_timeout=0 due to old bug from 2.0.x version
1 parent 916ffb6 commit 79a9891

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/backup.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1572,8 +1572,13 @@ pg_stop_backup(pgBackup *backup, PGconn *pg_startbackup_conn,
15721572
*/
15731573
if (pg_stop_backup_is_sent && !in_cleanup)
15741574
{
1575+
int timeout = ARCHIVE_TIMEOUT_DEFAULT;
15751576
res = NULL;
15761577

1578+
/* kludge against some old bug in archive_timeout. TODO: remove in 3.0.0 */
1579+
if (instance_config.archive_timeout > 0)
1580+
timeout = instance_config.archive_timeout;
1581+
15771582
while (1)
15781583
{
15791584
if (!PQconsumeInput(conn))
@@ -1598,11 +1603,10 @@ pg_stop_backup(pgBackup *backup, PGconn *pg_startbackup_conn,
15981603
* If postgres haven't answered in archive_timeout seconds,
15991604
* send an interrupt.
16001605
*/
1601-
if (pg_stop_backup_timeout > instance_config.archive_timeout)
1606+
if (pg_stop_backup_timeout > timeout)
16021607
{
16031608
pgut_cancel(conn);
1604-
elog(ERROR, "pg_stop_backup doesn't answer in %d seconds, cancel it",
1605-
instance_config.archive_timeout);
1609+
elog(ERROR, "pg_stop_backup doesn't answer in %d seconds, cancel it", timeout);
16061610
}
16071611
}
16081612
else

0 commit comments

Comments
 (0)