]> granicus.if.org Git - postgresql/commitdiff
Use pg_lsn data type in pg_stat_replication, too.
authorRobert Haas <rhaas@postgresql.org>
Mon, 24 Feb 2014 15:38:45 +0000 (10:38 -0500)
committerRobert Haas <rhaas@postgresql.org>
Mon, 24 Feb 2014 15:38:45 +0000 (10:38 -0500)
Michael Paquier, per a suggestion from Andres Freund

doc/src/sgml/monitoring.sgml
src/backend/replication/walsender.c
src/include/catalog/catversion.h
src/include/catalog/pg_proc.h

index a37e6b6f33be03940b9bd2d5535e6bccc717ff3a..370857a0e8c7417186b287b25bb3f3432f2a11f3 100644 (file)
@@ -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>
index 06b22e2abace4bb77e40b94be48bcfc177644b18..048367af29901257a0f4fd5284a0420e4ecae853 100644 (file)
@@ -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]);
 
index 1789eb357d505d10e0fcc6e38902f56307ddb6af..68f96bebaf981a917cd9e1f0f3880673980a529e 100644 (file)
@@ -53,6 +53,6 @@
  */
 
 /*                                                     yyyymmddN */
-#define CATALOG_VERSION_NO     201402192
+#define CATALOG_VERSION_NO     201402241
 
 #endif
index 11c1e1abc10d6634f4f3f0524b0b6dfdb3438cb1..a2cc19fd7b61703c1d7f2cafde824bd5d1fbf607 100644 (file)
@@ -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");