From: | Merlin Moncure <mmoncure(at)gmail(dot)com> |
---|---|
To: | Simon Riggs <simon(at)2ndquadrant(dot)com> |
Cc: | Robert Haas <robertmhaas(at)gmail(dot)com>, Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: autonomous transactions |
Date: | 2016-10-10 14:44:57 |
Message-ID: | CAHyXU0yQVi7vDJMOO7tyZHz4==iKFsdCrdQZJwWKG+PhdJ-GsQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Thu, Oct 6, 2016 at 3:53 PM, Simon Riggs <simon(at)2ndquadrant(dot)com> wrote:
> On 6 October 2016 at 21:27, Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
>> I think we should implement background transactions and call them
>> background transactions. That allows us to expose additional
>> functionality which is useful, like the ability to kick something off
>> and check back later for the results. There's no reason to call it
>> background transactions and also call it autonomous transactions: one
>> feature doesn't need two names.
>
> I'm happy to also invoke it via an alternate mechanism or API, so that
> it can continue to be used even if the above mechanism changes.
>
> We have no need to wait for the perfect solution, even assuming we
> would ever agree that just one exists.
-1 on implementing both autonomous and background transactions. This
will confuse everyone.
The lingo here is no so important, I think. What *is* important is
defining how the locking and execution rules should work and the
implementation should flow from that. Those rules should be estimated
from competing implementations and how well they work. +1 for any
solution that makes migration from other solutions to postgres easier.
bgworkers should be considered if you want things to run in parallel.
Reading the proposal (note, I may have missed it) it isn't clear to me
if you can have the parent and AT run a query at the same time.
Should this (parallel execution) be a design goal, then that's the end
of the story.
However I don't think it is TBH. ISTM the expectation is single
threaded behavior with finer grained control of commits. If we're
not 100% clear on this point one way or the other then things are a
bit preemptive. Maybe we are clear and I missed something?
One major advantage non-bgworker serilized execution approach is that
certain classes of deadlock are easier to detect or do not exist since
there is only one execution state; AIUI it's impossible for two
transaction states to be simultaneously waiting assuming the pl/pgsql
instuctions are not run in parallel with one exception, and that is
the AT trying to acquire a lock exclusively held by the master. If
the AT blocks on the parent it ought to be O(1) and instant to detect
that and roll it back with right supporting infrastructure in the lock
manager. It also makes sharing execution state much easier,
especially the parts that look like, "I'm waiting here until the other
guy finishes" since there's only one "guy".
How will advisory locks work? I think they'd block with bgworkers and
not block with non-bgworkers. What about other session based stuff
like prepared statements? Expectations around those cases out to
clarify the implementation.
merlin
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2016-10-10 14:54:29 | Re: cygwin64 assertion failure |
Previous Message | Pavan Deolasee | 2016-10-10 14:41:16 | Re: FSM corruption leading to errors |