1. pg_offset(页偏移) ,pg_chunk(chunk号)
两者组成构成页的物理地址,如上是:0x0002 00000023
因此理论上最大的chunk数可达到16^4= 65536,实际上保留限制在32766;
每chunk最大使用页数(2KB页)为16^8= 4,294,967,296(4 billion),实际为2 billion,故2KB页的最大chunk为4TB;
注:chunk的开始序号是1,pg_offset的开始序号是0,故一般称为page N,而不说第N页(第0页,因为这样的称呼比较怪异)
2.pg_cksum(时间戳校验)
时间戳校验码,如上是 0x814a
3.pg_nslots(最大slot数)
如上表示使用了0x0005,转换成10进制是5个最大slot。
注:页最大slot数限制为255
4.pg_flags(页属性标识)
如上是 0x0802,为PARTN,表明是表分区。
以下是flags的各值含义,可以是多值组合(OR 结合?)的。
0x0001 Data page
0x0002 Partition page
0x0004 Free-list (bitmap) page
0x0008 Chunk free-list page
0x0009 Remainder page
0x000b Partition-resident blobpage
0x000c Blobspace-resident blobpage
0x000d Blob chunk free-list bitmap page
0x000e Blob chunk blob map page
0x0010 B-tree node page
0x0020 B-tree root node
0x0040 B-tree twig node
0x0080 B-tree leaf node
0x0100 Logical log page
0x0200 Last page of logical log
0x0400 Sync page of logical log
0x0800 Physical log page
0x1000 Root reserved page
Flag values used only in shared memory:
0x2000 No physical logging required
0x4000 Page altered in-place
0x8000 B-tree leaf with deleted entries
5.pg_frptr(页使用指针) 和 pg_frcnt(空闲字节数)
pg_frptr指示页中所有data的最后位置,如上是 0x00b4,即10进制的180
pg_frcnt指示页中空闲的字节数,如上是0x0734,即10进制的1844
6.pg_next(下一节点) 和 pg_prev(上一节点)
pg_next指向的地址是同层索引的下一节点(一般为高地址),
pg_prev指向的地址是同层索引的上一节点(一般为低地址)
这里不是索引页,故两都均为0x0
显示页信息
使用 oncheck -pP chunk_number page_offset
oncheck -pp partition_number logical_page_number
注:使用onlog显示逻辑日志页的信息,而不使用oncheck,因为逻辑日志页不包含slot结构
仍然以0x0002 00000023页这个来说明,在pP的输出中的各信息与od -x中输出的信息对应,stamp对应的最后4字节为0x00038168,即10进制的229736
shell> oncheck -pP 0x2 0x23
addr stamp chksum nslots flag type frptr frcnt next prev
2:35 229736 814a 5 802 PARTN 180 1844 0 0
slot ptr len flg
1 24 104 0
2 128 36 0
3 164 0 0
4 164 0 0
5 164 16 0
slot 1:
*
获取 partition_number的方法:
未分片表通过systables 或者sysmaster:systabnames表中查询partnum (10进制)或者hex(partnum) (16进制),分片表通过systables和sysfragments联合查询各分片的partn或者hex(partn)
直接使用oncheck -pt database_name:table_name ,通过输出获取10进制的Partition partnum
以下是partnum为2097184的表的page 0信息,这是一个表可用列表位图页(free-list bitmap page)
shell> oncheck -pp 2097184 0
addr stamp chksum nslots flag type frptr frcnt next prev
2:1347 213886 463c 0 804 FREE 24 2020 0 0
0:8 4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
oncheck -pp还有别的参数选项 oncheck -pp database_name:table_name rowid,其中rowid应该是大于0x100的。该选项实际显示的是rowid所在的页
示例:shell> oncheck -pp demodb:orders 0x101
addr stamp chksum nslots flag type frptr frcnt next prev
2:1348 213956 4681 23 801 DATA 1864 88 0 0
slot ptr len flg
*
slot 1:
*
页头数据格式
addr stamp chksum nslots flag type frptr frcnt next prev
DEC:DEC DEC DEC DEC HEX CHAR DEC DEC HEX HEX
以下是type中出现的类型
DATA Tblspace data page
PARTN Partition (tblspace tblspace) page
FREE Tblspace bitmap page
CHUNK Chunk free list page
REMAIN Remainder page
PBLOB Partition-resident BLOBpage
BLOB BLOBspace-resident BLOB page
BBIT BLOB chunk free-list page
BMAP Blob chunk BLOB map page
BTREE Index page
ROOTRSV Root reserved page
UNKNOWN The default type, whichincludes logical log pages
槽表(slot table)格式
addr stamp chksum nslots flag type frptr frcnt next prev
2:35 229736 814a 5 802 PARTN 180 1844 0 0
slot ptr len flg
1 24 104 0
2 128 36 0
3 164 0 0
4 164 0 0
5 164 16 0
slot: 槽表编号(该信息不存在于槽表中)
ptr: 该槽表的位置偏移
len: 该槽表的长度
flg: 标识,若该槽表包含前向指针,值为2,反之为0
SLOT格式:
页信息示例:使用od -x 显示完整的0x0002 000023页
shell> dd if=UDBS bs=2k coun=1 skip=35 | od –x
注:第一列为转换的hex地址,od并不输出该列