pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: postgres_fdw: Fix handling of a pending asynchronous request in
2+ messages / 1 participants
[nested] [flat]

* pgsql: postgres_fdw: Fix handling of a pending asynchronous request in
@ 2022-01-27 07:23  Etsuro Fujita <efujita@postgresql.org>
  0 siblings, 0 replies; 2+ messages in thread

From: Etsuro Fujita @ 2022-01-27 07:23 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

postgres_fdw: Fix handling of a pending asynchronous request in postgresReScanForeignScan().

Commit 27e1f1456 failed to process a pending asynchronous request made
for a given ForeignScan node in postgresReScanForeignScan() (if any) in
cases where we would only reset the next_tuple counter in that function,
contradicting the assumption that there should be no pending
asynchronous requests that have been made for async-capable subplans for
the parent Append node after ReScan.  This led to an assert failure in
an assert-enabled build.  I think this would also lead to mis-rewinding
the cursor in that function in the case where we have already fetched
one batch for the ForeignScan node and the asynchronous request has been
made for the second batch, because even in that case we would just reset
the counter when called from that function, so we would fail to execute
MOVE BACKWARD ALL.

To fix, modify that function to process the asynchronous request before
restarting the scan.

While at it, add a comment to a function to match other places.

Per bug #17344 from Alexander Lakhin.  Back-patch to v14 where the
aforesaid commit came in.

Patch by me.  Test case by Alexander Lakhin, adjusted by me.  Reviewed
and tested by Alexander Lakhin and Dmitry Dolgov.

Discussion: https://postgr.es/m/17344-226b78b00de73a7e@postgresql.org

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/9e283fc85d66f6e4d355c6996e863afb026866d4

Modified Files
--------------
contrib/postgres_fdw/expected/postgres_fdw.out | 37 ++++++++++++++++++++++++++
contrib/postgres_fdw/postgres_fdw.c            | 14 ++++++++++
contrib/postgres_fdw/sql/postgres_fdw.sql      | 17 ++++++++++++
3 files changed, 68 insertions(+)



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* pgsql: postgres_fdw: Fix handling of a pending asynchronous request in
@ 2022-01-27 07:23  Etsuro Fujita <efujita@postgresql.org>
  0 siblings, 0 replies; 2+ messages in thread

From: Etsuro Fujita @ 2022-01-27 07:23 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

postgres_fdw: Fix handling of a pending asynchronous request in postgresReScanForeignScan().

Commit 27e1f1456 failed to process a pending asynchronous request made
for a given ForeignScan node in postgresReScanForeignScan() (if any) in
cases where we would only reset the next_tuple counter in that function,
contradicting the assumption that there should be no pending
asynchronous requests that have been made for async-capable subplans for
the parent Append node after ReScan.  This led to an assert failure in
an assert-enabled build.  I think this would also lead to mis-rewinding
the cursor in that function in the case where we have already fetched
one batch for the ForeignScan node and the asynchronous request has been
made for the second batch, because even in that case we would just reset
the counter when called from that function, so we would fail to execute
MOVE BACKWARD ALL.

To fix, modify that function to process the asynchronous request before
restarting the scan.

While at it, add a comment to a function to match other places.

Per bug #17344 from Alexander Lakhin.  Back-patch to v14 where the
aforesaid commit came in.

Patch by me.  Test case by Alexander Lakhin, adjusted by me.  Reviewed
and tested by Alexander Lakhin and Dmitry Dolgov.

Discussion: https://postgr.es/m/17344-226b78b00de73a7e@postgresql.org

Branch
------
REL_14_STABLE

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

Modified Files
--------------
contrib/postgres_fdw/expected/postgres_fdw.out | 37 ++++++++++++++++++++++++++
contrib/postgres_fdw/postgres_fdw.c            | 14 ++++++++++
contrib/postgres_fdw/sql/postgres_fdw.sql      | 17 ++++++++++++
3 files changed, 68 insertions(+)



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2022-01-27 07:23 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2022-01-27 07:23 pgsql: postgres_fdw: Fix handling of a pending asynchronous request in Etsuro Fujita <efujita@postgresql.org>
2022-01-27 07:23 pgsql: postgres_fdw: Fix handling of a pending asynchronous request in Etsuro Fujita <efujita@postgresql.org>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox