Re: POC: postgres_fdw insert batching
Tomas Vondra <tomas.vondra@enterprisedb.com>
From: Tomas Vondra <tomas.vondra@enterprisedb.com>
To: Zhihong Yu <zyu@yugabyte.com>
Cc: Amit Langote <amitlangote09@gmail.com>,
"tsunakawa.takay@fujitsu.com" <tsunakawa.takay@fujitsu.com>,
"Andrey V. Lepikhov" <a.lepikhov@postgrespro.ru>,
Tomas Vondra <tomas.vondra@2ndquadrant.com>,
"pgsql-hackers@postgresql.org" <pgsql-hackers@postgresql.org>
Date: 2021-01-21T00:56:25Z
Lists: pgsql-hackers
On 1/21/21 1:17 AM, Zhihong Yu wrote:
> Hi,
> The assignment to resultRelInfo is done when junk_filter_needed is true:
>
> if (junk_filter_needed)
> {
> resultRelInfo = mtstate->resultRelInfo;
>
> Should the code for determining batch size access mtstate->resultRelInfo
> directly ?
>
IMO the issue is that code iterates over all plans and moves to the next
for each one:
resultRelInfo++;
so it ends up pointing past the last element, hence the failures. So
yeah, either the code needs to move before the loop (per my patch), or
we need to access mtstate->resultRelInfo directly.
I'm pretty amazed this did not crash during any of the many regression
runs I did recently.
regards
--
Tomas Vondra
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
Commits
-
Fix tuple routing to initialize batching only for inserts
- 927f453a9410 14.0 landed
-
Fix pointer type in ExecForeignBatchInsert SGML docs
- c15283ff429b 14.0 landed
-
Fix initialization of FDW batching in ExecInitModifyTable
- 920f853dc948 14.0 landed
-
Implement support for bulk inserts in postgres_fdw
- b663a4136331 14.0 landed