Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit346d7cd

Browse files
committed
Return NULL instead of 0/0 in pg_last_xlog_receive_location() and
pg_last_xlog_replay_location(). Per Robert Haas's suggestion, afterItagaki Takahiro pointed out an issue in the docs. Also, some wordingchanges in the docs by me.
1 parent4ddf151 commit346d7cd

File tree

2 files changed

+16
-11
lines changed

2 files changed

+16
-11
lines changed

‎doc/src/sgml/func.sgml

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- $PostgreSQL: pgsql/doc/src/sgml/func.sgml,v 1.517 2010/06/05 14:56:36 tgl Exp $ -->
1+
<!-- $PostgreSQL: pgsql/doc/src/sgml/func.sgml,v 1.518 2010/06/10 07:00:25 heikki Exp $ -->
22

33
<chapter id="functions">
44
<title>Functions and Operators</title>
@@ -13280,13 +13280,12 @@ postgres=# SELECT * FROM pg_xlogfile_name_offset(pg_stop_backup());
1328013280
<literal><function>pg_last_xlog_receive_location</function>()</literal>
1328113281
</entry>
1328213282
<entry><type>text</type></entry>
13283-
<entry>Get last transaction log location received and synced to disk during
13284-
streaming recovery. If streaming recovery is still in progress
13285-
this will increase monotonically. If streaming recovery has completed
13286-
then this value will remain static at the value of the last WAL record
13287-
received and synced to disk during that recovery. When the server has
13288-
been started without a streaming recovery then the return value will be
13289-
InvalidXLogRecPtr (0/0).
13283+
<entry>Get last transaction log location received and synced to disk by
13284+
streaming replication. While streaming replication is in progress
13285+
this will increase monotonically. If recovevery has completed
13286+
this will remain static at the value of the last WAL record
13287+
received and synced to disk during recovery. If streaming replication
13288+
is disabled, or it has not yet started, the function returns NULL.
1329013289
</entry>
1329113290
</row>
1329213291
<row>
@@ -13298,8 +13297,8 @@ postgres=# SELECT * FROM pg_xlogfile_name_offset(pg_stop_backup());
1329813297
If recovery is still in progress this will increase monotonically.
1329913298
If recovery has completed then this value will remain static at
1330013299
the value of the last WAL record applied during that recovery.
13301-
When the server has been started normally withoutarecovery
13302-
thenthereturn value will be InvalidXLogRecPtr (0/0).
13300+
When the server has been started normally without recovery
13301+
thefunction returns NULL.
1330313302
</entry>
1330413303
</row>
1330513304
</tbody>

‎src/backend/access/transam/xlog.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group
88
* Portions Copyright (c) 1994, Regents of the University of California
99
*
10-
* $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.419 2010/06/09 15:04:06 heikki Exp $
10+
* $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.420 2010/06/10 07:00:27 heikki Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -8757,6 +8757,9 @@ pg_last_xlog_receive_location(PG_FUNCTION_ARGS)
87578757

87588758
recptr=GetWalRcvWriteRecPtr();
87598759

8760+
if (recptr.xlogid==0&&recptr.xrecoff==0)
8761+
PG_RETURN_NULL();
8762+
87608763
snprintf(location,sizeof(location),"%X/%X",
87618764
recptr.xlogid,recptr.xrecoff);
87628765
PG_RETURN_TEXT_P(cstring_to_text(location));
@@ -8780,6 +8783,9 @@ pg_last_xlog_replay_location(PG_FUNCTION_ARGS)
87808783
recptr=xlogctl->recoveryLastRecPtr;
87818784
SpinLockRelease(&xlogctl->info_lck);
87828785

8786+
if (recptr.xlogid==0&&recptr.xrecoff==0)
8787+
PG_RETURN_NULL();
8788+
87838789
snprintf(location,sizeof(location),"%X/%X",
87848790
recptr.xlogid,recptr.xrecoff);
87858791
PG_RETURN_TEXT_P(cstring_to_text(location));

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp