Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 3bc4c69

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 48a565d commit 3bc4c69

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

doc/src/sgml/protocol.sgml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1369,7 +1369,7 @@ The commands accepted in walsender mode are:
13691369
</term>
13701370
<listitem>
13711371
<para>
1372-
Current xlog write location. Useful to get a known location in the
1372+
Current xlog flush location. Useful to get a known location in the
13731373
transaction log where streaming can start.
13741374
</para>
13751375
</listitem>

src/backend/replication/walsender.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ IdentifySystem(void)
315315
logptr = GetStandbyFlushRecPtr();
316316
}
317317
else
318-
logptr = GetInsertRecPtr();
318+
logptr = GetFlushRecPtr();
319319

320320
snprintf(tli, sizeof(tli), "%u", ThisTimeLineID);
321321

0 commit comments

Comments
 (0)