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



--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to