BUG #13604: fsm NonLeafNodesPerPage Macro - Mailing list pgsql-bugs

From jingwei_5107@qq.com
Subject BUG #13604: fsm NonLeafNodesPerPage Macro
Date
Msg-id 20150902034608.1378.91@wrigleys.postgresql.org
Whole thread Raw
List pgsql-bugs
The following bug has been logged on the website:

Bug reference:      13604
Logged by:          will
Email address:      jingwei_5107@qq.com
PostgreSQL version: 9.4.4
Operating system:   windows
Description:

In fsm_internals.h, it defines:

/*
 * Number of non-leaf and leaf nodes, and nodes in total, on an FSM page.
 * These definitions are internal to fsmpage.c.
 */
#define NodesPerPage (BLCKSZ - MAXALIGN(SizeOfPageHeaderData) - \
                      offsetof(FSMPageData, fp_nodes))

#define NonLeafNodesPerPage (BLCKSZ / 2 - 1)
#define LeafNodesPerPage (NodesPerPage - NonLeafNodesPerPage)


I can understand the NodesPerPage & LeafNodesPerPage, but do not undertand
the second NonLeafNodesPerPage Macro.

Should it be like:
#define NonLeafNodesPerPage (NodesPerPage / 2 - 1)
? Since BLCKSZ contains extra Page hdr&FSMPage hdr, NonLeafNodesPerPage will
be larger than its true value.


I have not much document at hand, more possibility is my misunderstanding of
the code. If so, pls let me know. Thanks!

pgsql-bugs by date:

Previous
From: gavin@fusionbox.com
Date:
Subject: BUG #13603: Foreign Key Constraint is invalid without any error
Next
From: "Vicky Soni - Quipment India"
Date:
Subject: Re: BUG #13601: bit as quoted column in output