From: | Alexander Lakhin <exclusion(at)gmail(dot)com> |
---|---|
To: | Mark Dilger <mark(dot)dilger(at)enterprisedb(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Cc: | Robert Haas <robertmhaas(at)gmail(dot)com>, Peter Geoghegan <pg(at)bowt(dot)ie> |
Subject: | Re: BUG #17212: pg_amcheck fails on checking temporary relations |
Date: | 2021-10-04 09:00:01 |
Message-ID: | f42de8ec-f219-0922-93b3-37a72bba1feb@gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs pgsql-hackers |
Hello Mark,
04.10.2021 01:20, Mark Dilger wrote:
> The attached patch includes a test case for this, which shows the problems against the current pg_amcheck.c, and a new version of pg_amcheck.c which fixes the bug. Could you review it?
>
> Thanks for bringing this to my attention.
There is another issue, that maybe should be discussed separately (or
this thread could be renamed to "... on checking specific relations"),
but the solution could be similar to that.
pg_amcheck also fails on checking invalid indexes, that could be created
legitimately by the CREATE INDEX CONCURRENTLY command.
For example, consider the following script:
psql -c "CREATE TABLE t(i numeric); INSERT INTO t VALUES
(generate_series(1, 10000000));"
psql -c "CREATE INDEX CONCURRENTLY t_idx ON t(i);" &
pg_amcheck -a --install-missing --heapallindexed --rootdescend
--progress || echo "FAIL"
pg_amcheck fails with:
btree index "regression.public.t_idx":
ERROR: cannot check index "t_idx"
DETAIL: Index is not valid.
781/781 relations (100%), 2806/2806 pages (100%)
FAIL
When an index created without CONCURRENTLY, it runs successfully.
Beside that, it seems that pg_amcheck produces a deadlock in such a case:
2021-10-04 11:23:38.584 MSK [1451296] ERROR: deadlock detected
2021-10-04 11:23:38.584 MSK [1451296] DETAIL: Process 1451296 waits for
ShareLock on virtual transaction 5/542; blocked by process 1451314.
Process 1451314 waits for ShareLock on relation 16385 of database
16384; blocked by process 1451296.
Process 1451296: CREATE INDEX CONCURRENTLY t_idx ON t(i);
Process 1451314: SELECT * FROM
"pg_catalog".bt_index_parent_check(index := '16390'::regclass,
heapallindexed := true, rootdescend := true)
2021-10-04 11:23:38.584 MSK [1451296] HINT: See server log for query
details.
2021-10-04 11:23:38.584 MSK [1451296] STATEMENT: CREATE INDEX
CONCURRENTLY t_idx ON t(i);
I think that the deadlock is yet another issue, as invalid indexes could
appear in other circumstances too.
Best regards,
Alexander
From | Date | Subject | |
---|---|---|---|
Next Message | Mark Dilger | 2021-10-04 15:10:28 | Re: BUG #17212: pg_amcheck fails on checking temporary relations |
Previous Message | Mark Dilger | 2021-10-03 22:20:20 | Re: BUG #17212: pg_amcheck fails on checking temporary relations |
From | Date | Subject | |
---|---|---|---|
Next Message | Dilip Kumar | 2021-10-04 09:21:22 | Re: [Proposal] Fully WAL logged CREATE DATABASE - No Checkpoints |
Previous Message | Daniel Gustafsson | 2021-10-04 08:39:25 | Re: replace InvalidXid(a macro that doesn't exist) with InvalidTransactionId(a macro that exists) in code comments |