Re: pg_dump with both --serializable-deferrable and -j

From: Andres Freund <andres(at)2ndquadrant(dot)com>
To: Kevin Grittner <kgrittn(at)ymail(dot)com>
Cc: Alexander Korotkov <aekorotkov(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pg_dump with both --serializable-deferrable and -j
Date: 2015-01-28 15:07:04
Message-ID: 20150128150704.GB6325@awork2.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2015-01-28 14:54:15 +0000, Kevin Grittner wrote:
> Kevin Grittner <kgrittn(at)ymail(dot)com> wrote:
> > Alexander Korotkov <aekorotkov(at)gmail(dot)com> wrote:
>
> >> Could we start snapshot-importing transaction with repeatable
> >> read isolation level?
> >
> > You can if you don't use the option which specifies that you want
> > serializable behavior. Why specify --serializable-deferrable if
> > you don't?
> >
> >> AFAICS, they should read exactly same data as snapshot-exporting
> >> serializable transaction.
> >
> > Sort of. The behavior once they have a snapshot and are running is
> > the same; the difference is whether the snapshot can see a
> > transient state which would not be consistent with some serial
> > order of transaction execution.
>
> Oh, wait; on a re-read I think I may have misunderstood the question.
>
> If you are talking about having pg_dump acquire a safe snapshot and
> have cooperating processes in the same pg_dump run use that
> snapshot in repeatable read transactions, then yes -- that would
> work. As long as a repeatable read transaction is using a safe
> snapshot it will not see any anomalies. That would be a better
> solution if it can be done. Do you have any code to suggest, or
> should I look at writing it?

Why could it be unsafe to import a snapshot that's been generated as
serializable deferrable into another backend? Doesn't the fact that it
has been exported out of a deferrable xact that's still running pretty
much guarantee that the other xact is also safe?

ISTM that the check is just overzelous and/or needs to be moved into
ImportSnapshot(). There it then could be made to check if the exporting
xact was also deferrable.

Greetings,

Andres Freund

--
Andres Freund http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2015-01-28 15:13:52 Re: PQgetssl() and alternative SSL implementations
Previous Message Kevin Grittner 2015-01-28 14:54:15 Re: pg_dump with both --serializable-deferrable and -j