Skip site navigation (1) Skip section navigation (2)

Re: New XLOG record indicating WAL-skipping

From: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
To: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Greg Stark <gsstark(at)mit(dot)edu>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: New XLOG record indicating WAL-skipping
Date: 2010-01-15 11:28:05
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackers
Fujii Masao wrote:
> On Wed, Dec 9, 2009 at 6:25 PM, Fujii Masao <masao(dot)fujii(at)gmail(dot)com> wrote:
>> Here is the patch:
>> - Write an XLOG UNLOGGED record in WAL if WAL-logging is skipped for only
>>  the reason that WAL archiving is not enabled and such record has not been
>>  written yet.
>> - Cause archive recovery to end if an XLOG UNLOGGED record is found during
>>  it.
> Here's an updated version of my "New XLOG record indicating WAL-skipping" patch.


I don't like special-casing UNLOGGED records in XLogInsert and
ReadRecord(). Those functions are complicated enough already. The
special handling from XLogInsert() (and a few other places) is only
required because the UNLOGGED records carry no payload. That's easy to
avoid, just add some payload to them, doesn't matter what it is. And I
don't think ReadRecord() is the right place to emit the errors/warnings,
that belongs naturally in xlog_redo().

It might be useful to add some information in the records telling why
WAL-logging was skipped. It might turn out to be useful in debugging.
That also conveniently adds payload to the records, to avoid the
special-casing in XLogInsert() :-).

I think it's a premature optimization to skip writing the records if
we've written in the same session already. Especially with the 'reason'
information added to the records, it's nice to have a record of each
such operation. All operations that skip WAL-logging are heavy enough
that an additional WAL record will make no difference. I can see that it
was required to avoid the flooding from heap_insert(), but we can move
the XLogSkipLogging() call from heap_insert() to heap_sync().

Attached is an updated patch, doing the above. Am I missing anything?

  Heikki Linnakangas

Attachment: log_unlogged_op_0115.patch
Description: text/x-diff (19.8 KB)

In response to


pgsql-hackers by date

Next:From: Leonardo FDate: 2010-01-15 11:45:24
Subject: About "Our CLUSTER implementation is pessimal" patch
Previous:From: Boszormenyi ZoltanDate: 2010-01-15 11:09:45
Subject: Re: Streaming replication, loose ends

Privacy Policy | About PostgreSQL
Copyright © 1996-2018 The PostgreSQL Global Development Group