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

Commitfde5f13

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 parent787d06a commitfde5f13

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
@@ -1707,7 +1707,12 @@ ProcessRepliesIfAny(void)
17071707

17081708
last_processing=GetCurrentTimestamp();
17091709

1710-
for (;;)
1710+
/*
1711+
* If we already received a CopyDone from the frontend, any subsequent
1712+
* message is the beginning of a new command, and should be processed in
1713+
* the main processing loop.
1714+
*/
1715+
while (!streamingDoneReceiving)
17111716
{
17121717
pq_startmsgread();
17131718
r=pq_getbyte_if_available(&firstchar);
@@ -1736,19 +1741,6 @@ ProcessRepliesIfAny(void)
17361741
proc_exit(0);
17371742
}
17381743

1739-
/*
1740-
* If we already received a CopyDone from the frontend, the frontend
1741-
* should not send us anything until we've closed our end of the COPY.
1742-
* XXX: In theory, the frontend could already send the next command
1743-
* before receiving the CopyDone, but libpq doesn't currently allow
1744-
* that.
1745-
*/
1746-
if (streamingDoneReceiving&&firstchar!='X')
1747-
ereport(FATAL,
1748-
(errcode(ERRCODE_PROTOCOL_VIOLATION),
1749-
errmsg("unexpected standby message type \"%c\", after receiving CopyDone",
1750-
firstchar)));
1751-
17521744
/* Handle the very limited subset of commands expected in this phase */
17531745
switch (firstchar)
17541746
{
@@ -2349,8 +2341,10 @@ WalSndLoop(WalSndSendDataCallback send_data)
23492341
longsleeptime;
23502342
intwakeEvents;
23512343

2352-
wakeEvents=WL_LATCH_SET |WL_EXIT_ON_PM_DEATH |WL_TIMEOUT |
2353-
WL_SOCKET_READABLE;
2344+
wakeEvents=WL_LATCH_SET |WL_EXIT_ON_PM_DEATH |WL_TIMEOUT;
2345+
2346+
if (!streamingDoneReceiving)
2347+
wakeEvents |=WL_SOCKET_READABLE;
23542348

23552349
/*
23562350
* Use fresh timestamp, not last_processing, to reduce the chance

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp