Re: [HACKERS] GSOC'17 project introduction: Parallel COPY execution with errors handling

From: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
To: Alexey Kondratov <kondratov(dot)aleksey(at)gmail(dot)com>
Cc: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>, Peter Geoghegan <pg(at)bowt(dot)ie>, Stas Kelvich <s(dot)kelvich(at)postgrespro(dot)ru>, Robert Haas <robertmhaas(at)gmail(dot)com>, Nicolas Barbier <nicolas(dot)barbier(at)gmail(dot)com>, Alexander Korotkov <a(dot)korotkov(at)postgrespro(dot)ru>, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, Craig Ringer <craig(at)2ndquadrant(dot)com>, Anastasia Lubennikova <lubennikovaAV(at)gmail(dot)com>
Subject: Re: [HACKERS] GSOC'17 project introduction: Parallel COPY execution with errors handling
Date: 2017-11-30 22:58:36
Message-ID: 20171130225836.jcabecj6izpp4wyt@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Alexey Kondratov wrote:

> I have rebased my branch and squashed all commits into one, since the
> patch is quite small. Everything seems to be working fine now, patch
> passes all regression tests.

On a *very* quick look, please use an enum to return from NextCopyFrom
rather than 'int'. The chunks that change bool to int are very
odd-looking. This would move the comment that explains the value from
copy.c to copy.h, obviously. Also, you seem to be using non-ASCII dashes
in the descriptions of those values; please don't.

But those are really just minor nitpicks while paging through. After
looking at the way you're handling errors, it seems that you've chosen
to go precisely the way people were saying that was not admissible: use
a PG_TRY block, and when things go south, simply log a WARNING and move
on. This is unsafe. For example: what happens if the error being
raised is out-of-memory? Failing to re-throw means you don't release
current transaction memory context. What if the error is that WAL
cannot be written because the WAL disk ran out of space? This would
just be reported as a warning over and over until the server log disk is
also full. What if your insertion fired a trigger that caused an update
which got a serializability exception? You cannot just move on, because
at that point session state (serializability session state) might be
busted until you abort the current transaction.

Or maybe I misunderstood the patch completely.

--
Álvaro Herrera https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2017-11-30 22:59:26 Re: Commit fest 2017-11
Previous Message Sergei Kornilov 2017-11-30 22:05:52 Re: using index or check in ALTER TABLE SET NOT NULL