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