Re: [POC] Fast COPY FROM command for the table with foreign partitions

From: Andrey Lepikhov <a(dot)lepikhov(at)postgrespro(dot)ru>
To: "Hou, Zhijie" <houzj(dot)fnst(at)cn(dot)fujitsu(dot)com>, Amit Langote <amitlangote09(at)gmail(dot)com>, "Tsunakawa, Takayuki" <tsunakawa(dot)takay(at)fujitsu(dot)com>
Cc: Alexey Kondratov <a(dot)kondratov(at)postgrespro(dot)ru>, Michael Paquier <michael(at)paquier(dot)xyz>, Ashutosh Bapat <ashutosh(dot)bapat(at)2ndquadrant(dot)com>, Ashutosh Bapat <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com>, Etsuro Fujita <etsuro(dot)fujita(at)gmail(dot)com>, PostgreSQL-Dev <pgsql-hackers(at)postgresql(dot)org>, "Tang, Haiying" <tanghy(dot)fnst(at)cn(dot)fujitsu(dot)com>
Subject: Re: [POC] Fast COPY FROM command for the table with foreign partitions
Date: 2020-12-30 07:16:07
Message-ID: ca933cda-b8c3-9e9c-23a0-91af2e2a2624@postgrespro.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 29.12.2020 16:20, Hou, Zhijie wrote:
>> see new version in attachment.
>
> I took a look into the patch, and have some comments.
>
> 1.
> + PG_FINALLY();
> + {
> + copy_fmstate = NULL; /* Detect problems */
> I don't quite understand this comment,
> does it means we want to detect something like Null reference ?
>
>
> 2.
> + PG_FINALLY();
> + {
> ...
> + if (!OK)
> + PG_RE_THROW();
> + }
> Is this PG_RE_THROW() necessary ?
> IMO, PG_FINALLY will reproduce the PG_RE_THROW action if we get to the code block due to an error being thrown.

This is a debugging stage atavisms. fixed.
>
> 3.
> + ereport(ERROR,
> + (errmsg("unexpected extra results during COPY of table: %s",
> + PQerrorMessage(conn))));
>
> I found some similar message like the following:
>
> pg_log_warning("unexpected extra results during COPY of table \"%s\"",
> tocEntryTag);
> How about using existing messages style ?

This style is intended for use in frontend utilities, not for contrib
extensions, i think.
>
> 4.
> I noticed some not standard code comment[1].
> I think it's better to comment like:
> /*
> * line 1
> * line 2
> */
>
> [1]-----------
> + /* Finish COPY IN protocol. It is needed to do after successful copy or
> + * after an error.
> + */
>
>
> +/*
> + *
> + * postgresExecForeignCopy
>
> +/*
> + *
> + * postgresBeginForeignCopy
Thanks, fixed.
The patch in attachment rebased on 107a2d4204.

--
regards,
Andrey Lepikhov
Postgres Professional

Attachment Content-Type Size
v13_2-0002-Fast-COPY-FROM-into-the-foreign-or-sharded-table.patch text/plain 35.9 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2020-12-30 07:17:33 Re: Weird failure in explain.out with OpenBSD
Previous Message Peter Smith 2020-12-30 06:21:20 Re: Single transaction in the tablesync worker?