mirror of
https://github.com/EnterpriseDB/repmgr.git
synced 2026-03-23 15:16:29 +00:00
and replaced by GetLatestXTime() but this function cannot be called from external programs. Instead now we are using GetXLogReceiptTime() which tells us what was the last time we got a WAL record by streaming or file.
43 lines
722 B
C
43 lines
722 B
C
/*
|
|
* repmgr_wrapper_funcs.c
|
|
* Copyright (c) 2ndQuadrant, 2010
|
|
*
|
|
* Expose some backend functions in SQL
|
|
*/
|
|
|
|
#include "postgres.h"
|
|
#include "fmgr.h"
|
|
#include "access/xlog.h"
|
|
#include "storage/procarray.h"
|
|
|
|
PG_MODULE_MAGIC;
|
|
|
|
Datum last_xlog_replay_timestamp(PG_FUNCTION_ARGS);
|
|
Datum oldest_xmin(PG_FUNCTION_ARGS);
|
|
|
|
PG_FUNCTION_INFO_V1(last_xlog_replay_timestamp);
|
|
|
|
Datum
|
|
last_xlog_replay_timestamp(PG_FUNCTION_ARGS)
|
|
{
|
|
TimestampTz rTime;
|
|
bool fromSource;
|
|
|
|
if (!InRecovery)
|
|
PG_RETURN_NULL();
|
|
else
|
|
{
|
|
GetXLogReceiptTime(&rTime, &fromStream);
|
|
PG_RETURN_TIMESTAMPTZ(rTime);
|
|
}
|
|
}
|
|
|
|
|
|
PG_FUNCTION_INFO_V1(oldest_xmin);
|
|
|
|
Datum
|
|
oldest_xmin(PG_FUNCTION_ARGS)
|
|
{
|
|
PG_RETURN_INT64(GetOldestXmin(false, false));
|
|
}
|