Remove read/sync fields from pg_stat_wal and GUC track_wal_io_timing
authorMichael Paquier <michael@paquier.xyz>
Mon, 24 Feb 2025 00:51:56 +0000 (09:51 +0900)
committerMichael Paquier <michael@paquier.xyz>
Mon, 24 Feb 2025 00:51:56 +0000 (09:51 +0900)
The four following attributes are removed from pg_stat_wal:
* wal_write
* wal_sync
* wal_write_time
* wal_sync_time

a051e71e28a1 has added an equivalent of this information in pg_stat_io
with more granularity as this now spreads across the backend types, IO
context and IO objects.  So, keeping the same information in pg_stat_wal
has little benefits.

Another benefit of this commit is the removal of PendingWalStats,
simplifying an upcoming patch to add per-backend WAL statistics, which
already support IO statistics and which have access to the write/sync
stats data of WAL.

The GUC track_wal_io_timing, that was used to enable or disable the
aggregation of the write and sync timings for WAL, is also removed.
pgstat_prepare_io_time() is simplified.

Bump catalog version.
Bump PGSTAT_FILE_FORMAT_ID, due to the update of PgStat_WalStats.

Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Discussion: https://postgr.es/m/Z7RkQ0EfYaqqjgz/@ip-10-97-1-34.eu-west-3.compute.internal

20 files changed:
doc/src/sgml/config.sgml
doc/src/sgml/monitoring.sgml
src/backend/access/transam/xlog.c
src/backend/access/transam/xlogreader.c
src/backend/access/transam/xlogrecovery.c
src/backend/catalog/system_views.sql
src/backend/storage/buffer/bufmgr.c
src/backend/storage/buffer/localbuf.c
src/backend/storage/smgr/md.c
src/backend/utils/activity/pgstat_io.c
src/backend/utils/activity/pgstat_wal.c
src/backend/utils/adt/pgstatfuncs.c
src/backend/utils/misc/guc_tables.c
src/backend/utils/misc/postgresql.conf.sample
src/include/access/xlog.h
src/include/catalog/catversion.h
src/include/catalog/pg_proc.dat
src/include/pgstat.h
src/test/regress/expected/rules.out
src/tools/pgindent/typedefs.list

index 007746a44296c948e4aacfe533e01fc06f40b940..a835457610854ca8c592df7273d02bbee53e6254 100644 (file)
@@ -8393,28 +8393,6 @@ COPY postgres_log FROM '/full/path/to/logfile.csv' WITH csv;
       </listitem>
      </varlistentry>
 
-     <varlistentry id="guc-track-wal-io-timing" xreflabel="track_wal_io_timing">
-      <term><varname>track_wal_io_timing</varname> (<type>boolean</type>)
-      <indexterm>
-       <primary><varname>track_wal_io_timing</varname> configuration parameter</primary>
-      </indexterm>
-      </term>
-      <listitem>
-       <para>
-        Enables timing of WAL I/O calls. This parameter is off by default,
-        as it will repeatedly query the operating system for the current time,
-        which may cause significant overhead on some platforms.
-        You can use the <application>pg_test_timing</application> tool to
-        measure the overhead of timing on your system.
-        I/O timing information is
-        displayed in <link linkend="monitoring-pg-stat-wal-view">
-        <structname>pg_stat_wal</structname></link>.
-        Only superusers and users with the appropriate <literal>SET</literal>
-        privilege can change this setting.
-       </para>
-      </listitem>
-     </varlistentry>
-
      <varlistentry id="guc-track-functions" xreflabel="track_functions">
       <term><varname>track_functions</varname> (<type>enum</type>)
       <indexterm>
index e698e74e11633dba434411dce23ab868e79a39c4..3dfd059b7ee8bf75188ea2fe2c8b4e4dee1e4cc6 100644 (file)
@@ -183,11 +183,6 @@ postgres   27093  0.0  0.0  30096  2752 ?        Ss   11:34   0:00 postgres: ser
    of block read, write, extend, and fsync times.
   </para>
 
-  <para>
-   The parameter <xref linkend="guc-track-wal-io-timing"/> enables monitoring
-   of WAL write and fsync times.
-  </para>
-
   <para>
    Normally these parameters are set in <filename>postgresql.conf</filename> so
    that they apply to all server processes, but it is possible to turn
@@ -3265,63 +3260,6 @@ description | Waiting for a newly initialized WAL file to reach durable storage
       </para></entry>
      </row>
 
-     <row>
-      <entry role="catalog_table_entry"><para role="column_definition">
-       <structfield>wal_write</structfield> <type>bigint</type>
-      </para>
-      <para>
-       Number of times WAL buffers were written out to disk via
-       <function>XLogWrite</function> request.
-       See <xref linkend="wal-configuration"/> for more information about
-       the internal WAL function <function>XLogWrite</function>.
-      </para></entry>
-     </row>
-
-     <row>
-      <entry role="catalog_table_entry"><para role="column_definition">
-       <structfield>wal_sync</structfield> <type>bigint</type>
-      </para>
-      <para>
-       Number of times WAL files were synced to disk via
-       <function>issue_xlog_fsync</function> request
-       (if <xref linkend="guc-fsync"/> is <literal>on</literal> and
-       <xref linkend="guc-wal-sync-method"/> is either
-       <literal>fdatasync</literal>, <literal>fsync</literal> or
-       <literal>fsync_writethrough</literal>, otherwise zero).
-       See <xref linkend="wal-configuration"/> for more information about
-       the internal WAL function <function>issue_xlog_fsync</function>.
-      </para></entry>
-     </row>
-
-     <row>
-      <entry role="catalog_table_entry"><para role="column_definition">
-       <structfield>wal_write_time</structfield> <type>double precision</type>
-      </para>
-      <para>
-       Total amount of time spent writing WAL buffers to disk via
-       <function>XLogWrite</function> request, in milliseconds
-       (if <xref linkend="guc-track-wal-io-timing"/> is enabled,
-       otherwise zero).  This includes the sync time when
-       <varname>wal_sync_method</varname> is either
-       <literal>open_datasync</literal> or <literal>open_sync</literal>.
-      </para></entry>
-     </row>
-
-     <row>
-      <entry role="catalog_table_entry"><para role="column_definition">
-       <structfield>wal_sync_time</structfield> <type>double precision</type>
-      </para>
-      <para>
-       Total amount of time spent syncing WAL files to disk via
-       <function>issue_xlog_fsync</function> request, in milliseconds
-       (if <varname>track_wal_io_timing</varname> is enabled,
-       <varname>fsync</varname> is <literal>on</literal>, and
-       <varname>wal_sync_method</varname> is either
-       <literal>fdatasync</literal>, <literal>fsync</literal> or
-       <literal>fsync_writethrough</literal>, otherwise zero).
-      </para></entry>
-     </row>
-
      <row>
       <entry role="catalog_table_entry"><para role="column_definition">
        <structfield>stats_reset</structfield> <type>timestamp with time zone</type>
index ea1f2d2993c041b1cff39f0606d0cfec81a27ff6..919314f82587ec2f39e88395978485fefc7085af 100644 (file)
@@ -134,7 +134,6 @@ int         CommitSiblings = 5; /* # concurrent xacts needed to sleep */
 int            wal_retrieve_retry_interval = 5000;
 int            max_slot_wal_keep_size_mb = -1;
 int            wal_decode_buffer_size = 512 * 1024;
-bool       track_wal_io_timing = false;
 
 #ifdef WAL_DEBUG
 bool       XLOG_DEBUG = false;
@@ -2436,10 +2435,9 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible)
                errno = 0;
 
                /*
-                * Measure I/O timing to write WAL data, for pg_stat_io and/or
-                * pg_stat_wal.
+                * Measure I/O timing to write WAL data, for pg_stat_io.
                 */
-               start = pgstat_prepare_io_time(track_io_timing || track_wal_io_timing);
+               start = pgstat_prepare_io_time();
 
                pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE);
                written = pg_pwrite(openLogFile, from, nleft, startoffset);
@@ -2448,20 +2446,6 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible)
                pgstat_count_io_op_time(IOOBJECT_WAL, IOCONTEXT_NORMAL,
                                        IOOP_WRITE, start, 1, written);
 
-               /*
-                * Increment the I/O timing and the number of times WAL data
-                * were written out to disk.
-                */
-               if (track_wal_io_timing)
-               {
-                   instr_time  end;
-
-                   INSTR_TIME_SET_CURRENT(end);
-                   INSTR_TIME_ACCUM_DIFF(PendingWalStats.wal_write_time, end, start);
-               }
-
-               PendingWalStats.wal_write++;
-
                if (written <= 0)
                {
                    char        xlogfname[MAXFNAMELEN];
@@ -3264,7 +3248,7 @@ XLogFileInitInternal(XLogSegNo logsegno, TimeLineID logtli,
                 errmsg("could not create file \"%s\": %m", tmppath)));
 
    /* Measure I/O timing when initializing segment */
-   io_start = pgstat_prepare_io_time(track_io_timing);
+   io_start = pgstat_prepare_io_time();
 
    pgstat_report_wait_start(WAIT_EVENT_WAL_INIT_WRITE);
    save_errno = 0;
@@ -3326,7 +3310,7 @@ XLogFileInitInternal(XLogSegNo logsegno, TimeLineID logtli,
    }
 
    /* Measure I/O timing when flushing segment */
-   io_start = pgstat_prepare_io_time(track_io_timing);
+   io_start = pgstat_prepare_io_time();
 
    pgstat_report_wait_start(WAIT_EVENT_WAL_INIT_SYNC);
    if (pg_fsync(fd) != 0)
@@ -8758,10 +8742,9 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli)
        return;
 
    /*
-    * Measure I/O timing to sync the WAL file for pg_stat_io and/or
-    * pg_stat_wal.
+    * Measure I/O timing to sync the WAL file for pg_stat_io.
     */
-   start = pgstat_prepare_io_time(track_io_timing || track_wal_io_timing);
+   start = pgstat_prepare_io_time();
 
    pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC);
    switch (wal_sync_method)
@@ -8807,21 +8790,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli)
 
    pgstat_report_wait_end();
 
-   /*
-    * Increment the I/O timing and the number of times WAL files were synced.
-    */
-   if (track_wal_io_timing)
-   {
-       instr_time  end;
-
-       INSTR_TIME_SET_CURRENT(end);
-       INSTR_TIME_ACCUM_DIFF(PendingWalStats.wal_sync_time, end, start);
-   }
-
    pgstat_count_io_op_time(IOOBJECT_WAL, IOCONTEXT_NORMAL, IOOP_FSYNC,
                            start, 1, 0);
-
-   PendingWalStats.wal_sync++;
 }
 
 /*
index 31bffc6f5019599c97ec6789fe7e2ef29a13c492..995e4f7c26fd5a3536cdd6ad9ec383c567e36769 100644 (file)
@@ -1557,7 +1557,7 @@ WALRead(XLogReaderState *state,
 
 #ifndef FRONTEND
        /* Measure I/O timing when reading segment */
-       io_start = pgstat_prepare_io_time(track_io_timing);
+       io_start = pgstat_prepare_io_time();
 
        pgstat_report_wait_start(WAIT_EVENT_WAL_READ);
 #endif
index f234007d348432d80efdf7982fe46d587a494351..915cb330295cc1baf55f192f346b2c68969a184f 100644 (file)
@@ -3401,7 +3401,7 @@ retry:
    readOff = targetPageOff;
 
    /* Measure I/O timing when reading segment */
-   io_start = pgstat_prepare_io_time(track_io_timing);
+   io_start = pgstat_prepare_io_time();
 
    pgstat_report_wait_start(WAIT_EVENT_WAL_READ);
    r = pg_pread(readFile, readBuf, XLOG_BLCKSZ, (off_t) readOff);
index eff0990957ebb01e9f0a1df37f87ae712b645fb1..a4d2cfdcaf5d449c111c38c478e6653fb9c00741 100644 (file)
@@ -1189,10 +1189,6 @@ CREATE VIEW pg_stat_wal AS
         w.wal_fpi,
         w.wal_bytes,
         w.wal_buffers_full,
-        w.wal_write,
-        w.wal_sync,
-        w.wal_write_time,
-        w.wal_sync_time,
         w.stats_reset
     FROM pg_stat_get_wal() w;
 
index 75cfc2b6fe96b29c5205e416aaeb16a8f460c5e2..d3216ef6ba758c9bf9cd1ad61eafdba7560461e0 100644 (file)
@@ -1509,7 +1509,7 @@ WaitReadBuffers(ReadBuffersOperation *operation)
            io_pages[io_buffers_len++] = BufferGetBlock(buffers[i]);
        }
 
-       io_start = pgstat_prepare_io_time(track_io_timing);
+       io_start = pgstat_prepare_io_time();
        smgrreadv(operation->smgr, forknum, io_first_block, io_pages, io_buffers_len);
        pgstat_count_io_op_time(io_object, io_context, IOOP_READ, io_start,
                                1, io_buffers_len * BLCKSZ);
@@ -2401,7 +2401,7 @@ ExtendBufferedRelShared(BufferManagerRelation bmr,
        }
    }
 
-   io_start = pgstat_prepare_io_time(track_io_timing);
+   io_start = pgstat_prepare_io_time();
 
    /*
     * Note: if smgrzeroextend fails, we will end up with buffers that are
@@ -3858,7 +3858,7 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln, IOObject io_object,
     */
    bufToWrite = PageSetChecksumCopy((Page) bufBlock, buf->tag.blockNum);
 
-   io_start = pgstat_prepare_io_time(track_io_timing);
+   io_start = pgstat_prepare_io_time();
 
    /*
     * bufToWrite is either the shared buffer or a copy, as appropriate.
@@ -4460,7 +4460,7 @@ FlushRelationBuffers(Relation rel)
 
                PageSetChecksumInplace(localpage, bufHdr->tag.blockNum);
 
-               io_start = pgstat_prepare_io_time(track_io_timing);
+               io_start = pgstat_prepare_io_time();
 
                smgrwrite(srel,
                          BufTagGetForkNum(&bufHdr->tag),
@@ -5917,7 +5917,7 @@ IssuePendingWritebacks(WritebackContext *wb_context, IOContext io_context)
    sort_pending_writebacks(wb_context->pending_writebacks,
                            wb_context->nr_pending);
 
-   io_start = pgstat_prepare_io_time(track_io_timing);
+   io_start = pgstat_prepare_io_time();
 
    /*
     * Coalesce neighbouring writes, but nothing else. For that we iterate
index 64931efaa75639f80e73ecc54bb5deac7d32e24e..78b65fb160adea1a3a360ba77963ae4da3f1ebce 100644 (file)
@@ -244,7 +244,7 @@ GetLocalVictimBuffer(void)
 
        PageSetChecksumInplace(localpage, bufHdr->tag.blockNum);
 
-       io_start = pgstat_prepare_io_time(track_io_timing);
+       io_start = pgstat_prepare_io_time();
 
        /* And write... */
        smgrwrite(oreln,
@@ -414,7 +414,7 @@ ExtendBufferedRelLocal(BufferManagerRelation bmr,
        }
    }
 
-   io_start = pgstat_prepare_io_time(track_io_timing);
+   io_start = pgstat_prepare_io_time();
 
    /* actually extend relation */
    smgrzeroextend(bmr.smgr, fork, first_block, extend_by, false);
index 7bf0b45e2c34f4b1605616c4a5ead413ac03d4c5..298754d1b64a75e3f6aa0323048ca1edeccc6080 100644 (file)
@@ -1381,7 +1381,7 @@ register_dirty_segment(SMgrRelation reln, ForkNumber forknum, MdfdVec *seg)
        ereport(DEBUG1,
                (errmsg_internal("could not forward fsync request because request queue is full")));
 
-       io_start = pgstat_prepare_io_time(track_io_timing);
+       io_start = pgstat_prepare_io_time();
 
        if (FileSync(seg->mdfd_vfd, WAIT_EVENT_DATA_FILE_SYNC) < 0)
            ereport(data_sync_elevel(ERROR),
@@ -1786,7 +1786,7 @@ mdsyncfiletag(const FileTag *ftag, char *path)
        need_to_close = true;
    }
 
-   io_start = pgstat_prepare_io_time(track_io_timing);
+   io_start = pgstat_prepare_io_time();
 
    /* Sync the file. */
    result = FileSync(file, WAIT_EVENT_DATA_FILE_SYNC);
index 28a431084b8997d025b4a3c3843bbff53f637838..e7362b52a37beaf8f0a003a65023fa9f59240b45 100644 (file)
@@ -83,15 +83,14 @@ pgstat_count_io_op(IOObject io_object, IOContext io_context, IOOp io_op,
 }
 
 /*
- * Initialize the internal timing for an IO operation, depending on an
- * IO timing GUC.
+ * Initialize the internal timing for an IO operation.
  */
 instr_time
-pgstat_prepare_io_time(bool track_io_guc)
+pgstat_prepare_io_time(void)
 {
    instr_time  io_start;
 
-   if (track_io_guc)
+   if (track_io_timing)
        INSTR_TIME_SET_CURRENT(io_start);
    else
    {
index c1ca65eb9918c55f7b525dc57674aa07d1f9911d..4dc41a4a590e7bb742315e24ccc51f6d0da1cf09 100644 (file)
@@ -21,8 +21,6 @@
 #include "utils/pgstat_internal.h"
 
 
-PgStat_PendingWalStats PendingWalStats = {0};
-
 /*
  * WAL usage counters saved from pgWalUsage at the previous call to
  * pgstat_report_wal(). This is used to calculate how much WAL usage
@@ -118,17 +116,10 @@ pgstat_wal_flush_cb(bool nowait)
 
 #define WALSTAT_ACC(fld, var_to_add) \
    (stats_shmem->stats.fld += var_to_add.fld)
-#define WALSTAT_ACC_INSTR_TIME(fld) \
-   (stats_shmem->stats.fld += INSTR_TIME_GET_MICROSEC(PendingWalStats.fld))
    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, wal_usage_diff);
-   WALSTAT_ACC(wal_write, PendingWalStats);
-   WALSTAT_ACC(wal_sync, PendingWalStats);
-   WALSTAT_ACC_INSTR_TIME(wal_write_time);
-   WALSTAT_ACC_INSTR_TIME(wal_sync_time);
-#undef WALSTAT_ACC_INSTR_TIME
 #undef WALSTAT_ACC
 
    LWLockRelease(&stats_shmem->lock);
@@ -138,11 +129,6 @@ pgstat_wal_flush_cb(bool nowait)
     */
    prevWalUsage = pgWalUsage;
 
-   /*
-    * Clear out the statistics buffer, so it can be re-used.
-    */
-   MemSet(&PendingWalStats, 0, sizeof(PendingWalStats));
-
    return false;
 }
 
@@ -158,18 +144,12 @@ pgstat_wal_init_backend_cb(void)
 }
 
 /*
- * To determine whether any WAL activity has occurred since last time, not
- * only the number of generated WAL records but also the numbers of WAL
- * writes and syncs need to be checked. Because even transaction that
- * generates no WAL records can write or sync WAL data when flushing the
- * data pages.
+ * To determine whether WAL usage happened.
  */
 bool
 pgstat_wal_have_pending_cb(void)
 {
-   return pgWalUsage.wal_records != prevWalUsage.wal_records ||
-       PendingWalStats.wal_write != 0 ||
-       PendingWalStats.wal_sync != 0;
+   return pgWalUsage.wal_records != prevWalUsage.wal_records;
 }
 
 void
index e9096a88492c68f4cef22424c3c166bae2b2668a..68e16e52ab6dab2d0db19d56f85db5c73e33354e 100644 (file)
@@ -1637,7 +1637,7 @@ pg_stat_get_backend_io(PG_FUNCTION_ARGS)
 Datum
 pg_stat_get_wal(PG_FUNCTION_ARGS)
 {
-#define PG_STAT_GET_WAL_COLS   9
+#define PG_STAT_GET_WAL_COLS   5
    TupleDesc   tupdesc;
    Datum       values[PG_STAT_GET_WAL_COLS] = {0};
    bool        nulls[PG_STAT_GET_WAL_COLS] = {0};
@@ -1654,15 +1654,7 @@ pg_stat_get_wal(PG_FUNCTION_ARGS)
                       NUMERICOID, -1, 0);
    TupleDescInitEntry(tupdesc, (AttrNumber) 4, "wal_buffers_full",
                       INT8OID, -1, 0);
-   TupleDescInitEntry(tupdesc, (AttrNumber) 5, "wal_write",
-                      INT8OID, -1, 0);
-   TupleDescInitEntry(tupdesc, (AttrNumber) 6, "wal_sync",
-                      INT8OID, -1, 0);
-   TupleDescInitEntry(tupdesc, (AttrNumber) 7, "wal_write_time",
-                      FLOAT8OID, -1, 0);
-   TupleDescInitEntry(tupdesc, (AttrNumber) 8, "wal_sync_time",
-                      FLOAT8OID, -1, 0);
-   TupleDescInitEntry(tupdesc, (AttrNumber) 9, "stats_reset",
+   TupleDescInitEntry(tupdesc, (AttrNumber) 5, "stats_reset",
                       TIMESTAMPTZOID, -1, 0);
 
    BlessTupleDesc(tupdesc);
@@ -1682,14 +1674,8 @@ pg_stat_get_wal(PG_FUNCTION_ARGS)
                                    Int32GetDatum(-1));
 
    values[3] = Int64GetDatum(wal_stats->wal_buffers_full);
-   values[4] = Int64GetDatum(wal_stats->wal_write);
-   values[5] = Int64GetDatum(wal_stats->wal_sync);
-
-   /* Convert counters from microsec to millisec for display */
-   values[6] = Float8GetDatum(((double) wal_stats->wal_write_time) / 1000.0);
-   values[7] = Float8GetDatum(((double) wal_stats->wal_sync_time) / 1000.0);
 
-   values[8] = TimestampTzGetDatum(wal_stats->stat_reset_timestamp);
+   values[4] = TimestampTzGetDatum(wal_stats->stat_reset_timestamp);
 
    /* Returns the record as Datum */
    PG_RETURN_DATUM(HeapTupleGetDatum(heap_form_tuple(tupdesc, values, nulls)));
index 03a6dd491540f83cfb442084965d00906ef1de15..3f1c7b1ebf630fe2ff9f59c4b37ab0550f6f6458 100644 (file)
@@ -1500,15 +1500,6 @@ struct config_bool ConfigureNamesBool[] =
        false,
        NULL, NULL, NULL
    },
-   {
-       {"track_wal_io_timing", PGC_SUSET, STATS_CUMULATIVE,
-           gettext_noop("Collects timing statistics for WAL I/O activity."),
-           NULL
-       },
-       &track_wal_io_timing,
-       false,
-       NULL, NULL, NULL
-   },
 
    {
        {"update_process_title", PGC_SUSET, PROCESS_TITLE,
index 5362ff805195f9a059c412dbbe6027824088f446..e771d87da1fb33d9110b520d7a3cc698a50b4bfb 100644 (file)
 #track_counts = on
 #track_cost_delay_timing = off
 #track_io_timing = off
-#track_wal_io_timing = off
 #track_functions = none            # none, pl, all
 #stats_fetch_consistency = cache   # cache, none, snapshot
 
index d313099c027f0af3e76e2a4eb97b706e80702700..0a50d160bba8f2c412e090ff5f22bb64e0de30b8 100644 (file)
@@ -54,7 +54,6 @@ extern PGDLLIMPORT char *wal_consistency_checking_string;
 extern PGDLLIMPORT bool log_checkpoints;
 extern PGDLLIMPORT int CommitDelay;
 extern PGDLLIMPORT int CommitSiblings;
-extern PGDLLIMPORT bool track_wal_io_timing;
 extern PGDLLIMPORT int wal_decode_buffer_size;
 
 extern PGDLLIMPORT int CheckPointSegments;
index d179b512be9736406b85140ac43188a8223d294c..f6a99472e769eea613caee585ff3adee0105067b 100644 (file)
@@ -57,6 +57,6 @@
  */
 
 /*                         yyyymmddN */
-#define CATALOG_VERSION_NO 202502212
+#define CATALOG_VERSION_NO 202502241
 
 #endif
index e2d5c0d0886016d9bbc74568d7e40bfa8313627a..af9546de23df7e718e81617f7b776df7e699e283 100644 (file)
 { oid => '1136', descr => 'statistics: information about WAL activity',
   proname => 'pg_stat_get_wal', proisstrict => 'f', provolatile => 's',
   proparallel => 'r', prorettype => 'record', proargtypes => '',
-  proallargtypes => '{int8,int8,numeric,int8,int8,int8,float8,float8,timestamptz}',
-  proargmodes => '{o,o,o,o,o,o,o,o,o}',
-  proargnames => '{wal_records,wal_fpi,wal_bytes,wal_buffers_full,wal_write,wal_sync,wal_write_time,wal_sync_time,stats_reset}',
+  proallargtypes => '{int8,int8,numeric,int8,timestamptz}',
+  proargmodes => '{o,o,o,o,o}',
+  proargnames => '{wal_records,wal_fpi,wal_bytes,wal_buffers_full,stats_reset}',
   prosrc => 'pg_stat_get_wal' },
 { oid => '6248', descr => 'statistics: information about WAL prefetching',
   proname => 'pg_stat_get_recovery_prefetch', prorows => '1', proretset => 't',
index 53f2a8458e6fcd27c5cd21b3ca3ac07c38499072..fc651d03cf971dd044d8d4290929567155be3461 100644 (file)
@@ -212,7 +212,7 @@ typedef struct PgStat_TableXactStatus
  * ------------------------------------------------------------
  */
 
-#define PGSTAT_FILE_FORMAT_ID  0x01A5BCB3
+#define PGSTAT_FILE_FORMAT_ID  0x01A5BCB4
 
 typedef struct PgStat_ArchiverStats
 {
@@ -480,28 +480,9 @@ typedef struct PgStat_WalStats
    PgStat_Counter wal_fpi;
    uint64      wal_bytes;
    PgStat_Counter wal_buffers_full;
-   PgStat_Counter wal_write;
-   PgStat_Counter wal_sync;
-   PgStat_Counter wal_write_time;
-   PgStat_Counter wal_sync_time;
    TimestampTz stat_reset_timestamp;
 } PgStat_WalStats;
 
-/*
- * This struct stores wal-related durations as instr_time, which makes it
- * cheaper and easier to accumulate them, by not requiring type
- * conversions. During stats flush instr_time will be converted into
- * microseconds.
- */
-typedef struct PgStat_PendingWalStats
-{
-   PgStat_Counter wal_write;
-   PgStat_Counter wal_sync;
-   instr_time  wal_write_time;
-   instr_time  wal_sync_time;
-} PgStat_PendingWalStats;
-
-
 /*
  * Functions in pgstat.c
  */
@@ -583,7 +564,7 @@ extern bool pgstat_bktype_io_stats_valid(PgStat_BktypeIO *backend_io,
                                         BackendType bktype);
 extern void pgstat_count_io_op(IOObject io_object, IOContext io_context,
                               IOOp io_op, uint32 cnt, uint64 bytes);
-extern instr_time pgstat_prepare_io_time(bool track_io_guc);
+extern instr_time pgstat_prepare_io_time(void);
 extern void pgstat_count_io_op_time(IOObject io_object, IOContext io_context,
                                    IOOp io_op, instr_time start_time,
                                    uint32 cnt, uint64 bytes);
@@ -834,13 +815,4 @@ extern PGDLLIMPORT PgStat_Counter pgStatTransactionIdleTime;
 /* updated by the traffic cop and in errfinish() */
 extern PGDLLIMPORT SessionEndType pgStatSessionEndCause;
 
-
-/*
- * Variables in pgstat_wal.c
- */
-
-/* updated directly by backends and background processes */
-extern PGDLLIMPORT PgStat_PendingWalStats PendingWalStats;
-
-
 #endif                         /* PGSTAT_H */
index 5baba8d39ff65eda80b32f4a118cb3a1cc5e9dcf..62f69ac20b2eff93883153691ac4ad5daa8792b1 100644 (file)
@@ -2259,12 +2259,8 @@ pg_stat_wal| SELECT wal_records,
     wal_fpi,
     wal_bytes,
     wal_buffers_full,
-    wal_write,
-    wal_sync,
-    wal_write_time,
-    wal_sync_time,
     stats_reset
-   FROM pg_stat_get_wal() w(wal_records, wal_fpi, wal_bytes, wal_buffers_full, wal_write, wal_sync, wal_write_time, wal_sync_time, stats_reset);
+   FROM pg_stat_get_wal() w(wal_records, wal_fpi, wal_bytes, wal_buffers_full, stats_reset);
 pg_stat_wal_receiver| SELECT pid,
     status,
     receive_start_lsn,
index b09d8af718332af6cdf97f4ed35a3418c6cf3944..e3e09a2207e97281c9dc4413bf5676c9137448a8 100644 (file)
@@ -2173,7 +2173,6 @@ PgStat_KindInfo
 PgStat_LocalState
 PgStat_PendingDroppedStatsItem
 PgStat_PendingIO
-PgStat_PendingWalStats
 PgStat_SLRUStats
 PgStat_ShmemControl
 PgStat_Snapshot