Re: WALInsertLock tuning

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: WALInsertLock tuning
Дата
Msg-id 14556.1307462257@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: WALInsertLock tuning  (Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>)
Ответы Re: WALInsertLock tuning  (Simon Riggs <simon@2ndQuadrant.com>)
Список pgsql-hackers
Heikki Linnakangas <heikki.linnakangas@enterprisedb.com> writes:
> On 07.06.2011 10:55, Simon Riggs wrote:
>> How would that help?

> It doesn't matter whether the pages are zeroed while they sit in memory. 
> And if you write a full page of WAL data, any wasted bytes at the end of 
> the page don't matter, because they're ignored at replay anyway. The 
> possibility of mistaking random garbage for valid WAL only occurs when 
> we write a partial WAL page to disk. So, it is enough to zero the 
> remainder of the partial WAL page (or just the next few words) when we 
> write it out.

> That's a lot cheaper than fully zeroing every page. (except for the fact 
> that you'd need to hold WALInsertLock while you do it)

I think avoiding the need to hold both locks at once is probably exactly
why the zeroing was done where it is.

An interesting alternative is to have XLogInsert itself just plop down a
few more zeroes immediately after the record it's inserted, before it
releases WALInsertLock.  This will be redundant work once the next
record gets added, but it's cheap enough to not matter IMO.  As was
mentioned upthread, zeroing out the bytes that will eventually hold the
next record's xl_prev field ought to be enough to maintain a guarantee
that we won't believe the next record is valid.
        regards, tom lane


В списке pgsql-hackers по дате отправления:

Предыдущее
От: "Joshua D. Drake"
Дата:
Сообщение: Re: reducing the overhead of frequent table locks - now, with WIP patch
Следующее
От: Simon Riggs
Дата:
Сообщение: Re: WALInsertLock tuning