buffer refcount leak in foreign batch insert code
Alexander Pyhalov <a.pyhalov@postgrespro.ru>
From: Alexander Pyhalov <a.pyhalov@postgrespro.ru>
To: pgsql-hackers@postgresql.org
Date: 2023-04-21T10:07:03Z
Lists: pgsql-hackers
Attachments
- repro_small.sql (text/plain)
- 0001-Fix-buffer-refcount-leak.patch (text/x-diff) patch 0001
Hi.
We've found that in cases like the one attached, when we insert into
foreign partition with batch_size set, buffer refcount leak is detected.
The above example we see a dozen of similar messages:
repro_small.sql:31: WARNING: buffer refcount leak: [14621]
(rel=base/16718/16732, blockNum=54, flags=0x93800000
The issue was introduced in the following commit
commit b676ac443b6a83558d4701b2dd9491c0b37e17c4
Author: Tomas Vondra <tomas.vondra@postgresql.org>
Date: Fri Jun 11 20:19:48 2021 +0200
Optimize creation of slots for FDW bulk inserts
In this commit we avoid recreating slots for each batch. But it seems
that created slots should still be cleared in the end of
ExecBatchInsert().
At least the attached patch seems to fix the issue.
--
Best regards,
Alexander Pyhalov,
Postgres Professional
Commits
-
Fix buffer refcount leak with FDW bulk inserts
- 4cc56f8edbe6 14.8 landed
- aa6177c882d4 15.3 landed
- 806fad7573e2 16.0 landed
-
Optimize creation of slots for FDW bulk inserts
- b676ac443b6a 14.0 cited