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 | |
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')
-rw-r--r-- | src/backend/access/transam/xlog.c | 18 | ||||
-rw-r--r-- | src/include/access/xlog_internal.h | 1 | ||||
-rw-r--r-- | src/include/catalog/catversion.h | 2 | ||||
-rw-r--r-- | src/include/catalog/pg_proc.h | 2 |
4 files changed, 22 insertions, 1 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 diff --git a/src/include/access/xlog_internal.h b/src/include/access/xlog_internal.h index 370c989ac05..29a50838fa4 100644 --- a/src/include/access/xlog_internal.h +++ b/src/include/access/xlog_internal.h @@ -271,6 +271,7 @@ extern Datum pg_current_xlog_location(PG_FUNCTION_ARGS); extern Datum pg_current_xlog_insert_location(PG_FUNCTION_ARGS); extern Datum pg_last_xlog_receive_location(PG_FUNCTION_ARGS); extern Datum pg_last_xlog_replay_location(PG_FUNCTION_ARGS); +extern Datum pg_last_xact_replay_timestamp(PG_FUNCTION_ARGS); extern Datum pg_xlogfile_name_offset(PG_FUNCTION_ARGS); extern Datum pg_xlogfile_name(PG_FUNCTION_ARGS); extern Datum pg_is_in_recovery(PG_FUNCTION_ARGS); diff --git a/src/include/catalog/catversion.h b/src/include/catalog/catversion.h index 0c1abdbe898..703cbea7d86 100644 --- a/src/include/catalog/catversion.h +++ b/src/include/catalog/catversion.h @@ -53,6 +53,6 @@ */ /* yyyymmddN */ -#define CATALOG_VERSION_NO 201010301 +#define CATALOG_VERSION_NO 201011091 #endif diff --git a/src/include/catalog/pg_proc.h b/src/include/catalog/pg_proc.h index 12c640c3d00..4f444aef833 100644 --- a/src/include/catalog/pg_proc.h +++ b/src/include/catalog/pg_proc.h @@ -3383,6 +3383,8 @@ DATA(insert OID = 3820 ( pg_last_xlog_receive_location PGNSP PGUID 12 1 0 0 f f DESCR("current xlog flush location"); DATA(insert OID = 3821 ( pg_last_xlog_replay_location PGNSP PGUID 12 1 0 0 f f f t f v 0 0 25 "" _null_ _null_ _null_ _null_ pg_last_xlog_replay_location _null_ _null_ _null_ )); DESCR("last xlog replay location"); +DATA(insert OID = 3830 ( pg_last_xact_replay_timestamp PGNSP PGUID 12 1 0 0 f f f t f v 0 0 1184 "" _null_ _null_ _null_ _null_ pg_last_xact_replay_timestamp _null_ _null_ _null_ )); +DESCR("timestamp of last replay xact"); DATA(insert OID = 2621 ( pg_reload_conf PGNSP PGUID 12 1 0 0 f f f t f v 0 0 16 "" _null_ _null_ _null_ _null_ pg_reload_conf _null_ _null_ _null_ )); DESCR("reload configuration files"); |