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

Commit3684a53

Browse files
committed
I added a result set to START_STREAMING command, but neglected walreceiver.
The patch to allow pg_receivexlog to switch timeline added a result setafter copy has ended in START_STREAMING command, to return the nexttimeline's ID to the client. But walreceived didn't get the memo, and threwan error on the unexpected result set. Fix.
1 parent279628a commit3684a53

File tree

2 files changed

+18
-6
lines changed

2 files changed

+18
-6
lines changed

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

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -215,17 +215,27 @@ libpqrcv_endstreaming(void)
215215

216216
while ((res=PQgetResult(streamConn))!=NULL)
217217
{
218-
if (PQresultStatus(res)!=PGRES_COMMAND_OK)
219-
ereport(ERROR,
220-
(errmsg("error reading result of streaming command: %s",
221-
PQerrorMessage(streamConn))));
222218
/*
219+
* After Copy, if the streaming ended because we reached end of the
220+
* timeline, server sends one result set with the next timeline's ID.
221+
* We don't need it, so just slurp and ignore it.
222+
*
223223
* If we had not yet received CopyDone from the backend, PGRES_COPY_IN
224224
* is also possible. However, at the moment this function is only
225225
* called after receiving CopyDone from the backend - the walreceiver
226226
* never terminates replication on its own initiative.
227227
*/
228-
228+
switch (PQresultStatus(res))
229+
{
230+
casePGRES_COMMAND_OK:
231+
casePGRES_TUPLES_OK:
232+
break;
233+
234+
default:
235+
ereport(ERROR,
236+
(errmsg("error reading result of streaming command: %s",
237+
PQerrorMessage(streamConn))));
238+
}
229239
PQclear(res);
230240
}
231241
}

‎src/backend/replication/walreceiver.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,9 @@ WalReceiverMain(void)
431431
{
432432
ereport(LOG,
433433
(errmsg("replication terminated by primary server"),
434-
errdetail("End of WAL reached on timeline %u",startpointTLI)));
434+
errdetail("End of WAL reached on timeline %u at %X/%X",
435+
startpointTLI,
436+
(uint32) (LogstreamResult.Write >>32), (uint32)LogstreamResult.Write)));
435437
endofwal= true;
436438
break;
437439
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp