mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-12-21 08:29:39 +08:00
Use pg_lsn data type in pg_stat_replication, too.
Michael Paquier, per a suggestion from Andres Freund
This commit is contained in:
parent
bb818b53d4
commit
6615e77439
@ -1490,24 +1490,24 @@ postgres: <replaceable>user</> <replaceable>database</> <replaceable>host</> <re
|
||||
</row>
|
||||
<row>
|
||||
<entry><structfield>sent_location</></entry>
|
||||
<entry><type>text</></entry>
|
||||
<entry><type>pg_lsn</></entry>
|
||||
<entry>Last transaction log position sent on this connection</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><structfield>write_location</></entry>
|
||||
<entry><type>text</></entry>
|
||||
<entry><type>pg_lsn</></entry>
|
||||
<entry>Last transaction log position written to disk by this standby
|
||||
server</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><structfield>flush_location</></entry>
|
||||
<entry><type>text</></entry>
|
||||
<entry><type>pg_lsn</></entry>
|
||||
<entry>Last transaction log position flushed to disk by this standby
|
||||
server</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><structfield>replay_location</></entry>
|
||||
<entry><type>text</></entry>
|
||||
<entry><type>pg_lsn</></entry>
|
||||
<entry>Last transaction log position replayed into the database on this
|
||||
standby server</entry>
|
||||
</row>
|
||||
|
@ -67,6 +67,7 @@
|
||||
#include "utils/builtins.h"
|
||||
#include "utils/guc.h"
|
||||
#include "utils/memutils.h"
|
||||
#include "utils/pg_lsn.h"
|
||||
#include "utils/ps_status.h"
|
||||
#include "utils/resowner.h"
|
||||
#include "utils/timeout.h"
|
||||
@ -2137,7 +2138,6 @@ pg_stat_get_wal_senders(PG_FUNCTION_ARGS)
|
||||
{
|
||||
/* use volatile pointer to prevent code rearrangement */
|
||||
volatile WalSnd *walsnd = &WalSndCtl->walsnds[i];
|
||||
char location[MAXFNAMELEN];
|
||||
XLogRecPtr sentPtr;
|
||||
XLogRecPtr write;
|
||||
XLogRecPtr flush;
|
||||
@ -2171,28 +2171,19 @@ pg_stat_get_wal_senders(PG_FUNCTION_ARGS)
|
||||
else
|
||||
{
|
||||
values[1] = CStringGetTextDatum(WalSndGetStateString(state));
|
||||
|
||||
snprintf(location, sizeof(location), "%X/%X",
|
||||
(uint32) (sentPtr >> 32), (uint32) sentPtr);
|
||||
values[2] = CStringGetTextDatum(location);
|
||||
values[2] = LSNGetDatum(sentPtr);
|
||||
|
||||
if (write == 0)
|
||||
nulls[3] = true;
|
||||
snprintf(location, sizeof(location), "%X/%X",
|
||||
(uint32) (write >> 32), (uint32) write);
|
||||
values[3] = CStringGetTextDatum(location);
|
||||
values[3] = LSNGetDatum(write);
|
||||
|
||||
if (flush == 0)
|
||||
nulls[4] = true;
|
||||
snprintf(location, sizeof(location), "%X/%X",
|
||||
(uint32) (flush >> 32), (uint32) flush);
|
||||
values[4] = CStringGetTextDatum(location);
|
||||
values[4] = LSNGetDatum(flush);
|
||||
|
||||
if (apply == 0)
|
||||
nulls[5] = true;
|
||||
snprintf(location, sizeof(location), "%X/%X",
|
||||
(uint32) (apply >> 32), (uint32) apply);
|
||||
values[5] = CStringGetTextDatum(location);
|
||||
values[5] = LSNGetDatum(apply);
|
||||
|
||||
values[6] = Int32GetDatum(sync_priority[i]);
|
||||
|
||||
|
@ -53,6 +53,6 @@
|
||||
*/
|
||||
|
||||
/* yyyymmddN */
|
||||
#define CATALOG_VERSION_NO 201402192
|
||||
#define CATALOG_VERSION_NO 201402241
|
||||
|
||||
#endif
|
||||
|
@ -2634,7 +2634,7 @@ DATA(insert OID = 1936 ( pg_stat_get_backend_idset PGNSP PGUID 12 1 100 0 0 f
|
||||
DESCR("statistics: currently active backend IDs");
|
||||
DATA(insert OID = 2022 ( pg_stat_get_activity PGNSP PGUID 12 1 100 0 0 f f f f f t s 1 0 2249 "23" "{23,26,23,26,25,25,25,16,1184,1184,1184,1184,869,25,23}" "{i,o,o,o,o,o,o,o,o,o,o,o,o,o,o}" "{pid,datid,pid,usesysid,application_name,state,query,waiting,xact_start,query_start,backend_start,state_change,client_addr,client_hostname,client_port}" _null_ pg_stat_get_activity _null_ _null_ _null_ ));
|
||||
DESCR("statistics: information about currently active backends");
|
||||
DATA(insert OID = 3099 ( pg_stat_get_wal_senders PGNSP PGUID 12 1 10 0 0 f f f f f t s 0 0 2249 "" "{23,25,25,25,25,25,23,25}" "{o,o,o,o,o,o,o,o}" "{pid,state,sent_location,write_location,flush_location,replay_location,sync_priority,sync_state}" _null_ pg_stat_get_wal_senders _null_ _null_ _null_ ));
|
||||
DATA(insert OID = 3099 ( pg_stat_get_wal_senders PGNSP PGUID 12 1 10 0 0 f f f f f t s 0 0 2249 "" "{23,25,3220,3220,3220,3220,23,25}" "{o,o,o,o,o,o,o,o}" "{pid,state,sent_location,write_location,flush_location,replay_location,sync_priority,sync_state}" _null_ pg_stat_get_wal_senders _null_ _null_ _null_ ));
|
||||
DESCR("statistics: information about currently active replication");
|
||||
DATA(insert OID = 2026 ( pg_backend_pid PGNSP PGUID 12 1 0 0 0 f f f f t f s 0 0 23 "" _null_ _null_ _null_ _null_ pg_backend_pid _null_ _null_ _null_ ));
|
||||
DESCR("statistics: current backend PID");
|
||||
|
Loading…
Reference in New Issue
Block a user