Re: Concurrency bug in UPDATE of partition-key

Поиск
Список
Период
Сортировка
Искать
От
Amit Kapila
Тема
Re: Concurrency bug in UPDATE of partition-key
Дата
Msg-id
CAA4eK1JgsDnx9YdwGZKM_PzVFbMoFP7z+-Tx58TKsxZzuiDbng@mail.gmail.com
Ответ на
Список
Дерево обсуждения
Concurrency bug in UPDATE of partition-key Amit Khandekar <amitdkhan.pg@gmail.com>
Re: Concurrency bug in UPDATE of partition-key Amit Kapila <amit.kapila16@gmail.com>
Re: Concurrency bug in UPDATE of partition-key Amit Khandekar <amitdkhan.pg@gmail.com>
Re: Concurrency bug in UPDATE of partition-key Amit Khandekar <amitdkhan.pg@gmail.com>
Re: Concurrency bug in UPDATE of partition-key Amit Kapila <amit.kapila16@gmail.com>
Re: Concurrency bug in UPDATE of partition-key Amit Khandekar <amitdkhan.pg@gmail.com>
Re: Concurrency bug in UPDATE of partition-key Amit Kapila <amit.kapila16@gmail.com>
Re: Concurrency bug in UPDATE of partition-key Amit Kapila <amit.kapila16@gmail.com>
Re: Concurrency bug in UPDATE of partition-key Amit Khandekar <amitdkhan.pg@gmail.com>
Re: Concurrency bug in UPDATE of partition-key Dilip Kumar <dilipbalaut@gmail.com>
Re: Concurrency bug in UPDATE of partition-key Amit Kapila <amit.kapila16@gmail.com>
Re: Concurrency bug in UPDATE of partition-key Amit Khandekar <amitdkhan.pg@gmail.com>
Re: Concurrency bug in UPDATE of partition-key Dilip Kumar <dilipbalaut@gmail.com>
Re: Concurrency bug in UPDATE of partition-key Amit Khandekar <amitdkhan.pg@gmail.com>
Re: Concurrency bug in UPDATE of partition-key Amit Kapila <amit.kapila16@gmail.com>
Re: Concurrency bug in UPDATE of partition-key Amit Khandekar <amitdkhan.pg@gmail.com>
Re: Concurrency bug in UPDATE of partition-key Amit Kapila <amit.kapila16@gmail.com>
Re: Concurrency bug in UPDATE of partition-key Alvaro Herrera <alvherre@2ndquadrant.com>
Re: Concurrency bug in UPDATE of partition-key Amit Kapila <amit.kapila16@gmail.com>
Re: Concurrency bug in UPDATE of partition-key Alvaro Herrera <alvherre@2ndquadrant.com>
Re: Concurrency bug in UPDATE of partition-key Amit Kapila <amit.kapila16@gmail.com>
Re: Concurrency bug in UPDATE of partition-key Amit Khandekar <amitdkhan.pg@gmail.com>
Re: Concurrency bug in UPDATE of partition-key Amit Kapila <amit.kapila16@gmail.com>
Re: Concurrency bug in UPDATE of partition-key Alvaro Herrera <alvherre@2ndquadrant.com>
Re: Concurrency bug in UPDATE of partition-key Amit Kapila <amit.kapila16@gmail.com>
Re: Concurrency bug in UPDATE of partition-key Amit Kapila <amit.kapila16@gmail.com>
Re: Concurrency bug in UPDATE of partition-key Alvaro Herrera <alvherre@2ndquadrant.com>
Re: Concurrency bug in UPDATE of partition-key Andres Freund <andres@anarazel.de>
Re: Concurrency bug in UPDATE of partition-key Amit Kapila <amit.kapila16@gmail.com>
Re: Concurrency bug in UPDATE of partition-key Amit Khandekar <amitdkhan.pg@gmail.com>
Re: Concurrency bug in UPDATE of partition-key Amit Khandekar <amitdkhan.pg@gmail.com>
Re: Concurrency bug in UPDATE of partition-key Amit Kapila <amit.kapila16@gmail.com>
Re: Concurrency bug in UPDATE of partition-key Amit Khandekar <amitdkhan.pg@gmail.com>
Re: Concurrency bug in UPDATE of partition-key Amit Kapila <amit.kapila16@gmail.com>
Re: Concurrency bug in UPDATE of partition-key Amit Khandekar <amitdkhan.pg@gmail.com>
Re: Concurrency bug in UPDATE of partition-key Dilip Kumar <dilipbalaut@gmail.com>
Re: Concurrency bug in UPDATE of partition-key Dilip Kumar <dilipbalaut@gmail.com>
Re: Concurrency bug in UPDATE of partition-key Amit Khandekar <amitdkhan.pg@gmail.com>
Re: Concurrency bug in UPDATE of partition-key Dilip Kumar <dilipbalaut@gmail.com>
On Tue, Jun 5, 2018 at 8:03 PM, Amit Khandekar <amitdkhan.pg@gmail.com> wrote:
Attached is a rebased patch version. Also included it in the upcoming
commitfest :
https://commitfest.postgresql.org/18/1660/


Doesn't this belong to PostgreSQL 11 Open Items [1] or are you proposing it as a feature enhancement for next version?
 
In the rebased version, the new test cases are added in the existing
isolation/specs/partition-key-update-1.spec test.


  if (!tuple_deleted)
- return NULL;
+ {
+ /*
+ * epqslot will be typically NULL. But when ExecDelete() finds
+ * that another transaction has concurrently updated the same
+ * row, it re-fetches the row, skips the delete, and epqslot is
+ * set to the re-fetched tuple slot. In that case, we need to
+ * do all the checks again.
+ */
+ if (TupIsNull(epqslot))
+ return NULL;
+ else
+ {
+ slot = ExecFilterJunk(resultRelInfo->ri_junkFilter, epqslot);
+ tuple = ExecMaterializeSlot(slot);
+ goto lreplace;
+ }
+ }

I think this will allow before row delete triggers to be fired more than once.  Normally, if the EvalPlanQual testing generates a new tuple, we don't fire the triggers again.  Now, one possibility could be that we don't skip the delete after a concurrent update and still allow inserts to use a new tuple generated by EvalPlanQual testing of delete.  However, I think we need to perform rechecks for update to check if the modified tuple still requires to be moved to new partition, right or do you have some other reason in mind?



--
With Regards,
Amit Kapila.
EnterpriseDB: http://www.enterprisedb.com
В списке pgsql-hackers по дате отправления
От: David Rowley
Дата:
От: Tsunakawa, Takayuki
Дата:
FAQ