Andres Freund <andres@2ndquadrant.com> wrote:
> Kevin Grittner <kgrittn@ymail.com> wrote:
>>> Alexander Korotkov <aekorotkov@gmail.com> wrote:
>>>
>>>> Could we start snapshot-importing transaction with repeatable
>>>> read isolation level?
>> 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.
> Why could it be unsafe to import a snapshot that's been generated as
> serializable deferrable into another backend?
That wouldn't be unsafe, which is what I was saying the post you
responded to.
> 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?
As long as it is at least repeatable read, yes.
> 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.
That would be great if ImportSnapshot had access to that
information; I don't see it, though. Having pg_dump use repeatable
read transactions for the processes that import the snapshot would
work fine, as long as they are reading a snapshot which was
captured by a serializable read only deferrable transaction.
--
Kevin Grittner
EDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company