pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Fix buffer refcount leak with FDW bulk inserts
3+ messages / 1 participants
[nested] [flat]

* pgsql: Fix buffer refcount leak with FDW bulk inserts
@ 2023-04-25 00:43  Michael Paquier <michael@paquier.xyz>
  0 siblings, 0 replies; 3+ messages in thread

From: Michael Paquier @ 2023-04-25 00:43 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix buffer refcount leak with FDW bulk inserts

The leak would show up when using batch inserts with foreign tables
included in a partition tree, as the slots used in the batch were not
reset once processed.  In order to fix this problem, some
ExecClearTuple() are added to clean up the slots used once a batch is
filled and processed, mapping with the number of slots currently in use
as tracked by the counter ri_NumSlots.

This buffer refcount leak has been introduced in b676ac4 with the
addition of the executor facility to improve bulk inserts for FDWs, so
backpatch down to 14.

Alexander has provided the patch (slightly modified by me).  The test
for postgres_fdw comes from me, based on the test case that the author
has sent in the report.

Author: Alexander Pyhalov
Discussion: https://postgr.es/m/b035780a740efd38dc30790c76927255@postgrespro.ru
Backpatch-through: 14

Branch
------
REL_14_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/4cc56f8edbe6c00ecb66d6b2c775eaf3268706e3

Modified Files
--------------
contrib/postgres_fdw/expected/postgres_fdw.out | 22 ++++++++++++++++++++++
contrib/postgres_fdw/sql/postgres_fdw.sql      | 18 ++++++++++++++++++
src/backend/executor/nodeModifyTable.c         | 10 ++++++++--
3 files changed, 48 insertions(+), 2 deletions(-)



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

* pgsql: Fix buffer refcount leak with FDW bulk inserts
@ 2023-04-25 00:43  Michael Paquier <michael@paquier.xyz>
  0 siblings, 0 replies; 3+ messages in thread

From: Michael Paquier @ 2023-04-25 00:43 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix buffer refcount leak with FDW bulk inserts

The leak would show up when using batch inserts with foreign tables
included in a partition tree, as the slots used in the batch were not
reset once processed.  In order to fix this problem, some
ExecClearTuple() are added to clean up the slots used once a batch is
filled and processed, mapping with the number of slots currently in use
as tracked by the counter ri_NumSlots.

This buffer refcount leak has been introduced in b676ac4 with the
addition of the executor facility to improve bulk inserts for FDWs, so
backpatch down to 14.

Alexander has provided the patch (slightly modified by me).  The test
for postgres_fdw comes from me, based on the test case that the author
has sent in the report.

Author: Alexander Pyhalov
Discussion: https://postgr.es/m/b035780a740efd38dc30790c76927255@postgrespro.ru
Backpatch-through: 14

Branch
------
REL_15_STABLE

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

Modified Files
--------------
contrib/postgres_fdw/expected/postgres_fdw.out | 22 ++++++++++++++++++++++
contrib/postgres_fdw/sql/postgres_fdw.sql      | 18 ++++++++++++++++++
src/backend/executor/nodeModifyTable.c         | 10 ++++++++--
3 files changed, 48 insertions(+), 2 deletions(-)



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

* pgsql: Fix buffer refcount leak with FDW bulk inserts
@ 2023-04-25 00:43  Michael Paquier <michael@paquier.xyz>
  0 siblings, 0 replies; 3+ messages in thread

From: Michael Paquier @ 2023-04-25 00:43 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix buffer refcount leak with FDW bulk inserts

The leak would show up when using batch inserts with foreign tables
included in a partition tree, as the slots used in the batch were not
reset once processed.  In order to fix this problem, some
ExecClearTuple() are added to clean up the slots used once a batch is
filled and processed, mapping with the number of slots currently in use
as tracked by the counter ri_NumSlots.

This buffer refcount leak has been introduced in b676ac4 with the
addition of the executor facility to improve bulk inserts for FDWs, so
backpatch down to 14.

Alexander has provided the patch (slightly modified by me).  The test
for postgres_fdw comes from me, based on the test case that the author
has sent in the report.

Author: Alexander Pyhalov
Discussion: https://postgr.es/m/b035780a740efd38dc30790c76927255@postgrespro.ru
Backpatch-through: 14

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/806fad7573e2b44de57888e3c04eab8eec4a69a8

Modified Files
--------------
contrib/postgres_fdw/expected/postgres_fdw.out | 22 ++++++++++++++++++++++
contrib/postgres_fdw/sql/postgres_fdw.sql      | 18 ++++++++++++++++++
src/backend/executor/nodeModifyTable.c         | 10 ++++++++--
3 files changed, 48 insertions(+), 2 deletions(-)



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


end of thread, other threads:[~2023-04-25 00:43 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2023-04-25 00:43 pgsql: Fix buffer refcount leak with FDW bulk inserts Michael Paquier <michael@paquier.xyz>
2023-04-25 00:43 pgsql: Fix buffer refcount leak with FDW bulk inserts Michael Paquier <michael@paquier.xyz>
2023-04-25 00:43 pgsql: Fix buffer refcount leak with FDW bulk inserts Michael Paquier <michael@paquier.xyz>

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