Report WAL flush, not insert, position in replication IDENTIFY_SYSTEM
authorHeikki Linnakangas
Fri, 6 Feb 2015 09:18:14 +0000 (11:18 +0200)
committerHeikki Linnakangas
Fri, 6 Feb 2015 09:32:16 +0000 (11:32 +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 1457ae845232e63db0a05c0a7c6f19bb581d7f6d..428d22040da41fd88388435e9485f783bc76b02d 100644 (file)
@@ -1350,7 +1350,7 @@ The commands accepted in walsender mode are:
       
       
       
-       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.
       
       
index 442b13a1123c64c56caf3854264bbcf6b08bd506..68b4f4f0e4b7284fb8d2eaa842a7a19ba1266c34 100644 (file)
@@ -259,7 +259,7 @@ IdentifySystem(void)
        logptr = GetStandbyFlushRecPtr();
    }
    else
-       logptr = GetInsertRecPtr();
+       logptr = GetFlushRecPtr();
 
    snprintf(tli, sizeof(tli), "%u", ThisTimeLineID);