]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Fix pg_stat_io buffer reuse test instability
authorAndres Freund <andres@anarazel.de>
Tue, 1 Aug 2023 18:22:03 +0000 (11:22 -0700)
committerAndres Freund <andres@anarazel.de>
Wed, 2 Aug 2023 02:04:29 +0000 (19:04 -0700)
commit803660ea4c5d9d2b3c7e1b0a9fc4b99359ba0a85
treed4175d3ea6d712cfd3938dcf393c6173c153be22
parent4e2e75cd29eb7bc591afe30fd7425629fe2c5a5d
Fix pg_stat_io buffer reuse test instability

The stats regression test attempts to ensure that Buffer Access Strategy
"reuses" are being counted in pg_stat_io by vacuuming a table which is larger
than the size of the strategy ring. However, when shared buffers are in
sufficiently high demand, another backend could evict one of the blocks in the
strategy ring before the first backend has a chance to reuse the buffer. The
backend using the strategy would then evict another shared buffer and add that
buffer to the strategy ring. This counts as an eviction and not a reuse in
pg_stat_io. Count both evictions and reuses in the test to ensure it does not
fail incorrectly.

Reported-by: Jeff Davis <pgsql@j-davis.com>,
Author: Melanie Plageman <melanieplageman@gmail.com>
Reviewed-by: Alexander Lakhin <exclusion@gmail.com>
Reviewed-by: Masahiko Sawada <sawada.mshk@gmail.com>
Discussion: https://postgr.es/m/CAAKRu_bNG27AxG9TdPtwsL6wg8AWbVckjmTL2t1HF=miDQuNtw@mail.gmail.com
src/test/regress/expected/stats.out
src/test/regress/sql/stats.sql