]> granicus.if.org Git - postgresql/commitdiff
Report WAL flush, not insert, position in replication IDENTIFY_SYSTEM
authorHeikki Linnakangas <heikki.linnakangas@iki.fi>
Fri, 6 Feb 2015 09:18:14 +0000 (11:18 +0200)
committerHeikki Linnakangas <heikki.linnakangas@iki.fi>
Fri, 6 Feb 2015 09:26:50 +0000 (11:26 +0200)
When beginning streaming replication, the client usually issues the
IDENTIFY_SYSTEM command, which used to return the current WAL insert
position. That's not suitable for the intended purpose of that field,
however. pg_receivexlog uses it to start replication from the reported
point, but if it hasn't been flushed to disk yet, it will fail. Change
IDENTIFY_SYSTEM to report the flush position instead.

Backpatch to 9.1 and above. 9.0 doesn't report any WAL position.

doc/src/sgml/protocol.sgml
src/backend/replication/walsender.c

index efe75ea493d5874a2ccda48cf82e2cd04d7febae..3a753a0b9b17e2a65f218eb4dc12fb5df9ada32b 100644 (file)
@@ -1371,7 +1371,7 @@ The commands accepted in walsender mode are:
       </term>
       <listitem>
       <para>
-       Current xlog write location. Useful to get a known location in the
+       Current xlog flush location. Useful to get a known location in the
        transaction log where streaming can start.
       </para>
       </listitem>
index 25fcbca39e9cd0de923065cd53ee905297f5b72b..af5c1cc3ba275b2a2cd7f3fa9b4def40b0ef3551 100644 (file)
@@ -316,7 +316,7 @@ IdentifySystem(void)
                logptr = GetStandbyFlushRecPtr();
        }
        else
-               logptr = GetInsertRecPtr();
+               logptr = GetFlushRecPtr();
 
        snprintf(tli, sizeof(tli), "%u", ThisTimeLineID);