We need to support ForeignRecheck for late row locking, don't we?
От | Etsuro Fujita |
---|---|
Тема | We need to support ForeignRecheck for late row locking, don't we? |
Дата | |
Msg-id | 55AF6C33.2030003@lab.ntt.co.jp обсуждение исходный текст |
Ответы |
Re: We need to support ForeignRecheck for late row locking,
don't we?
|
Список | pgsql-hackers |
While working on the issue "Foreign join pushdown vs EvalPlanQual", I happened to notice odd behaviors of late row locking in FDWs. An example will be shown below using the attached postgres_fdw patch, which is basically the same as [1], but I changed its isolation level to READ COMMITTED and modified it so that the output parameter "updated" of RefetchForeignRow is updated accordingly. [Create an environment] mydatabase=# create table mytable (a int); mydatabase=# insert into mytable values (1); postgres=# create extension postgres_fdw; postgres=# create server myserver foreign data wrapper postgres_fdw options (dbname 'mydatabase'); postgres=# create user mapping for current_user server myserver; postgres=# create foreign table ftable (a int) server myserver options (table_name 'mytable'); [Run concurrent transactions that behave oddly] mydatabase=# begin; mydatabase=# update mytable set a = a + 1; postgres=# select * from ftable where a = 1 for update; mydatabase=# commit; (After the commit, the following result will be shown in the terminal for the postgres database. Note that the result doesn't satify a = 1.) a --- 2 (1 row) I think the reason for that is because we don't check pushed-down quals inside an EPQ testing even if what was fetched by RefetchForeignRow was an updated version of the tuple rather than the same version previously obtained. So, to fix this, I'd like to propose that pushed-down quals be checked in ForeignRecheck. Comments welcome! Best regards, Etsuro Fujita [1] http://www.postgresql.org/message-id/16016.1431455074@sss.pgh.pa.us
Вложения
В списке pgsql-hackers по дате отправления: