pgsql: Add pgstat test for reset of dead/live counters with table trunc

Started by Michael Paquier3 months ago1 messagescommitters
Jump to latest
#1Michael Paquier
michael@paquier.xyz

Add pgstat test for reset of dead/live counters with table truncation

A patch has been proposed to refactor the table-level statistics to
treat the non-transactional and transactional parts as two separate
entities, in the scope of a larger piece of work to introduce
transactional flushes.

This commit adds a test for a pattern that has proved to be problematic
while splitting the relation stats data, and where we had no coverage
yet: an entry marked as truncdropped resets the live/dead counters in
the flush callback, leaving any other data intact. The code path
resetting the live/dead counters was covered, but nothing in the
regression tests checked the stats views for it.

Extracted from a larger patch by the same author.

Author: Sami Imseih <samimseih.pg@gmail.com>
Reviewed-by: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Discussion: /messages/by-id/aoU32VTkUtpdUewB@paquier.xyz

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/ac00b0f8bdc59152e0d5b5f97c979595e9a5e2ad

Modified Files
--------------
src/test/regress/expected/stats.out | 27 +++++++++++++++++++++++++--
src/test/regress/sql/stats.sql | 16 +++++++++++++++-
2 files changed, 40 insertions(+), 3 deletions(-)