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

Commitc3e7c24

Browse files
committed
libpq: Notice errors a backend may have sent just before dying.
At least since the introduction of Hot Standby, the backend hassometimes sent fatal errors even when no client query was inprogress, assuming that the client would receive it. However,pqHandleSendFailure was not in sync with this assumption, andonly tries to catch notices and notifies. Add a parseInput callto the loop there to fix.Andres Freund suggested the fix. Comments are by me.Reviewed by Michael Paquier.
1 parentac1d794 commitc3e7c24

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

‎src/interfaces/libpq/fe-exec.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1553,25 +1553,25 @@ PQsendQueryGuts(PGconn *conn,
15531553
/*
15541554
* pqHandleSendFailure: try to clean up after failure to send command.
15551555
*
1556-
* Primarily, what we want to accomplish here is to processan async
1557-
*NOTICE message thatthe backend might have sent just before it died.
1556+
* Primarily, what we want to accomplish here is to processany messages that
1557+
* the backend might have sent just before it died.
15581558
*
15591559
* NOTE: this routine should only be called in PGASYNC_IDLE state.
15601560
*/
15611561
void
15621562
pqHandleSendFailure(PGconn*conn)
15631563
{
15641564
/*
1565-
* Accept any available input data, ignoring errors. Note that if
1566-
*pqReadDatadecides the backend has closed the channel, it will close
1567-
*our side ofthe socket --- that's just what we want here.
1565+
* Acceptand parseany available input data. Note that if pqReadData
1566+
* decides the backend has closed the channel, it will close our side of
1567+
* the socket --- that's just what we want here.
15681568
*/
15691569
while (pqReadData(conn)>0)
1570-
/* loop until no more data readable */;
1570+
parseInput(conn);
15711571

15721572
/*
1573-
*Parse anyavailable input messages. Since weare in PGASYNC_IDLE
1574-
*state, only NOTICE and NOTIFY messages will be eaten.
1573+
*Make one attempt to parseavailable input messages even if weread no
1574+
*data.
15751575
*/
15761576
parseInput(conn);
15771577
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp