Re: max_prepared_transactions default ... why 5?

From: Heikki Linnakangas <heikki(at)enterprisedb(dot)com>
To: Kevin Grittner <Kevin(dot)Grittner(at)wicourts(dot)gov>
Cc: "Decibel!" <decibel(at)decibel(dot)org>, Gregory Stark <stark(at)enterprisedb(dot)com>, Josh Berkus <josh(at)agliodbs(dot)com>, Bruce Momjian <bruce(at)momjian(dot)us>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: max_prepared_transactions default ... why 5?
Date: 2007-10-18 17:45:02
Message-ID: 47179B9E.6080102@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Kevin Grittner wrote:
>>>> On Thu, Oct 18, 2007 at 11:23 AM, in message
> <87ejfswfvw(dot)fsf(at)oxford(dot)xeocode(dot)com>, Gregory Stark <stark(at)enterprisedb(dot)com>
> wrote:
>
>> If it's set to 0
>> then there's no real reason we need to wal log lock operations.
>
> Do we currently take advantage of that fact, or log them anyway?

No, we log them anyway.

There's a few other reasons to WAL log lock operations, see comments in
heap_lock_tuple:

> /*
> * XLOG stuff. You might think that we don't need an XLOG record because
> * there is no state change worth restoring after a crash. You would be
> * wrong however: we have just written either a TransactionId or a
> * MultiXactId that may never have been seen on disk before, and we need
> * to make sure that there are XLOG entries covering those ID numbers.
> * Else the same IDs might be re-used after a crash, which would be
> * disastrous if this page made it to disk before the crash. Essentially
> * we have to enforce the WAL log-before-data rule even in this case.
> * (Also, in a PITR log-shipping or 2PC environment, we have to have XLOG
> * entries for everything anyway.)
> */

There's also the risk of torn pages. We set the xmax and the XMAX_*_LOCK
flag in heap_lock_tuple, and it's possible that only one of those
changes is written to disk before crash.

--
Heikki Linnakangas
EnterpriseDB http://www.enterprisedb.com

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Merlin Moncure 2007-10-18 18:49:21 Re: Proposal: generate_iterator functions
Previous Message Jan de Visser 2007-10-18 17:17:39 Re: Can a C function(server program) be a UDP or TCP server?