Apply log should be pg_xlog_receive_location() - pg_xlog_replay_location().

Also remove get_last_xlog_replay_timestamp() function and the sql_utils dir,
we can readded later if we need.
We don't need the column last_wal_standby_timestamp in repl_status, so
remove it
This commit is contained in:
postgres
2010-09-14 10:08:45 -05:00
parent d728ef0eef
commit 362f931355
7 changed files with 7 additions and 82 deletions

9
main.c
View File

@@ -195,7 +195,6 @@ MonitorExecute(void)
char last_wal_primary_location[MAXLEN];
char last_wal_standby_received[MAXLEN];
char last_wal_standby_applied[MAXLEN];
char last_wal_standby_timestamp[MAXLEN];
unsigned long long int lsn_primary;
unsigned long long int lsn_standby_received;
@@ -204,7 +203,7 @@ MonitorExecute(void)
/* Get local xlog info */
sprintf(sqlquery,
"SELECT CURRENT_TIMESTAMP, pg_last_xlog_receive_location(), "
"pg_last_xlog_replay_location(), get_last_xlog_replay_timestamp()");
"pg_last_xlog_replay_location()");
res = PQexec(myLocalConn, sqlquery);
if (PQresultStatus(res) != PGRES_TUPLES_OK)
@@ -217,7 +216,6 @@ MonitorExecute(void)
strcpy(monitor_standby_timestamp, PQgetvalue(res, 0, 0));
strcpy(last_wal_standby_received , PQgetvalue(res, 0, 1));
strcpy(last_wal_standby_applied , PQgetvalue(res, 0, 2));
strcpy(last_wal_standby_timestamp, PQgetvalue(res, 0, 3));
PQclear(res);
/* Get primary xlog info */
@@ -246,13 +244,12 @@ MonitorExecute(void)
"INSERT INTO repl_status "
"VALUES(%d, %d, '%s'::timestamp with time zone, "
" '%s', '%s', "
" '%s'::timestamp with time zone, "
" %lld, %lld)",
primaryId, myLocalId, monitor_standby_timestamp,
last_wal_primary_location,
last_wal_standby_received, last_wal_standby_timestamp,
last_wal_standby_received,
(lsn_primary - lsn_standby_received),
(lsn_standby_applied - lsn_standby_received));
(lsn_standby_received - lsn_standby_applied));
/*
* Execute the query asynchronously, but don't check for a result. We