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

Commitb074813

Browse files
author
Amit Kapila
committed
Revert "Track statistics for spilling of changes from ReorderBuffer".
The stats with this commit was available only for WALSenders, however,users might want to see for backends doing logical decoding via SQL API.Then, users might want to reset and access these stats across serverrestart which was not possible with the current patch.List of commits reverted:caa3c42 Don't call elog() while holding spinlock.e641b2a Doc: Update the documentation for spilled transactionstatistics.5883f5f Fix unportable printf format introduced in commit9290ad1.9290ad1 Track statistics for spilling of changes from ReorderBuffer.Additionaly, remove the release notes entry for this feature.Backpatch-through: 13, where it was introducedDiscussion:https://postgr.es/m/CA+fd4k5_pPAYRTDrO2PbtTOe0eHQpBvuqmCr8ic39uTNmR49Eg@mail.gmail.com
1 parentbc9aaac commitb074813

File tree

10 files changed

+9
-134
lines changed

10 files changed

+9
-134
lines changed

‎doc/src/sgml/monitoring.sgml

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -2462,38 +2462,6 @@ SELECT pid, wait_event_type, wait_event FROM pg_stat_activity WHERE wait_event i
24622462
Send time of last reply message received from standby server
24632463
</para></entry>
24642464
</row>
2465-
2466-
<row>
2467-
<entry role="catalog_table_entry"><para role="column_definition">
2468-
<structfield>spill_txns</structfield> <type>bigint</type>
2469-
</para>
2470-
<para>
2471-
Number of transactions spilled to disk after the memory used by
2472-
logical decoding exceeds <literal>logical_decoding_work_mem</literal>. The
2473-
counter gets incremented both for top-level transactions and
2474-
subtransactions.
2475-
</para></entry>
2476-
</row>
2477-
2478-
<row>
2479-
<entry role="catalog_table_entry"><para role="column_definition">
2480-
<structfield>spill_count</structfield> <type>bigint</type>
2481-
</para>
2482-
<para>
2483-
Number of times transactions were spilled to disk. Transactions
2484-
may get spilled repeatedly, and this counter gets incremented on every
2485-
such invocation.
2486-
</para></entry>
2487-
</row>
2488-
2489-
<row>
2490-
<entry role="catalog_table_entry"><para role="column_definition">
2491-
<structfield>spill_bytes</structfield> <type>bigint</type>
2492-
</para>
2493-
<para>
2494-
Amount of decoded transaction data spilled to disk.
2495-
</para></entry>
2496-
</row>
24972465
</tbody>
24982466
</tgroup>
24992467
</table>
@@ -2518,12 +2486,6 @@ SELECT pid, wait_event_type, wait_event FROM pg_stat_activity WHERE wait_event i
25182486
mechanism will simply display NULL lag.
25192487
</para>
25202488

2521-
<para>
2522-
Tracking of spilled transactions works only for logical replication. In
2523-
physical replication, the tracking mechanism will display 0 for spilled
2524-
statistics.
2525-
</para>
2526-
25272489
<note>
25282490
<para>
25292491
The reported lag times are not predictions of how long it will take for

‎doc/src/sgml/release-13.sgml

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -983,20 +983,6 @@ Author: Alvaro Herrera <alvherre@alvh.no-ip.org>
983983

984984
<listitem>
985985
<!--
986-
Author: Amit Kapila <akapila@postgresql.org>
987-
2019-11-21 [9290ad198] Track statistics for spilling of changes from ReorderBuf
988-
-->
989-
990-
<para>
991-
Add columns to the <link
992-
linkend="monitoring-stats-dynamic-views-table"><structname>pg_stat_replication</structname></link>
993-
system view to report how much logical decoding information has been
994-
spilled to disk (Tomas Vondra)
995-
</para>
996-
</listitem>
997-
998-
<listitem>
999-
<!--
1000986
Author: Robert Haas <rhaas@postgresql.org>
1001987
2020-01-09 [ed10f32e3] Add pg_shmem_allocations view.
1002988
-->

‎src/backend/catalog/system_views.sql

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -785,10 +785,7 @@ CREATE VIEW pg_stat_replication AS
785785
W.replay_lag,
786786
W.sync_priority,
787787
W.sync_state,
788-
W.reply_time,
789-
W.spill_txns,
790-
W.spill_count,
791-
W.spill_bytes
788+
W.reply_time
792789
FROM pg_stat_get_activity(NULL)AS S
793790
JOIN pg_stat_get_wal_senders()AS WON (S.pid=W.pid)
794791
LEFT JOIN pg_authidAS UON (S.usesysid=U.oid);

‎src/backend/replication/logical/reorderbuffer.c

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -317,10 +317,6 @@ ReorderBufferAllocate(void)
317317
buffer->outbufsize=0;
318318
buffer->size=0;
319319

320-
buffer->spillCount=0;
321-
buffer->spillTxns=0;
322-
buffer->spillBytes=0;
323-
324320
buffer->current_restart_decoding_lsn=InvalidXLogRecPtr;
325321

326322
dlist_init(&buffer->toplevel_by_lsn);
@@ -2418,7 +2414,6 @@ ReorderBufferSerializeTXN(ReorderBuffer *rb, ReorderBufferTXN *txn)
24182414
intfd=-1;
24192415
XLogSegNocurOpenSegNo=0;
24202416
Sizespilled=0;
2421-
Sizesize=txn->size;
24222417

24232418
elog(DEBUG2,"spill %u changes in XID %u to disk",
24242419
(uint32)txn->nentries_mem,txn->xid);
@@ -2477,13 +2472,6 @@ ReorderBufferSerializeTXN(ReorderBuffer *rb, ReorderBufferTXN *txn)
24772472
spilled++;
24782473
}
24792474

2480-
/* update the statistics */
2481-
rb->spillCount+=1;
2482-
rb->spillBytes+=size;
2483-
2484-
/* Don't consider already serialized transactions. */
2485-
rb->spillTxns+=rbtxn_is_serialized(txn) ?0 :1;
2486-
24872475
Assert(spilled==txn->nentries_mem);
24882476
Assert(dlist_is_empty(&txn->changes));
24892477
txn->nentries_mem=0;

‎src/backend/replication/walsender.c

Lines changed: 2 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,6 @@ static bool TransactionIdInRecentPast(TransactionId xid, uint32 epoch);
254254

255255
staticvoidWalSndSegmentOpen(XLogReaderState*state,XLogSegNonextSegNo,
256256
TimeLineID*tli_p);
257-
staticvoidUpdateSpillStats(LogicalDecodingContext*ctx);
258257

259258

260259
/* Initialize walsender process before entering the main command loop */
@@ -1348,8 +1347,7 @@ WalSndWriteData(LogicalDecodingContext *ctx, XLogRecPtr lsn, TransactionId xid,
13481347
/*
13491348
* LogicalDecodingContext 'update_progress' callback.
13501349
*
1351-
* Write the current position to the lag tracker (see XLogSendPhysical),
1352-
* and update the spill statistics.
1350+
* Write the current position to the lag tracker (see XLogSendPhysical).
13531351
*/
13541352
staticvoid
13551353
WalSndUpdateProgress(LogicalDecodingContext*ctx,XLogRecPtrlsn,TransactionIdxid)
@@ -1368,11 +1366,6 @@ WalSndUpdateProgress(LogicalDecodingContext *ctx, XLogRecPtr lsn, TransactionId
13681366

13691367
LagTrackerWrite(lsn,now);
13701368
sendTime=now;
1371-
1372-
/*
1373-
* Update statistics about transactions that spilled to disk.
1374-
*/
1375-
UpdateSpillStats(ctx);
13761369
}
13771370

13781371
/*
@@ -2418,9 +2411,6 @@ InitWalSenderSlot(void)
24182411
walsnd->sync_standby_priority=0;
24192412
walsnd->latch=&MyProc->procLatch;
24202413
walsnd->replyTime=0;
2421-
walsnd->spillTxns=0;
2422-
walsnd->spillCount=0;
2423-
walsnd->spillBytes=0;
24242414
SpinLockRelease(&walsnd->mutex);
24252415
/* don't need the lock anymore */
24262416
MyWalSnd= (WalSnd*)walsnd;
@@ -3256,7 +3246,7 @@ offset_to_interval(TimeOffset offset)
32563246
Datum
32573247
pg_stat_get_wal_senders(PG_FUNCTION_ARGS)
32583248
{
3259-
#definePG_STAT_GET_WAL_SENDERS_COLS15
3249+
#definePG_STAT_GET_WAL_SENDERS_COLS12
32603250
ReturnSetInfo*rsinfo= (ReturnSetInfo*)fcinfo->resultinfo;
32613251
TupleDesctupdesc;
32623252
Tuplestorestate*tupstore;
@@ -3310,9 +3300,6 @@ pg_stat_get_wal_senders(PG_FUNCTION_ARGS)
33103300
intpid;
33113301
WalSndStatestate;
33123302
TimestampTzreplyTime;
3313-
int64spillTxns;
3314-
int64spillCount;
3315-
int64spillBytes;
33163303
boolis_sync_standby;
33173304
Datumvalues[PG_STAT_GET_WAL_SENDERS_COLS];
33183305
boolnulls[PG_STAT_GET_WAL_SENDERS_COLS];
@@ -3336,9 +3323,6 @@ pg_stat_get_wal_senders(PG_FUNCTION_ARGS)
33363323
applyLag=walsnd->applyLag;
33373324
priority=walsnd->sync_standby_priority;
33383325
replyTime=walsnd->replyTime;
3339-
spillTxns=walsnd->spillTxns;
3340-
spillCount=walsnd->spillCount;
3341-
spillBytes=walsnd->spillBytes;
33423326
SpinLockRelease(&walsnd->mutex);
33433327

33443328
/*
@@ -3436,11 +3420,6 @@ pg_stat_get_wal_senders(PG_FUNCTION_ARGS)
34363420
nulls[11]= true;
34373421
else
34383422
values[11]=TimestampTzGetDatum(replyTime);
3439-
3440-
/* spill to disk */
3441-
values[12]=Int64GetDatum(spillTxns);
3442-
values[13]=Int64GetDatum(spillCount);
3443-
values[14]=Int64GetDatum(spillBytes);
34443423
}
34453424

34463425
tuplestore_putvalues(tupstore,tupdesc,values,nulls);
@@ -3677,21 +3656,3 @@ LagTrackerRead(int head, XLogRecPtr lsn, TimestampTz now)
36773656
Assert(time!=0);
36783657
returnnow-time;
36793658
}
3680-
3681-
staticvoid
3682-
UpdateSpillStats(LogicalDecodingContext*ctx)
3683-
{
3684-
ReorderBuffer*rb=ctx->reorder;
3685-
3686-
elog(DEBUG2,"UpdateSpillStats: updating stats %p %lld %lld %lld",
3687-
rb,
3688-
(long long)rb->spillTxns,
3689-
(long long)rb->spillCount,
3690-
(long long)rb->spillBytes);
3691-
3692-
SpinLockAcquire(&MyWalSnd->mutex);
3693-
MyWalSnd->spillTxns=rb->spillTxns;
3694-
MyWalSnd->spillCount=rb->spillCount;
3695-
MyWalSnd->spillBytes=rb->spillBytes;
3696-
SpinLockRelease(&MyWalSnd->mutex);
3697-
}

‎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_NO202007071
56+
#defineCATALOG_VERSION_NO202007131
5757

5858
#endif

‎src/include/catalog/pg_proc.dat

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5237,9 +5237,9 @@
52375237
proname => 'pg_stat_get_wal_senders', prorows => '10', proisstrict => 'f',
52385238
proretset => 't', provolatile => 's', proparallel => 'r',
52395239
prorettype => 'record', proargtypes => '',
5240-
proallargtypes => '{int4,text,pg_lsn,pg_lsn,pg_lsn,pg_lsn,interval,interval,interval,int4,text,timestamptz,int8,int8,int8}',
5241-
proargmodes => '{o,o,o,o,o,o,o,o,o,o,o,o,o,o,o}',
5242-
proargnames => '{pid,state,sent_lsn,write_lsn,flush_lsn,replay_lsn,write_lag,flush_lag,replay_lag,sync_priority,sync_state,reply_time,spill_txns,spill_count,spill_bytes}',
5240+
proallargtypes => '{int4,text,pg_lsn,pg_lsn,pg_lsn,pg_lsn,interval,interval,interval,int4,text,timestamptz}',
5241+
proargmodes => '{o,o,o,o,o,o,o,o,o,o,o,o}',
5242+
proargnames => '{pid,state,sent_lsn,write_lsn,flush_lsn,replay_lsn,write_lag,flush_lag,replay_lag,sync_priority,sync_state,reply_time}',
52435243
prosrc => 'pg_stat_get_wal_senders' },
52445244
{ oid => '3317', descr => 'statistics: information about WAL receiver',
52455245
proname => 'pg_stat_get_wal_receiver', proisstrict => 'f', provolatile => 's',

‎src/include/replication/reorderbuffer.h

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -413,17 +413,6 @@ struct ReorderBuffer
413413

414414
/* memory accounting */
415415
Sizesize;
416-
417-
/*
418-
* Statistics about transactions spilled to disk.
419-
*
420-
* A single transaction may be spilled repeatedly, which is why we keep
421-
* two different counters. For spilling, the transaction counter includes
422-
* both toplevel transactions and subtransactions.
423-
*/
424-
int64spillCount;/* spill-to-disk invocation counter */
425-
int64spillTxns;/* number of transactions spilled to disk */
426-
int64spillBytes;/* amount of data spilled to disk */
427416
};
428417

429418

‎src/include/replication/walsender_private.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,6 @@ typedef struct WalSnd
7878
* Timestamp of the last message received from standby.
7979
*/
8080
TimestampTzreplyTime;
81-
82-
/* Statistics for transactions spilled to disk. */
83-
int64spillTxns;
84-
int64spillCount;
85-
int64spillBytes;
8681
}WalSnd;
8782

8883
externWalSnd*MyWalSnd;

‎src/test/regress/expected/rules.out

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2002,12 +2002,9 @@ pg_stat_replication| SELECT s.pid,
20022002
w.replay_lag,
20032003
w.sync_priority,
20042004
w.sync_state,
2005-
w.reply_time,
2006-
w.spill_txns,
2007-
w.spill_count,
2008-
w.spill_bytes
2005+
w.reply_time
20092006
FROM ((pg_stat_get_activity(NULL::integer) s(datid, pid, usesysid, application_name, state, query, wait_event_type, wait_event, xact_start, query_start, backend_start, state_change, client_addr, client_hostname, client_port, backend_xid, backend_xmin, backend_type, ssl, sslversion, sslcipher, sslbits, sslcompression, ssl_client_dn, ssl_client_serial, ssl_issuer_dn, gss_auth, gss_princ, gss_enc, leader_pid)
2010-
JOIN pg_stat_get_wal_senders() w(pid, state, sent_lsn, write_lsn, flush_lsn, replay_lsn, write_lag, flush_lag, replay_lag, sync_priority, sync_state, reply_time, spill_txns, spill_count, spill_bytes) ON ((s.pid = w.pid)))
2007+
JOIN pg_stat_get_wal_senders() w(pid, state, sent_lsn, write_lsn, flush_lsn, replay_lsn, write_lag, flush_lag, replay_lag, sync_priority, sync_state, reply_time) ON ((s.pid = w.pid)))
20112008
LEFT JOIN pg_authid u ON ((s.usesysid = u.oid)));
20122009
pg_stat_slru| SELECT s.name,
20132010
s.blks_zeroed,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp