Re: BUG #17212: pg_amcheck fails on checking temporary relations

Mark Dilger <mark.dilger@enterprisedb.com>

From: Mark Dilger <mark.dilger@enterprisedb.com>
To: Peter Geoghegan <pg@bowt.ie>
Cc: Pavel Borisov <pashkin.elfe@gmail.com>, Alexander Lakhin <exclusion@gmail.com>, Robert Haas <robertmhaas@gmail.com>, PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2021-10-06T17:19:01Z
Lists: pgsql-bugs, pgsql-hackers

> On Oct 6, 2021, at 10:16 AM, Peter Geoghegan <pg@bowt.ie> wrote:
> 
> A return value of 0 cannot be said to indicate that the database is
> not corrupt;

Nor can a non-zero value be said to indicate that the database is corrupt.

These invocations will still return a non-zero exit status:

	pg_amcheck -D no_privs_database
	pg_amcheck --index="no_such_index"
	pg_amcheck --table="somebody_elses_temp_table"
	pg_amcheck --index="somebody_elses_temp_index"

but these have been modified to no longer do so:

	pg_amcheck -D my_database_in_recovery --parent-check
	pg_amcheck -D my_database_in_recovery --heapallindexed
	pg_amcheck --all

Please compare to:

	find /private || echo "FAIL"
	rm /not/my/file || echo "FAIL"

I'm not sure how the idea that pg_amcheck should never give back a failure code unless there is corruption got inserted into this thread, but I'm not on board with that as an invariant statement.  The differences in the upcoming version are

1) --all no longer means "all relations" but rather "all checkable relations"
2) checking options should be automatically downgraded under circumstances where they cannot be applied
3) unlogged relations during replication are by definition not corrupt

I think #1 and #3 are unsurprising enough that they need no documentation update.  #2 is slightly surprising (at least to me) so I updated the docs for it.


—
Mark Dilger
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company






Commits

  1. Remove unstable pg_amcheck tests.

  2. pg_amcheck: avoid unhelpful verification attempts.

  3. amcheck: Skip unlogged relations in Hot Standby.

  4. amcheck: Skip unlogged relations during recovery.