Re: WAL replay bugs - Mailing list pgsql-hackers

From Tom Lane
Subject Re: WAL replay bugs
Date
Msg-id 18450.1397756017@sss.pgh.pa.us
Whole thread Raw
In response to Re: WAL replay bugs  (Heikki Linnakangas <hlinnakangas@vmware.com>)
Responses Re: WAL replay bugs
List pgsql-hackers
Heikki Linnakangas <hlinnakangas@vmware.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



pgsql-hackers by date:

Previous
From: Greg Stark
Date:
Subject: Re: Clock sweep not caching enough B-Tree leaf pages?
Next
From: Peter Geoghegan
Date:
Subject: Re: Clock sweep not caching enough B-Tree leaf pages?