diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 87f9fb7a654..75d5554c77c 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2093,7 +2093,7 @@ AdvanceXLInsertBuffer(XLogRecPtr upto, TimeLineID tli, bool opportunistic) WriteRqst.Flush = 0; XLogWrite(WriteRqst, tli, false); LWLockRelease(WALWriteLock); - PendingWalStats.wal_buffers_full++; + pgWalUsage.wal_buffers_full++; TRACE_POSTGRESQL_WAL_BUFFER_WRITE_DIRTY_DONE(); } } diff --git a/src/backend/executor/instrument.c b/src/backend/executor/instrument.c index 2d3569b3748..56e635f4700 100644 --- a/src/backend/executor/instrument.c +++ b/src/backend/executor/instrument.c @@ -280,6 +280,7 @@ WalUsageAdd(WalUsage *dst, WalUsage *add) dst->wal_bytes += add->wal_bytes; dst->wal_records += add->wal_records; dst->wal_fpi += add->wal_fpi; + dst->wal_buffers_full += add->wal_buffers_full; } void @@ -288,4 +289,5 @@ WalUsageAccumDiff(WalUsage *dst, const WalUsage *add, const WalUsage *sub) dst->wal_bytes += add->wal_bytes - sub->wal_bytes; dst->wal_records += add->wal_records - sub->wal_records; dst->wal_fpi += add->wal_fpi - sub->wal_fpi; + dst->wal_buffers_full += add->wal_buffers_full - sub->wal_buffers_full; } diff --git a/src/backend/utils/activity/pgstat_wal.c b/src/backend/utils/activity/pgstat_wal.c index 18fa6b2936a..c1ca65eb991 100644 --- a/src/backend/utils/activity/pgstat_wal.c +++ b/src/backend/utils/activity/pgstat_wal.c @@ -123,7 +123,7 @@ pgstat_wal_flush_cb(bool nowait) WALSTAT_ACC(wal_records, wal_usage_diff); WALSTAT_ACC(wal_fpi, wal_usage_diff); WALSTAT_ACC(wal_bytes, wal_usage_diff); - WALSTAT_ACC(wal_buffers_full, PendingWalStats); + WALSTAT_ACC(wal_buffers_full, wal_usage_diff); WALSTAT_ACC(wal_write, PendingWalStats); WALSTAT_ACC(wal_sync, PendingWalStats); WALSTAT_ACC_INSTR_TIME(wal_write_time); diff --git a/src/include/executor/instrument.h b/src/include/executor/instrument.h index 5a6eff75c69..03653ab6c6c 100644 --- a/src/include/executor/instrument.h +++ b/src/include/executor/instrument.h @@ -53,6 +53,7 @@ typedef struct WalUsage int64 wal_records; /* # of WAL records produced */ int64 wal_fpi; /* # of WAL full page images produced */ uint64 wal_bytes; /* size of WAL records produced */ + int64 wal_buffers_full; /* # of times the WAL buffers became full */ } WalUsage; /* Flag bits included in InstrAlloc's instrument_options bitmask */ diff --git a/src/include/pgstat.h b/src/include/pgstat.h index dd823d3f56e..53f2a8458e6 100644 --- a/src/include/pgstat.h +++ b/src/include/pgstat.h @@ -495,7 +495,6 @@ typedef struct PgStat_WalStats */ typedef struct PgStat_PendingWalStats { - PgStat_Counter wal_buffers_full; PgStat_Counter wal_write; PgStat_Counter wal_sync; instr_time wal_write_time;