[issue] wal_buffers_full increases depending on the values of wal_buffers and wal-segsize

와따가따 <lght2000@gmail.com>

From: 와따가따 <lght2000@gmail.com>
To: pgsql-bugs@lists.postgresql.org
Date: 2022-04-25T07:51:43Z
Lists: pgsql-bugs
If the wal segment size is larger than the wal_buffers parameter value, the
value of the wal_buffers_full column of pg_stat_wal increases after
database shutdown and startup.

pg_controldata | grep "Bytes per WAL segment"
Bytes per WAL segment:                1073741824

wal_buffers =  16MB

---- DB shutdown and restart
postgres=# select * from pg_stat_wal;
 wal_records | wal_fpi | wal_bytes | wal_buffers_full | wal_write |
wal_sync | wal_write_time | wal_sync_time |          stats_reset
   -------------+---------+-----------+------------------+-----------+----------+----------------+---------------+-------------------------------
        6165 |     462 |  14071380 |          * 126070* |    126115 |
     40 |              0 |             0 | 2022-04-25
14:28:04.746772+09
(1 row)



If wal_buffers size and wal_segment size are the same, wal_buffers_full
column does not increase.

pg_controldata | grep "Bytes per WAL segment"
Bytes per WAL segment:                16777216

wal_buffers = 16MB

postgres=# select * from pg_stat_wal;
 wal_records | wal_fpi | wal_bytes | wal_buffers_full | wal_write |
wal_sync | wal_write_time | wal_sync_time |          stats_reset
   -------------+---------+-----------+------------------+-----------+----------+----------------+---------------+-------------------------------
        6161 |     461 |  14062929 |               * 0 *|        39 |
     36 |              0 |             0 | 2022-04-25
12:13:35.838092+09
(1 row)



Is this a bug?

The postgreSQL version currently in use is 14.2, and the database was
restarted without performing DML and DDL.

I wonder if it doesn't matter if the values of wal_buffers and wal-segsize
are different.