Re: WAL format and API changes (9.5) - Mailing list pgsql-hackers

From Heikki Linnakangas
Subject Re: WAL format and API changes (9.5)
Date
Msg-id 5469D7C9.2050402@vmware.com
Whole thread Raw
In response to Re: WAL format and API changes (9.5)  (Michael Paquier <michael.paquier@gmail.com>)
List 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




pgsql-hackers by date:

Previous
From: Ashutosh Bapat
Date:
Subject: Re: postgres_fdw behaves oddly
Next
From: Simon Riggs
Date:
Subject: Re: Review of Refactoring code for sync node detection