Re: WAL replay bugs

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Heikki Linnakangas <hlinnakangas(at)vmware(dot)com>
Cc: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: WAL replay bugs
Date: 2014-04-17 17:33:37
Message-ID: 18450.1397756017@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Heikki Linnakangas <hlinnakangas(at)vmware(dot)com> writes:
> Two things that are not bugs, but I'd like to change just to make this
> tool easier to maintain, and to generally clean things up:

> 1. When creating a sequence, we first use simple_heap_insert() to insert
> the sequence tuple, which creates a WAL record. Then we write a new
> sequence RM WAL record about the same thing. The reason is that the WAL
> record written by regular heap_insert is bogus for a sequence tuple.
> After replaying just the heap insertion, but not the other record, the
> page doesn't have the magic value indicating that it's a sequence, i.e.
> it's broken as a sequence page. That's OK because we only do this when
> creating a new sequence, so if we crash between those two records, the
> whole relation is not visible to anyone. Nevertheless, I'd like to fix
> that by using PageAddItem directly to insert the tuple, instead of
> simple_heap_insert. We have to override the xmin field of the tuple
> anyway, and we don't need any of the other services like finding the
> insert location, toasting, visibility map or freespace map updates, that
> simple_heap_insert() provides.

> 2. _bt_restore_page, when restoring a B-tree page split record. It adds
> tuples to the page in reverse order compared to how it's done in master.
> There is a comment noting that, and it asks "Is it worth changing just
> on general principles?". Yes, I think it is.

> Any objections to changing those two?

Not here. I've always suspected #2 was going to bite us someday anyway.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Geoghegan 2014-04-17 17:54:43 Re: Clock sweep not caching enough B-Tree leaf pages?
Previous Message Heikki Linnakangas 2014-04-17 16:59:03 Re: WAL replay bugs