@@ -503,26 +503,28 @@ ReceiveXlogStream(PGconn *conn, StreamCtl *stream)
503503if (!CheckServerVersionForStreaming (conn ))
504504return 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+ */
506517if (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- */
520519reportFlushPosition = true;
521520sprintf (slotcmd ,"SLOT \"%s\" " ,replication_slot );
522521}
523522else
524523{
525- reportFlushPosition = false;
524+ if (stream -> synchronous )
525+ reportFlushPosition = true;
526+ else
527+ reportFlushPosition = false;
526528slotcmd [0 ]= 0 ;
527529}
528530