From: | Tomas Vondra <tomas(dot)vondra(at)postgresql(dot)org> |
---|---|
To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
Subject: | pgsql: amcheck: Move common routines into a separate module |
Date: | 2025-03-29 14:19:56 |
Message-ID: | E1tyX2S-001b6O-1I@gemulon.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers |
amcheck: Move common routines into a separate module
Before performing checks on an index, we need to take some safety
measures that apply to all index AMs. This includes:
* verifying that the index can be checked - Only selected AMs are
supported by amcheck (right now only B-Tree). The index has to be
valid and not a temporary index from another session.
* changing (and then restoring) user's security context
* obtaining proper locks on the index (and table, if needed)
* discarding GUC changes from the index functions
Until now this was implemented in the B-Tree amcheck module, but it's
something every AM will have to do. So relocate the code into a new
module verify_common for reuse.
The shared steps are implemented by amcheck_lock_relation_and_check(),
receiving the AM-specific verification as a callback. Custom parameters
may be supplied using a pointer.
Author: Andrey Borodin <amborodin(at)acm(dot)org>
Reviewed-By: José Villanova <jose(dot)arthur(at)gmail(dot)com>
Reviewed-By: Aleksander Alekseev <aleksander(at)timescale(dot)com>
Reviewed-By: Nikolay Samokhvalov <samokhvalov(at)gmail(dot)com>
Reviewed-By: Andres Freund <andres(at)anarazel(dot)de>
Reviewed-By: Tomas Vondra <tomas(at)vondra(dot)me>
Reviewed-By: Mark Dilger <mark(dot)dilger(at)enterprisedb(dot)com>
Reviewed-By: Peter Geoghegan <pg(at)bowt(dot)ie>
Reviewed-By: Kirill Reshke <reshkekirill(at)gmail(dot)com>
Discussion: https://postgr.es/m/45AC9B0A-2B45-40EE-B08F-BDCF5739D1E1%40yandex-team.ru
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/d70b17636ddf1ea2c71d1c7bc477372b36ccb66b
Modified Files
--------------
contrib/amcheck/Makefile | 1 +
contrib/amcheck/expected/check_btree.out | 4 +-
contrib/amcheck/meson.build | 1 +
contrib/amcheck/verify_common.c | 191 ++++++++++++++++++++++
contrib/amcheck/verify_common.h | 31 ++++
contrib/amcheck/verify_nbtree.c | 267 ++++++++-----------------------
src/tools/pgindent/typedefs.list | 1 +
7 files changed, 297 insertions(+), 199 deletions(-)
From | Date | Subject | |
---|---|---|---|
Next Message | Peter Eisentraut | 2025-03-29 14:31:17 | pgsql: pgbench: Make set_random_seed() 64-bit everywhere. |
Previous Message | Dean Rasheed | 2025-03-29 10:00:30 | pgsql: Fix MERGE with DO NOTHING actions into a partitioned table. |