pgsql: Fix pg_stat_io buffer reuse test instability

From: Andres Freund <andres(at)anarazel(dot)de>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Fix pg_stat_io buffer reuse test instability
Date: 2023-08-01 21:18:03
Message-ID: E1qQwkk-0000sc-7g@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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(at)j-davis(dot)com>,
Author: Melanie Plageman <melanieplageman(at)gmail(dot)com>
Reviewed-by: Alexander Lakhin <exclusion(at)gmail(dot)com>
Reviewed-by: Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>
Discussion: https://postgr.es/m/CAAKRu_bNG27AxG9TdPtwsL6wg8AWbVckjmTL2t1HF=miDQuNtw@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/36ab831f9abc6f6b0ab74dd62e0faad75dbf42bf

Modified Files
--------------
src/test/regress/expected/stats.out | 30 ++++++++++++++++++++----------
src/test/regress/sql/stats.sql | 19 ++++++++++++-------
2 files changed, 32 insertions(+), 17 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Jeff Davis 2023-08-01 21:38:30 Re: pgsql: Fix search_path to a safe value during maintenance operations.
Previous Message David G. Johnston 2023-08-01 18:16:19 Re: pgsql: Fix search_path to a safe value during maintenance operations.