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

Commit3ed0666

Browse files
committed
fix for previous commit
1 parentab3b160 commit3ed0666

File tree

1 file changed

+25
-26
lines changed

1 file changed

+25
-26
lines changed

‎backup.c

Lines changed: 25 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -911,7 +911,6 @@ pg_stop_backup(pgBackup *backup)
911911
XLogRecPtrrestore_lsn;
912912
boolsent= false;
913913
intpg_stop_backup_timeout=0;
914-
intis_busy=1;
915914

916915
/*
917916
* We will use this values if there are no transactions between start_lsn
@@ -1035,37 +1034,37 @@ pg_stop_backup(pgBackup *backup)
10351034
* but no longer than PG_STOP_BACKUP_TIMEOUT seconds
10361035
*/
10371036
elog(INFO,"wait for pg_stop_backup()");
1038-
do
1037+
1038+
while (1)
10391039
{
1040-
/*
1041-
* PQisBusy returns 1 if a command is busy, that is, PQgetResult would
1042-
* block waiting for input. A 0 return indicates that PQgetResult can
1043-
* be called with assurance of not blocking
1044-
*/
1045-
is_busy=PQisBusy(backup_conn);
1046-
pg_stop_backup_timeout++;
1047-
sleep(1);
1040+
if (!PQconsumeInput(backup_conn)||PQisBusy(backup_conn))
1041+
{
1042+
pg_stop_backup_timeout++;
1043+
sleep(1);
10481044

1049-
if (interrupted)
1045+
if (interrupted)
1046+
{
1047+
pgut_cancel(backup_conn);
1048+
elog(ERROR,"interrupted during waiting for pg_stop_backup");
1049+
}
1050+
/*
1051+
* If postgres haven't answered in PG_STOP_BACKUP_TIMEOUT seconds,
1052+
* send an interrupt.
1053+
*/
1054+
if (pg_stop_backup_timeout>PG_STOP_BACKUP_TIMEOUT)
1055+
{
1056+
pgut_cancel(backup_conn);
1057+
elog(ERROR,"pg_stop_backup doesn't answer in %d seconds, cancel it",
1058+
PG_STOP_BACKUP_TIMEOUT);
1059+
}
1060+
}
1061+
else
10501062
{
1051-
pgut_cancel(backup_conn);
1052-
elog(ERROR,"interrupted during waiting for pg_stop_backup");
1063+
res=PQgetResult(backup_conn);
1064+
break;
10531065
}
1054-
1055-
}while (is_busy&&pg_stop_backup_timeout<PG_STOP_BACKUP_TIMEOUT);
1056-
1057-
/*
1058-
* If postgres haven't answered in PG_STOP_BACKUP_TIMEOUT seconds,
1059-
* send an interrupt.
1060-
*/
1061-
if (is_busy)
1062-
{
1063-
pgut_cancel(backup_conn);
1064-
elog(ERROR,"pg_stop_backup doesn't finish in 300 seconds.");
10651066
}
10661067

1067-
res=PQgetResult(backup_conn);
1068-
10691068
if (!res)
10701069
elog(ERROR,"pg_stop backup() failed");
10711070

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp