pgsql: Fix EXPLAIN ANALYZE for async-capable nodes.

Поиск
Список
Период
Сортировка
От Etsuro Fujita
Тема pgsql: Fix EXPLAIN ANALYZE for async-capable nodes.
Дата
Msg-id E1lgh42-0002Ab-5M@gemulon.postgresql.org
обсуждение исходный текст
Список pgsql-committers
Fix EXPLAIN ANALYZE for async-capable nodes.

EXPLAIN ANALYZE for an async-capable ForeignScan node associated with
postgres_fdw is done just by using instrumentation for ExecProcNode()
called from the node's callbacks, causing the following problems:

1) If the remote table to scan is empty, the node is incorrectly
   considered as "never executed" by the command even if the node is
   executed, as ExecProcNode() isn't called from the node's callbacks at
   all in that case.
2) The command fails to collect timings for things other than
   ExecProcNode() done in the node, such as creating a cursor for the
   node's remote query.

To fix these problems, add instrumentation for async-capable nodes, and
modify postgres_fdw accordingly.

My oversight in commit 27e1f1456.

While at it, update a comment for the AsyncRequest struct in execnodes.h
and the documentation for the ForeignAsyncRequest API in fdwhandler.sgml
to match the code in ExecAsyncAppendResponse() in nodeAppend.c, and fix
typos in comments in nodeAppend.c.

Per report from Andrey Lepikhov, though I didn't use his patch.

Reviewed-by: Andrey Lepikhov
Discussion: https://postgr.es/m/2eb662bb-105d-fc20-7412-2f027cc3ca72%40postgrespro.ru

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/a363bc6da96b14d27e1cae1bae97242eb6ade5e6

Modified Files
--------------
contrib/auto_explain/auto_explain.c             |  2 +-
contrib/pg_stat_statements/pg_stat_statements.c |  2 +-
contrib/postgres_fdw/expected/postgres_fdw.out  | 39 +++++++++++++++++++++----
contrib/postgres_fdw/postgres_fdw.c             |  9 ++++--
contrib/postgres_fdw/sql/postgres_fdw.sql       | 21 +++++++++----
doc/src/sgml/fdwhandler.sgml                    |  2 +-
src/backend/executor/execAsync.c                | 30 +++++++++++++++++++
src/backend/executor/execMain.c                 |  2 +-
src/backend/executor/execProcnode.c             |  3 +-
src/backend/executor/instrument.c               | 21 ++++++++++++-
src/backend/executor/nodeAppend.c               | 12 ++++----
src/backend/executor/nodeForeignscan.c          |  7 +++++
src/include/executor/instrument.h               |  5 +++-
src/include/nodes/execnodes.h                   |  5 +++-
14 files changed, 134 insertions(+), 26 deletions(-)


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: pgsql: Reduce runtime of privileges.sql test under CLOBBER_CACHE_ALWAYS
Следующее
От: Michael Paquier
Дата:
Сообщение: Re: pgsql: Add support for LZ4 build in MSVC scripts