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

Commita58db3a

Browse files
committed
Revert "Cannot use WL_SOCKET_WRITEABLE without WL_SOCKET_READABLE."
This reverts commit3a9e64a.Commit4bad60e fixed the root of the problem that3a9e64a workedaround.This enables proper pipelining of commands after terminatingreplication, eliminating an undocumented limitation.Discussion:https://postgr.es/m/3d57bc29-4459-578b-79cb-7641baf53c57%40iki.fiBackpatch-through: 9.5
1 parent9b58495 commita58db3a

File tree

1 file changed

+10
-16
lines changed

1 file changed

+10
-16
lines changed

‎src/backend/replication/walsender.c

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1719,7 +1719,12 @@ ProcessRepliesIfAny(void)
17191719

17201720
last_processing=GetCurrentTimestamp();
17211721

1722-
for (;;)
1722+
/*
1723+
* If we already received a CopyDone from the frontend, any subsequent
1724+
* message is the beginning of a new command, and should be processed in
1725+
* the main processing loop.
1726+
*/
1727+
while (!streamingDoneReceiving)
17231728
{
17241729
pq_startmsgread();
17251730
r=pq_getbyte_if_available(&firstchar);
@@ -1748,19 +1753,6 @@ ProcessRepliesIfAny(void)
17481753
proc_exit(0);
17491754
}
17501755

1751-
/*
1752-
* If we already received a CopyDone from the frontend, the frontend
1753-
* should not send us anything until we've closed our end of the COPY.
1754-
* XXX: In theory, the frontend could already send the next command
1755-
* before receiving the CopyDone, but libpq doesn't currently allow
1756-
* that.
1757-
*/
1758-
if (streamingDoneReceiving&&firstchar!='X')
1759-
ereport(FATAL,
1760-
(errcode(ERRCODE_PROTOCOL_VIOLATION),
1761-
errmsg("unexpected standby message type \"%c\", after receiving CopyDone",
1762-
firstchar)));
1763-
17641756
/* Handle the very limited subset of commands expected in this phase */
17651757
switch (firstchar)
17661758
{
@@ -2362,8 +2354,10 @@ WalSndLoop(WalSndSendDataCallback send_data)
23622354
longsleeptime;
23632355
intwakeEvents;
23642356

2365-
wakeEvents=WL_LATCH_SET |WL_EXIT_ON_PM_DEATH |WL_TIMEOUT |
2366-
WL_SOCKET_READABLE;
2357+
wakeEvents=WL_LATCH_SET |WL_EXIT_ON_PM_DEATH |WL_TIMEOUT;
2358+
2359+
if (!streamingDoneReceiving)
2360+
wakeEvents |=WL_SOCKET_READABLE;
23672361

23682362
/*
23692363
* Use fresh timestamp, not last_processing, to reduce the chance

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp