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

Commiteaf5027

Browse files
committed
Move wal_buffers_full from PgStat_PendingWalStats to WalUsage
wal_buffers_full has been introduced in pg_stat_wal in8d9a935, assome information providing metrics for the tuning of the GUCwal_buffers. WalUsage has been introduced before that indf3b181.Moving this field is proving to be beneficial for several reasons:- This information can now be made available in more layers, providingmore granularity than just pg_stat_wal, on a per-query basis: EXPLAIN,pgss and VACUUM/ANALYZE logs.- A patch is under discussion to provide statistics for WAL at backendlevel, and this move simplifies a bit the handling of pendingstatistics. The remaining data in PgStat_PendingWalStats now relates towrite/sync counters and times, with equivalents present in pg_stat_io,that backend statistics are able to already track. So this should cutall the dependencies between PgStat_PendingWalStats and WAL stats atbackend level.As of this change, wal_buffers_full only shows in pg_stat_wal.Author: Bertrand DrouvotReviewed-by: Ilia EvdokimovDiscussion:https://postgr.es/m/Z6SOha5YFFgvpwQY@ip-10-97-1-34.eu-west-3.compute.internal
1 parent6a2275b commiteaf5027

File tree

5 files changed

+5
-3
lines changed

5 files changed

+5
-3
lines changed

‎src/backend/access/transam/xlog.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2093,7 +2093,7 @@ AdvanceXLInsertBuffer(XLogRecPtr upto, TimeLineID tli, bool opportunistic)
20932093
WriteRqst.Flush=0;
20942094
XLogWrite(WriteRqst,tli, false);
20952095
LWLockRelease(WALWriteLock);
2096-
PendingWalStats.wal_buffers_full++;
2096+
pgWalUsage.wal_buffers_full++;
20972097
TRACE_POSTGRESQL_WAL_BUFFER_WRITE_DIRTY_DONE();
20982098
}
20992099
}

‎src/backend/executor/instrument.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,7 @@ WalUsageAdd(WalUsage *dst, WalUsage *add)
280280
dst->wal_bytes+=add->wal_bytes;
281281
dst->wal_records+=add->wal_records;
282282
dst->wal_fpi+=add->wal_fpi;
283+
dst->wal_buffers_full+=add->wal_buffers_full;
283284
}
284285

285286
void
@@ -288,4 +289,5 @@ WalUsageAccumDiff(WalUsage *dst, const WalUsage *add, const WalUsage *sub)
288289
dst->wal_bytes+=add->wal_bytes-sub->wal_bytes;
289290
dst->wal_records+=add->wal_records-sub->wal_records;
290291
dst->wal_fpi+=add->wal_fpi-sub->wal_fpi;
292+
dst->wal_buffers_full+=add->wal_buffers_full-sub->wal_buffers_full;
291293
}

‎src/backend/utils/activity/pgstat_wal.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ pgstat_wal_flush_cb(bool nowait)
123123
WALSTAT_ACC(wal_records,wal_usage_diff);
124124
WALSTAT_ACC(wal_fpi,wal_usage_diff);
125125
WALSTAT_ACC(wal_bytes,wal_usage_diff);
126-
WALSTAT_ACC(wal_buffers_full,PendingWalStats);
126+
WALSTAT_ACC(wal_buffers_full,wal_usage_diff);
127127
WALSTAT_ACC(wal_write,PendingWalStats);
128128
WALSTAT_ACC(wal_sync,PendingWalStats);
129129
WALSTAT_ACC_INSTR_TIME(wal_write_time);

‎src/include/executor/instrument.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ typedef struct WalUsage
5353
int64wal_records;/* # of WAL records produced */
5454
int64wal_fpi;/* # of WAL full page images produced */
5555
uint64wal_bytes;/* size of WAL records produced */
56+
int64wal_buffers_full;/* # of times the WAL buffers became full */
5657
}WalUsage;
5758

5859
/* Flag bits included in InstrAlloc's instrument_options bitmask */

‎src/include/pgstat.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -495,7 +495,6 @@ typedef struct PgStat_WalStats
495495
*/
496496
typedefstructPgStat_PendingWalStats
497497
{
498-
PgStat_Counterwal_buffers_full;
499498
PgStat_Counterwal_write;
500499
PgStat_Counterwal_sync;
501500
instr_timewal_write_time;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp