diff options
author | Robert Haas <rhaas@postgresql.org> | 2010-11-09 22:39:43 -0500 |
---|---|---|
committer | Robert Haas <rhaas@postgresql.org> | 2010-11-09 22:52:19 -0500 |
commit | 7ba6e4f0e08bd7bdf4d12974ac1e37fb0459c97c (patch) | |
tree | 0f7ff7825f6e5e8ed2e31be4126d8f2a8d6bc724 /src/backend/access | |
parent | 844ed5dc97d4374a4056f0f1cc3b0b78347c74c5 (diff) | |
download | postgresql-7ba6e4f0e08bd7bdf4d12974ac1e37fb0459c97c.tar.gz postgresql-7ba6e4f0e08bd7bdf4d12974ac1e37fb0459c97c.zip |
Add monitoring function pg_last_xact_replay_timestamp.
Fujii Masao, with a little wordsmithing by me.
Diffstat (limited to 'src/backend/access')
-rw-r--r-- | src/backend/access/transam/xlog.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 786d0c696d1..7708b93fffb 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -5605,6 +5605,24 @@ GetLatestXTime(void) } /* + * Returns timestamp of latest processed commit/abort record. + * + * When the server has been started normally without recovery the function + * returns NULL. + */ +Datum +pg_last_xact_replay_timestamp(PG_FUNCTION_ARGS) +{ + TimestampTz xtime; + + xtime = GetLatestXTime(); + if (xtime == 0) + PG_RETURN_NULL(); + + PG_RETURN_TIMESTAMPTZ(xtime); +} + +/* * Returns bool with current recovery mode, a global state. */ Datum |