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

Commite434ad3

Browse files
committed
Reorder the asynchronous libpq calls for replication connection
Per libpq documentation, the initial state must bePGRES_POLLING_WRITING. Failing to do that appears to cause some issueson some Windows systems.From: Petr Jelinek <petr.jelinek@2ndquadrant.com>
1 parent6f3a13f commite434ad3

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

‎src/backend/replication/libpqwalreceiver/libpqwalreceiver.c

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -155,12 +155,16 @@ libpqrcv_connect(const char *conninfo, bool logical, const char *appname,
155155
returnNULL;
156156
}
157157

158-
/* Poll connection. */
159-
do
158+
/*
159+
* Poll connection until we have OK or FAILED status.
160+
*
161+
* Note that the initial state after PQconnectStartParams is
162+
* PGRES_POLLING_WRITING.
163+
*/
164+
for (status=PGRES_POLLING_WRITING;
165+
status!=PGRES_POLLING_OK&&status!=PGRES_POLLING_FAILED;
166+
status=PQconnectPoll(conn->streamConn))
160167
{
161-
/* Determine current state of the connection. */
162-
status=PQconnectPoll(conn->streamConn);
163-
164168
/* Sleep a bit if waiting for socket. */
165169
if (status==PGRES_POLLING_READING||
166170
status==PGRES_POLLING_WRITING)
@@ -188,9 +192,7 @@ libpqrcv_connect(const char *conninfo, bool logical, const char *appname,
188192
if (rc&WL_LATCH_SET)
189193
CHECK_FOR_INTERRUPTS();
190194
}
191-
192-
/* Otherwise loop until we have OK or FAILED status. */
193-
}while (status!=PGRES_POLLING_OK&&status!=PGRES_POLLING_FAILED);
195+
}
194196

195197
if (PQstatus(conn->streamConn)!=CONNECTION_OK)
196198
{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp