diff --git a/src/bin/pg_basebackup/receivelog.c b/src/bin/pg_basebackup/receivelog.c index 595213f..94f1f37 100644 --- a/src/bin/pg_basebackup/receivelog.c +++ b/src/bin/pg_basebackup/receivelog.c @@ -509,7 +509,7 @@ ReceiveXlogStream(PGconn *conn, StreamCtl *stream) * Report the flush position, so the primary can know what WAL we'll * possibly re-request, and remove older WAL safely. * - * We only report it when a slot has explicitly been used, because + * We always report it when a slot has explicitly been used, because * reporting the flush position makes one eligible as a synchronous * replica. People shouldn't include generic names in * synchronous_standby_names, but we've protected them against it so @@ -522,7 +522,14 @@ ReceiveXlogStream(PGconn *conn, StreamCtl *stream) } else { - reportFlushPosition = false; + /* + * If 'synchronous' is true, report flush position unconditionally + * to make pg_receivexlog eligible as a synchronous replica. + */ + if (stream->synchronous) + reportFlushPosition = true; + else + reportFlushPosition = false; slotcmd[0] = 0; }