Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit6615e77

Browse files
committed
Use pg_lsn data type in pg_stat_replication, too.
Michael Paquier, per a suggestion from Andres Freund
1 parentbb818b5 commit6615e77

File tree

4 files changed

+11
-20
lines changed

4 files changed

+11
-20
lines changed

‎doc/src/sgml/monitoring.sgml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1490,24 +1490,24 @@ postgres: <replaceable>user</> <replaceable>database</> <replaceable>host</> <re
14901490
</row>
14911491
<row>
14921492
<entry><structfield>sent_location</></entry>
1493-
<entry><type>text</></entry>
1493+
<entry><type>pg_lsn</></entry>
14941494
<entry>Last transaction log position sent on this connection</entry>
14951495
</row>
14961496
<row>
14971497
<entry><structfield>write_location</></entry>
1498-
<entry><type>text</></entry>
1498+
<entry><type>pg_lsn</></entry>
14991499
<entry>Last transaction log position written to disk by this standby
15001500
server</entry>
15011501
</row>
15021502
<row>
15031503
<entry><structfield>flush_location</></entry>
1504-
<entry><type>text</></entry>
1504+
<entry><type>pg_lsn</></entry>
15051505
<entry>Last transaction log position flushed to disk by this standby
15061506
server</entry>
15071507
</row>
15081508
<row>
15091509
<entry><structfield>replay_location</></entry>
1510-
<entry><type>text</></entry>
1510+
<entry><type>pg_lsn</></entry>
15111511
<entry>Last transaction log position replayed into the database on this
15121512
standby server</entry>
15131513
</row>

‎src/backend/replication/walsender.c

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@
6767
#include"utils/builtins.h"
6868
#include"utils/guc.h"
6969
#include"utils/memutils.h"
70+
#include"utils/pg_lsn.h"
7071
#include"utils/ps_status.h"
7172
#include"utils/resowner.h"
7273
#include"utils/timeout.h"
@@ -2137,7 +2138,6 @@ pg_stat_get_wal_senders(PG_FUNCTION_ARGS)
21372138
{
21382139
/* use volatile pointer to prevent code rearrangement */
21392140
volatileWalSnd*walsnd=&WalSndCtl->walsnds[i];
2140-
charlocation[MAXFNAMELEN];
21412141
XLogRecPtrsentPtr;
21422142
XLogRecPtrwrite;
21432143
XLogRecPtrflush;
@@ -2171,28 +2171,19 @@ pg_stat_get_wal_senders(PG_FUNCTION_ARGS)
21712171
else
21722172
{
21732173
values[1]=CStringGetTextDatum(WalSndGetStateString(state));
2174-
2175-
snprintf(location,sizeof(location),"%X/%X",
2176-
(uint32) (sentPtr >>32), (uint32)sentPtr);
2177-
values[2]=CStringGetTextDatum(location);
2174+
values[2]=LSNGetDatum(sentPtr);
21782175

21792176
if (write==0)
21802177
nulls[3]= true;
2181-
snprintf(location,sizeof(location),"%X/%X",
2182-
(uint32) (write >>32), (uint32)write);
2183-
values[3]=CStringGetTextDatum(location);
2178+
values[3]=LSNGetDatum(write);
21842179

21852180
if (flush==0)
21862181
nulls[4]= true;
2187-
snprintf(location,sizeof(location),"%X/%X",
2188-
(uint32) (flush >>32), (uint32)flush);
2189-
values[4]=CStringGetTextDatum(location);
2182+
values[4]=LSNGetDatum(flush);
21902183

21912184
if (apply==0)
21922185
nulls[5]= true;
2193-
snprintf(location,sizeof(location),"%X/%X",
2194-
(uint32) (apply >>32), (uint32)apply);
2195-
values[5]=CStringGetTextDatum(location);
2186+
values[5]=LSNGetDatum(apply);
21962187

21972188
values[6]=Int32GetDatum(sync_priority[i]);
21982189

‎src/include/catalog/catversion.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,6 @@
5353
*/
5454

5555
/*yyyymmddN */
56-
#defineCATALOG_VERSION_NO201402192
56+
#defineCATALOG_VERSION_NO201402241
5757

5858
#endif

‎src/include/catalog/pg_proc.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2634,7 +2634,7 @@ DATA(insert OID = 1936 ( pg_stat_get_backend_idsetPGNSP PGUID 12 1 100 0 0 f
26342634
DESCR("statistics: currently active backend IDs");
26352635
DATA(insertOID=2022 (pg_stat_get_activityPGNSPPGUID12110000fffffts102249"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_ ));
26362636
DESCR("statistics: information about currently active backends");
2637-
DATA(insertOID=3099 (pg_stat_get_wal_sendersPGNSPPGUID1211000fffffts002249"""{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_ ));
2637+
DATA(insertOID=3099 (pg_stat_get_wal_sendersPGNSPPGUID1211000fffffts002249"""{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_ ));
26382638
DESCR("statistics: information about currently active replication");
26392639
DATA(insertOID=2026 (pg_backend_pidPGNSPPGUID121000fffftfs0023""_null__null__null__null_pg_backend_pid_null__null__null_ ));
26402640
DESCR("statistics: current backend PID");

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp