Re: Hard limit on WAL space used (because PANIC sucks) - Mailing list pgsql-hackers

From Heikki Linnakangas
Subject Re: Hard limit on WAL space used (because PANIC sucks)
Date
Msg-id 51B20889.7080603@vmware.com
Whole thread Raw
In response to Hard limit on WAL space used (because PANIC sucks)  (Heikki Linnakangas <hlinnakangas@vmware.com>)
Responses Re: Hard limit on WAL space used (because PANIC sucks)  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
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.

That leaves a few miscellaneous XLogInsert calls that need to be 
guarded, but it leaves a lot less room for bugs of omission, and keeps 
the code cleaner.

- Heikki



pgsql-hackers by date:

Previous
From: Stephen Frost
Date:
Subject: Re: create a git symbolic-ref for REL9_3_STABLE
Next
From: Andres Freund
Date:
Subject: Re: extensible external toast tuple support & snappy prototype