Re: Parallel copy
vignesh C <vignesh21@gmail.com>
From: vignesh C <vignesh21@gmail.com>
To: Ashutosh Sharma <ashu.coek88@gmail.com>
Cc: Andres Freund <andres@anarazel.de>, Amit Kapila <amit.kapila16@gmail.com>, Robert Haas <robertmhaas@gmail.com>, Ants Aasma <ants@cybertec.at>, Tomas Vondra <tomas.vondra@2ndquadrant.com>,
Alastair Turner <minion@decodable.me>, Thomas Munro <thomas.munro@gmail.com>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2020-06-23T06:52:02Z
Lists: pgsql-hackers
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Allow WaitLatch() to be used without a latch.
- 733fa9aa51c5 14.0 cited
-
Add %P to log_line_prefix for parallel group leader
- b8fdee7d0ca8 14.0 cited
-
Include replication origins in SQL functions for commit timestamp
- b1e48bbe64a4 14.0 cited
-
Avoid useless buffer allocations during binary COPY FROM.
- cd22d3cdb9bd 14.0 cited
Attachments
- 0001-Copy-code-readjustment-to-support-parallel-copy.patch (application/x-patch) patch 0001
- 0004-Documentation-for-parallel-copy.patch (application/x-patch) patch 0004
- 0003-Allow-copy-from-command-to-process-data-from-file-ST.patch (application/x-patch) patch 0003
- 0002-Framework-for-leader-worker-in-parallel-copy.patch (application/x-patch) patch 0002
- 0005-Tests-for-parallel-copy.patch (application/x-patch) patch 0005
- 0006-Parallel-Copy-For-Binary-Format-Files.patch (application/x-patch) patch 0006
On Tue, Jun 23, 2020 at 8:07 AM vignesh C <vignesh21@gmail.com> wrote:
> I have attached the patch for the same with the fixes.
The patches were not applying on the head, attached the patches that can be
applied on head.
I have added a commitfest entry[1] for this feature.
[1] - https://commitfest.postgresql.org/28/2610/
On Tue, Jun 23, 2020 at 8:07 AM vignesh C <vignesh21@gmail.com> wrote:
> Thanks Ashutosh For your review, my comments are inline.
> On Fri, Jun 19, 2020 at 5:41 PM Ashutosh Sharma <ashu.coek88@gmail.com>
> wrote:
> >
> > Hi,
> >
> > I just got some time to review the first patch in the list i.e.
> 0001-Copy-code-readjustment-to-support-parallel-copy.patch. As the patch
> name suggests, it is just trying to reshuffle the existing code for COPY
> command here and there. There is no extra changes added in the patch as
> such, but still I do have some review comments, please have a look:
> >
> > 1) Can you please add some comments atop the new function
> PopulateAttributes() describing its functionality in detail. Further, this
> new function contains the code from BeginCopy() to set attribute level
> options used with COPY FROM such as FORCE_QUOTE, FORCE_NOT_NULL, FORCE_NULL
> etc. in cstate and along with that it also copies the code from BeginCopy()
> to set other infos such as client encoding type, encoding conversion etc.
> Hence, I think it would be good to give it some better name, basically
> something that matches with what actually it is doing.
> >
>
> There is no new code added in this function, some part of code from
> BeginCopy was made in to a new function as this part of code will also
> be required for the parallel copy workers before the workers start the
> actual copy operation. This code was made into a function to avoid
> duplication. Changed the function name to PopulateGlobalsForCopyFrom &
> added few comments.
>
> > 2) Again, the name for the new function CheckCopyFromValidity() doesn't
> look good to me. From the function name it appears as if it does the sanity
> check of the entire COPY FROM command, but actually it is just doing the
> sanity check for the target relation specified with COPY FROM. So, probably
> something like CheckTargetRelValidity would look more sensible, I think?
> TBH, I am not good at naming the functions so you can always ignore my
> suggestions about function and variable names :)
> >
>
> Changed as suggested.
> > 3) Any reason for not making CheckCopyFromValidity as a macro instead of
> a new function. It is just doing the sanity check for the target relation.
> >
>
> I felt there is reasonable number of lines in the function & it is not
> in performance intensive path, so I preferred function over macro.
> Your thoughts?
>
> > 4) Earlier in CopyReadLine() function while trying to clear the EOL
> marker from cstate->line_buf.data (copied data), we were not checking if
> the line read by CopyReadLineText() function is a header line or not, but I
> can see that your patch checks that before clearing the EOL marker. Any
> reason for this extra check?
> >
>
> If you see the caller of CopyReadLine, i.e. NextCopyFromRawFields does
> nothing for the header line, server basically calls CopyReadLine
> again, it is a kind of small optimization. Anyway server is not going
> to do anything with header line, I felt no need to clear EOL marker
> for header lines.
> /* on input just throw the header line away */
> if (cstate->cur_lineno == 0 && cstate->header_line)
> {
> cstate->cur_lineno++;
> if (CopyReadLine(cstate))
> return false; /* done */
> }
>
> cstate->cur_lineno++;
>
> /* Actually read the line into memory here */
> done = CopyReadLine(cstate);
> I think no need to make a fix for this. Your thoughts?
>
> > 5) I noticed the below spurious line removal in the patch.
> >
> > @@ -3839,7 +3953,6 @@ static bool
> > CopyReadLine(CopyState cstate)
> > {
> > bool result;
> > -
> >
>
> Fixed.
> I have attached the patch for the same with the fixes.
> Thoughts?
>
> Regards,
> Vignesh
> EnterpriseDB: http://www.enterprisedb.com
>