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

Commit4934062

Browse files
Fix pg_receivexlog --synchronous
Make pg_receivexlog work correctly with --synchronous without slotsBackpatch to 9.5Gabriele Bartolini, reviewed by Michael Paquier and Simon Riggs
1 parentbd08223 commit4934062

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

‎src/bin/pg_basebackup/receivelog.c

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -503,26 +503,28 @@ ReceiveXlogStream(PGconn *conn, StreamCtl *stream)
503503
if (!CheckServerVersionForStreaming(conn))
504504
return false;
505505

506+
/*
507+
* Decide whether we want to report the flush position. If we report
508+
* the flush position, the primary will know what WAL we'll
509+
* possibly re-request, and it can then remove older WAL safely.
510+
* We must always do that when we are using slots.
511+
*
512+
* Reporting the flush position makes one eligible as a synchronous
513+
* replica. People shouldn't include generic names in
514+
* synchronous_standby_names, but we've protected them against it so
515+
* far, so let's continue to do so unless specifically requested.
516+
*/
506517
if (replication_slot!=NULL)
507518
{
508-
/*
509-
* Report the flush position, so the primary can know what WAL we'll
510-
* possibly re-request, and remove older WAL safely.
511-
*
512-
* We only report it when a slot has explicitly been used, because
513-
* reporting the flush position makes one eligible as a synchronous
514-
* replica. People shouldn't include generic names in
515-
* synchronous_standby_names, but we've protected them against it so
516-
* far, so let's continue to do so in the situations when possible. If
517-
* they've got a slot, though, we need to report the flush position,
518-
* so that the master can remove WAL.
519-
*/
520519
reportFlushPosition= true;
521520
sprintf(slotcmd,"SLOT \"%s\" ",replication_slot);
522521
}
523522
else
524523
{
525-
reportFlushPosition= false;
524+
if (stream->synchronous)
525+
reportFlushPosition= true;
526+
else
527+
reportFlushPosition= false;
526528
slotcmd[0]=0;
527529
}
528530

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp