Re: WAL format and API changes (9.5)

From: Heikki Linnakangas <hlinnakangas(at)vmware(dot)com>
To: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
Cc: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, Andres Freund <andres(at)2ndquadrant(dot)com>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: WAL format and API changes (9.5)
Date: 2014-11-17 11:11:05
Message-ID: 5469D7C9.2050402@vmware.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 11/14/2014 10:31 AM, Michael Paquier wrote:
> 5) Here why not using the 2nd block instead of the 3rd (@_bt_getroot)?
> + XLogBeginInsert();
> + XLogRegisterBuffer(0, rootbuf, REGBUF_WILL_INIT);
> + XLogRegisterBuffer(2, metabuf, REGBUF_WILL_INIT);

See the comment of the xl_btree_newroot struct. It explains the record
format of the BTREE_NEWROOT record type:

> * Backup Blk 0: new root page (2 tuples as payload, if splitting old root)
> * Backup Blk 1: left child (if splitting an old root)
> * Backup Blk 2: metapage

When _bt_getroot creates a new root, there is no old root, but the same
record type is used in _bt_newroot, which uses block ID 1 to refer to
the old root page.

(Thanks for the comments, again! I'll post a new version soon)

- Heikki

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Simon Riggs 2014-11-17 13:00:30 Re: Review of Refactoring code for sync node detection
Previous Message Ashutosh Bapat 2014-11-17 10:54:56 Re: postgres_fdw behaves oddly