Re: BUG #18103: bugs of concurrent merge into when use different join plan

Поиск
Список
Период
Сортировка
От Richard Guo
Тема Re: BUG #18103: bugs of concurrent merge into when use different join plan
Дата
Msg-id CAMbWs491AfSCzUh1oUPFt=PD4hkoCmhwLYKU=BDhTUv0jQyB_g@mail.gmail.com
обсуждение исходный текст
Ответ на Re: BUG #18103: bugs of concurrent merge into when use different join plan  (Dean Rasheed <dean.a.rasheed@gmail.com>)
Ответы Re: BUG #18103: bugs of concurrent merge into when use different join plan  (Dean Rasheed <dean.a.rasheed@gmail.com>)
Список pgsql-bugs

On Thu, Sep 21, 2023 at 7:49 PM Dean Rasheed <dean.a.rasheed@gmail.com> wrote:
I don't feel that I have a good understanding of the EPQ mechanism,
but src/backend/executor/README says:

"""
It is also possible that there are relations in the query that are not
to be locked (they are neither the UPDATE/DELETE target nor specified to
be locked in SELECT FOR UPDATE/SHARE).  When re-running the test query
we want to use the same rows from these relations that were joined to
the locked rows.  For ordinary relations this can be implemented relatively
cheaply by including the row TID in the join outputs and re-fetching that
TID.  (The re-fetch is expensive, but we're trying to optimize the normal
case where no re-test is needed.)  We have also to consider non-table
relations, such as a ValuesScan or FunctionScan.  For these, since there
is no equivalent of TID, the only practical solution seems to be to include
the entire row value in the join output row.
"""

and this is not happening for MERGE. 
 
On the face of it, that looks like a simple oversight in
preprocess_rowmarks(), and changing it, as in the attached, fixes the
reported issue.

Agreed.  We need rowmarks for MERGE too.  I found that the following
comment from plannodes.h is very useful in understanding this.

* When doing UPDATE, DELETE, or SELECT FOR UPDATE/SHARE, we have to uniquely
* identify all the source rows, not only those from the target relations, so
* that we can perform EvalPlanQual rechecking at need.

To nitpick, there are some comments that may need to be updated to
include MERGE, such as the comments for ExecRowMark, RowMarkType and
PlanRowMark.

Thanks
Richard

В списке pgsql-bugs по дате отправления:

Предыдущее
От: Alexander Lakhin
Дата:
Сообщение: Re: BUG #18129: GiST index produces incorrect query results
Следующее
От: Sorin Mircioiu
Дата:
Сообщение: PostgreSQL's processes blocking each other are not detected as deadlock