Re: Hard limit on WAL space used (because PANIC sucks)

From: Heikki Linnakangas <hlinnakangas(at)vmware(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Peter Geoghegan <pg(at)heroku(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>
Subject: Re: Hard limit on WAL space used (because PANIC sucks)
Date: 2013-06-07 16:43:05
Message-ID: 51B20D99.5010000@vmware.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 07.06.2013 19:33, Tom Lane wrote:
> Heikki Linnakangas<hlinnakangas(at)vmware(dot)com> writes:
>> On 06.06.2013 17:00, Heikki Linnakangas wrote:
>>> A more workable idea is to sprinkle checks in higher-level code, before
>>> you hold any critical locks, to check that there is enough preallocated
>>> WAL. Like, at the beginning of heap_insert, heap_update, etc., and all
>>> similar indexam entry points.
>
>> Actually, there's one place that catches most of these: LockBuffer(...,
>> BUFFER_LOCK_EXCLUSIVE). In all heap and index operations, you always
>> grab an exclusive lock on a page first, before entering the critical
>> section where you call XLogInsert.
>
> Not only is that a horrible layering/modularity violation, but surely
> LockBuffer can have no idea how much WAL space will be needed.

It can be just a conservative guess, like, 32KB. That should be enough
for almost all WAL-logged operations. The only exception that comes to
mind is a commit record, which can be arbitrarily large, when you have a
lot of subtransactions or dropped/created relations.

- Heikki

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Stephen Frost 2013-06-07 16:44:12 Re: ALTER DEFAULT PRIVILEGES FOR ROLE is broken
Previous Message Robert Haas 2013-06-07 16:42:12 Re: Cost limited statements RFC