From: | Alvaro Herrera <alvherre(at)commandprompt(dot)com> |
---|---|
To: | Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com> |
Cc: | Simon Riggs <simon(at)2ndQuadrant(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Subtransaction commits and Hot Standby |
Date: | 2008-09-16 14:11:49 |
Message-ID: | 20080916141148.GA9229@alvh.no-ip.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers pgsql-patches |
Heikki Linnakangas wrote:
> Simon Riggs wrote:
>> Subtransactions cause a couple of problems for Hot Standby:
>
> Do we need to treat subtransactions any differently from normal
> transactions? Just treat all subtransactions as top-level transactions
> until commit, and mark them all as committed when you see the commit
> record for the top-level transaction.
This could lead to inconsistent results -- some of the subtransactions
could be marked as committed while others are still in progress. Unless
we want to be able to atomically mark them all as committed, but I don't
think that's really an option because it could mean holding the clog
lock for a long time, possibly involving I/O of clog pages.
>> Right now we lock and unlock the clog for each committed subtransaction
>> at commit time, which is wasteful. A better scheme:
>> pre-scan the list of xids to derive list of pages
>> if we have just a single page to update
>> {
>> update all entries on page in one action
>> }
>> else
>> {
>> loop thru xids marking them all as subcommitted
>> mark top level transaction committed
>> loop thus xids again marking them all as committed
>> }
> Hmm, I don't see anything immediately wrong with that.
Neither do I.
I wonder if the improved clog API required to mark multiple transactions
as committed at once would be also useful to TransactionIdCommitTree
which is used in regular transaction commit.
--
Alvaro Herrera http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.
From | Date | Subject | |
---|---|---|---|
Next Message | Pavel Stehule | 2008-09-16 14:22:51 | Re: proposal - GROUPING SETS |
Previous Message | Tom Lane | 2008-09-16 14:02:46 | Re: proposal - GROUPING SETS |
From | Date | Subject | |
---|---|---|---|
Next Message | Simon Riggs | 2008-09-16 14:38:45 | Re: Subtransaction commits and Hot Standby |
Previous Message | Heikki Linnakangas | 2008-09-16 14:01:24 | Re: Subtransaction commits and Hot Standby |