From: | Meng Qingzhong <mengqingzhong(dot)gm(at)gmail(dot)com> |
---|---|
To: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Why not report ERROR when "concurrent insert in progress within table"? |
Date: | 2021-01-03 13:49:51 |
Message-ID: | CAL+MxYn4hhVJKsmYgvZEMd8c4eamsg=BFVP1gGRLvsYPg==Cvw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi, all,
When using 'create index concurrently', we use a MVCC snaptshot, we should
not see tuples that are HEAPTUPLE_INSERT_IN_PROGRESS. I think we should
report an ERROR in this case. But, we report WARNING now.
In the early days, it indeed reports ERROR, but the behaviour is changed by
commit 1ddc2703a936d03953657f43345460b9242bbed1.
I am not very clear about it. Could anyone explain it?
The following are the related codes:
Earlier PG versions: the code is in function IndexBuildHeapScan
case HEAPTUPLE_DELETE_IN_PROGRESS:
/*
* As with INSERT_IN_PROGRESS case, this is unexpected
* unless it's our own deletion or a system catalog.
*/
Assert(!(heapTuple->t_data->t_infomask & HEAP_XMAX_IS_MULTI));
xwait = HeapTupleHeaderGetXmax(heapTuple->t_data);
if (!TransactionIdIsCurrentTransactionId(xwait))
{
if (!is_system_catalog)
elog(WARNING, "concurrent delete in progress within table
\"%s\"",
RelationGetRelationName(heapRelation));
Newest PG version: the code in function heapam_index_build_range_scan
Thanks all!
Regards,
Meng Qingzhong
From | Date | Subject | |
---|---|---|---|
Next Message | Tomas Vondra | 2021-01-03 14:35:39 | Re: Handing off SLRU fsyncs to the checkpointer |
Previous Message | Amit Kapila | 2021-01-03 13:34:40 | Re: [Patch] Optimize dropping of relation buffers using dlist |