Re: EvalPlanQual behaves oddly for FDW queries involving system columns

Поиск
Список
Период
Сортировка
От Etsuro Fujita
Тема Re: EvalPlanQual behaves oddly for FDW queries involving system columns
Дата
Msg-id 551E7D58.4000008@lab.ntt.co.jp
обсуждение исходный текст
Ответ на Re: EvalPlanQual behaves oddly for FDW queries involving system columns  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: EvalPlanQual behaves oddly for FDW queries involving system columns  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
On 2015/03/13 0:50, Tom Lane wrote:
> I think the real fix as far as postgres_fdw is concerned is in fact
> to let it adopt a different ROW_MARK strategy, since it has meaningful
> ctid values.  However, that is not a one-size-fits-all answer.

> The tableoid problem can be fixed much less invasively as per the attached
> patch.  I think that we should continue to assume that ctid is not
> meaningful (and hence should read as (4294967295,0)) in FDWs that use
> ROW_MARK_COPY, and press forward on fixing the locking issues for
> postgres_fdw by letting it use ROW_MARK_REFERENCE or something close to
> that.  That would also cause ctid to read properly for rows from
> postgres_fdw.

To support ROW_MARK_REFERENCE on (postgres_fdw) foreign tables, I'd like
to propose the following FDW APIs:

RowMarkType
GetForeignRowMarkType(Oid relid,
                       LockClauseStrength strength);

Decide which rowmark type to use for a foreign table (that has strength
= LCS_NONE), ie, ROW_MARK_REFERENCE or ROW_MARK_COPY.  (For now, the
second argument takes LCS_NONE only, but is intended to be used for the
possible extension to the other cases.)  This is called during
select_rowmark_type() in the planner.

void
BeginForeignFetch(EState *estate,
                   ExecRowMark *erm,
                   List *fdw_private,
                   int eflags);

Begin a remote fetch. This is called during InitPlan() in the executor.

HeapTuple
ExecForeignFetch(EState *estate,
                  ExecRowMark *erm,
                  ItemPointer tupleid);

Re-fetch the specified tuple.  This is called during
EvalPlanQualFetchRowMarks() in the executor.

void
EndForeignFetch(EState *estate,
                 ExecRowMark *erm);

End a remote fetch.  This is called during ExecEndPlan() in the executor.

And I'd also like to propose to add a table/server option,
row_mark_reference, to postgres_fdw.  When a user sets the option to
true for eg a foreign table, ROW_MARK_REFERENCE will be used for the
table, not ROW_MARK_COPY.

Attached is a WIP patch, which contains no docs/regression tests.

It'd be appreciated if anyone could send back any comments earlier.

Best regards,
Etsuro Fujita

Вложения

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

Предыдущее
От: Michael Paquier
Дата:
Сообщение: Re: The return value of allocate_recordbuf()
Следующее
От: Jan Urbański
Дата:
Сообщение: Re: libpq's multi-threaded SSL callback handling is busted