Re: WAL logging problem in 9.4.3? - Mailing list pgsql-hackers

From Tom Lane
Subject Re: WAL logging problem in 9.4.3?
Date
Msg-id 15205.1435953917@sss.pgh.pa.us
Whole thread Raw
In response to Re: WAL logging problem in 9.4.3?  (Martijn van Oosterhout <kleptog@svana.org>)
List pgsql-hackers
Martijn van Oosterhout <kleptog@svana.org> writes:
> With inserts the WAL records look as follows (relfilenodes changed):
> ...
> And amazingly, the database cluster successfuly recovers and there's no
> error now.  So the problem is *only* because there is no data in the
> table at commit time.  Which indicates that it's the 'newroot" record
> that saves the day normally.  And it's apparently generated by the
> first insert.

Yeah, because the correct "empty" state of a btree index is to have a
metapage but no root page, so the first insert forces creation of a root
page.  And, by chance, btree_xlog_newroot restores the metapage from
scratch, so this works even if the metapage had been missing or corrupt.

However, things would still break if the first access to the index was
a read attempt rather than an insert.
        regards, tom lane



pgsql-hackers by date:

Previous
From: Martijn van Oosterhout
Date:
Subject: Re: WAL logging problem in 9.4.3?
Next
From: Heikki Linnakangas
Date:
Subject: Re: Asynchronous execution on FDW