amcheck: Skip unlogged relations in Hot Standby

Enterprise / PostgreSQL - Peter Geoghegan [bowt.ie] - 12 October 2021 00:21 UTC

Have verify_heapam.c treat unlogged relations as if they were simply empty when in Hot Standby mode. This brings it in line with
verify_nbtree.c, which has handled unlogged relations in the same way since bugfix commit 6754fe65a4. This was an oversight in commit 866e24d47d, which extended contrib/amcheck to check heap relations.

In passing, lower the verbosity used when reporting that a relation has been skipped like this, from NOTICE to DEBUG1. This is appropriate because the skipping behavior is only an implementation detail, needed to work around the fact that unlogged tables don't have smgr-level storage for their main fork when in Hot Standby mode.

Affected unlogged relations should be considered "trivially verified", not skipped over. They are verified in the same sense that a totally empty relation can be verified. This behavior seems least surprising overall, since unlogged relations on a replica will initially be empty if and when the replica is promoted and Hot Standby ends.

Author: Mark Dilger

292698f158 amcheck: Skip unlogged relations in Hot Standby.
contrib/amcheck/verify_heapam.c | 16 ++++++++++++++++
contrib/amcheck/verify_nbtree.c | 5 +++--
2 files changed, 19 insertions(+), 2 deletions(-)

Upstream: git.postgresql.org


  • Share