Skip to content

Commit 2af568c

Browse files
committed
Report WAL flush, not insert, position in replication IDENTIFY_SYSTEM
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.
1 parent eae798a commit 2af568c

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

doc/src/sgml/protocol.sgml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1338,7 +1338,7 @@ The commands accepted in walsender mode are:
13381338
</term>
13391339
<listitem>
13401340
<para>
1341-
Current xlog write location. Useful to get a known location in the
1341+
Current xlog flush location. Useful to get a known location in the
13421342
transaction log where streaming can start.
13431343
</para>
13441344
</listitem>

src/backend/replication/walsender.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ IdentifySystem(void)
298298
GetSystemIdentifier());
299299
snprintf(tli, sizeof(tli), "%u", ThisTimeLineID);
300300

301-
logptr = am_cascading_walsender ? GetStandbyFlushRecPtr(NULL) : GetInsertRecPtr();
301+
logptr = am_cascading_walsender ? GetStandbyFlushRecPtr(NULL) : GetFlushRecPtr();
302302

303303
snprintf(xpos, sizeof(xpos), "%X/%X",
304304
logptr.xlogid, logptr.xrecoff);

0 commit comments

Comments
 (0)