MogDB学习笔记系列 – MogDB5.0支持pageinspect和packhack工具
本站文章除注明转载外,均为本站原创: 转载自love wife love life —Roger的Oracle/MySQL/PostgreSQL数据恢复博客
MogDB 5.0.2是MogDB 5.0.0的补丁版本,于2023-09-30发布;其中5.0.2版本中有如下的一些新特性和功能。
- 备机表级并行回放性能提升1倍
- 支持JAVA代码中PL/SQL匿名块绑定变量
- 增加了视图创建时原始语句的查询功能
- 增加导入超过数据库编码字符集范围的数据时报错提示
- 新增pagehack和pageinspect工具
这里我重点测试一下pagehack、pageinspect工具,实际上这2个工具在PostgreSQL中早就支持了。
首先需要到MogDB官网下载工具包(该工具包中还包含了其他工具,稍后文章再进行介绍),然后进行相关部署:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
[root@mogdb1 soft]# tar -xvf Toolkits-5.0.2-CentOS-x86_64.tar.gz toolkits/mog_filedump/ toolkits/mog_filedump/mog_filedump toolkits/mog_xlogdump/ toolkits/mog_xlogdump/mog_xlogdump toolkits/pagehack/ toolkits/pagehack/pagehack toolkits/pagehack/pagehack.so toolkits/pageinspect/ toolkits/pageinspect/pageinspect--1.0.sql toolkits/pageinspect/pageinspect.control toolkits/pageinspect/pageinspect.so toolkits/pageinspect/pageinspect--unpackaged--1.0.sql toolkits/pg_freespacemap/ toolkits/pg_freespacemap/pg_freespacemap.control toolkits/pg_freespacemap/pg_freespacemap--unpackaged--1.0.sql toolkits/pg_freespacemap/pg_freespacemap--1.0.sql toolkits/pg_freespacemap/pg_freespacemap.so toolkits/pg_xlogdump/ toolkits/pg_xlogdump/pg_xlogdump toolkits/plugin_install.sh toolkits/plugin_uninstall.sh [root@mogdb1 soft]# cd toolkits/ [root@mogdb1 toolkits]# cd pagehack/ [root@mogdb1 pagehack]# cp pagehack /opt/mogdb/app/bin/pagehack [root@mogdb1 pagehack]# cp pagehack.so /opt/mogdb/app/lib/postgresql/pagehack.so [root@mogdb1 pagehack]# chown omm:omm /opt/mogdb/app/bin/pagehack [root@mogdb1 pagehack]# chown omm:omm /opt/mogdb/app/lib/postgresql/pagehack.so [root@mogdb1 pagehack]# chmod 775 /opt/mogdb/app/bin/pagehack [root@mogdb1 pagehack]# chmod 775 /opt/mogdb/app/lib/postgresql/pagehack.so [root@mogdb1 pagehack]# cd .. [root@mogdb1 toolkits]# ls mog_filedump mog_xlogdump pagehack pageinspect pg_freespacemap pg_xlogdump plugin_install.sh plugin_uninstall.sh [root@mogdb1 toolkits]# cd pageinspect/ [root@mogdb1 pageinspect]# ls -ltr total 3048 -rw-r--r-- 1 root root 1255 Sep 22 00:47 pageinspect--unpackaged--1.0.sql -rwxr-xr-x 1 root root 3103408 Sep 22 00:47 pageinspect.so -rw-r--r-- 1 root root 173 Sep 22 00:47 pageinspect.control -rw-r--r-- 1 root root 4475 Sep 22 00:47 pageinspect--1.0.sql [root@mogdb1 pageinspect]# cp *.sql /opt/mogdb/app/share/postgresql/ [root@mogdb1 pageinspect]# cp *.sql /opt/mogdb/app/share/postgresql/extension/ [root@mogdb1 pageinspect]# [root@mogdb1 pageinspect]# cp pageinspect.control /opt/mogdb/app/share/postgresql/extension/ [root@mogdb1 pageinspect]# cp pageinspect.so /opt/mogdb/app/lib/postgresql/ [root@mogdb1 pageinspect]# chmod 644 /opt/mogdb/app/share/postgresql/extension/pageinspect* [root@mogdb1 pageinspect]# chmod 755 /opt/mogdb/app/lib/postgresql/pageinspect.so |
工具安装部署完成之后,其中的pageinspect 工具需要登录到数据库中创建extension:
1 2 3 4 5 6 7 8 9 10 |
[root@mogdb1 pageinspect]# su - omm Last login: Wed Oct 25 00:05:34 CST 2023 on pts/1 [omm@mogdb1 ~]$ gsql -d enmo -r gsql ((MogDB 5.0.2 build 245a39c2) compiled at 2023-09-21 16:30:30 commit 0 last mr 1804 ) Non-SSL connection (SSL connection is recommended when requiring high-security) Type "help" for help. enmo=# CREATE EXTENSION pageinspect; CREATE EXTENSION enmo=# |
另外一个pagehack工具不需要,因为其是一个离线分析小工具。这里我在测试环境中创建一个测试表来进行验收工具的基本使用。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
enmo=# create table test1024 (a int,b varchar(20)); CREATE TABLE enmo=# create index idx_test1024 on test1024(a); CREATE INDEX enmo=# SELECT * FROM heap_page_items(get_raw_page('test1024','main',0)); ERROR: block number 0 is out of range for relation "test1024" enmo=# enmo=# insert into test1024 values(1,'enmotech.com'); INSERT 0 1 enmo=# SELECT * FROM heap_page_items(get_raw_page('test1024','main',0)); lp | lp_off | lp_flags | lp_len | t_xmin | t_xmax | t_field3 | t_ctid | t_infomask2 | t_infomask | t_hoff | t_bits | t_oid ----+--------+----------+--------+---------+--------+----------+--------+-------------+------------+--------+--------+------- 1 | 8144 | 1 | 41 | 1841275 | 0 | 0 | (0,1) | 2 | 2050 | 24 | | (1 row) enmo=# enmo=# select ctid,* from test1024; ctid | a | b -------+---+-------------- (0,1) | 1 | enmotech.com (1 row) enmo=# insert into test1024 values(2,'killdb.com'); INSERT 0 1 enmo=# insert into test1024 values(3,'china.com'); INSERT 0 1 enmo=# SELECT * FROM heap_page_items(get_raw_page('test1024','main',0)); lp | lp_off | lp_flags | lp_len | t_xmin | t_xmax | t_field3 | t_ctid | t_infomask2 | t_infomask | t_hoff | t_bits | t_oid ----+--------+----------+--------+---------+--------+----------+--------+-------------+------------+--------+--------+------- 1 | 8144 | 1 | 41 | 1841275 | 0 | 0 | (0,1) | 2 | 2306 | 24 | | 2 | 8104 | 1 | 39 | 1841276 | 0 | 0 | (0,2) | 2 | 2050 | 24 | | 3 | 8064 | 1 | 38 | 1841277 | 0 | 0 | (0,3) | 2 | 2050 | 24 | | (3 rows) enmo=# select ctid,* from test1024; ctid | a | b -------+---+-------------- (0,1) | 1 | enmotech.com (0,2) | 2 | killdb.com (0,3) | 3 | china.com (3 rows) enmo=# enmo=# SELECT * FROM bt_metap('idx_test1024'); magic | version | root | level | fastroot | fastlevel --------+---------+------+-------+----------+----------- 340322 | 2 | 1 | 0 | 1 | 0 (1 row) enmo=# SELECT * FROM bt_page_items('idx_test1024', 1); itemoffset | ctid | itemlen | nulls | vars | data ------------+-------+---------+-------+------+------------------------- 1 | (0,1) | 16 | f | f | 01 00 00 00 00 00 00 00 2 | (0,2) | 16 | f | f | 02 00 00 00 00 00 00 00 3 | (0,3) | 16 | f | f | 03 00 00 00 00 00 00 00 (3 rows) |
上述例子中我创建了一个测试表test1024以及index。通过简单的数据插入,我们可以发现MogDB的数据是从page的后端当前写入的(通过lp_off即可判断).
使用pagehack之前,我们需要获得表或索引所在文件的filepath:
1 2 3 4 5 6 7 8 9 10 11 |
enmo=# select pg_relation_filepath('test1024'); pg_relation_filepath ---------------------- base/215125/236599 (1 row) enmo=# select pg_relation_filepath('idx_test1024'); pg_relation_filepath ---------------------- base/215125/236602 (1 row) |
我们使用pagehack来分别看一下上述表和索引的情况:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 |
[omm@mogdb1 ~]$ pagehack -f /opt/mogdb/data/base/215125/236599 | more page information of block 0/1 pd_lsn: 28/305E8D70 pd_checksum: 0xDFF2, verify success pd_flags: pd_lower: 52, non-empty pd_upper: 8064, old pd_special: 8192, size 0 Page size & version: 8192, 6 pd_xid_base: 1841272, pd_multi_base: 0 pd_prune_xid: 1841272 Heap tuple information on this page Tuple #1 is normal: length 41, offset 8144 t_xmin/t_xmax/t_cid: 1841275/0/0 ctid:(block 0/0, offset 1) t_infomask: HEAP_HASVARWIDTH HEAP_XMIN_COMMITTED HEAP_XMAX_INVALID HEAP_HAS_NO_UID t_infomask2: Attrs Num: 2 t_hoff: 24 t_bits: NNNNNNNN Tuple #2 is normal: length 39, offset 8104 t_xmin/t_xmax/t_cid: 1841276/0/0 ctid:(block 0/0, offset 2) t_infomask: HEAP_HASVARWIDTH HEAP_XMIN_COMMITTED HEAP_XMAX_INVALID HEAP_HAS_NO_UID t_infomask2: Attrs Num: 2 t_hoff: 24 t_bits: NNNNNNNN Tuple #3 is normal: length 38, offset 8064 t_xmin/t_xmax/t_cid: 1841277/0/0 ctid:(block 0/0, offset 3) t_infomask: HEAP_HASVARWIDTH HEAP_XMIN_COMMITTED HEAP_XMAX_INVALID HEAP_HAS_NO_UID t_infomask2: Attrs Num: 2 t_hoff: 24 t_bits: NNNNNNNN Summary (3 total): 0 unused, 3 normal, 0 dead Normal Heap Page, special space is 0 Relation information : pageCount 1. RP information : rpCount 3, rpMax 3, rpAvg 3.000000. TD information : tdCount 0, tdMax 0, tdAvg 0.000000. Freespace information : freeTotal 8012, freeMax 8012, freeAvg 8012.000000. [omm@mogdb1 ~]$ [omm@mogdb1 ~]$ pagehack -f /opt/mogdb/data/base/215125/236602 page information of block 0/2 pd_lsn: 28/305E8200 pd_checksum: 0x805A, verify success pd_flags: pd_lower: 48, non-empty pd_upper: 8168, old pd_special: 8168, size 24 Page size & version: 8192, 5 pd_xid_base: 8590274914, pd_multi_base: 1 pd_prune_xid: 8590274914 Heap tuple information on this page Tuple #1 is redirected: length 2, offset 12642 Tuple #2 is unused Tuple #3 is unused Tuple #4 is unused Tuple #5 is unused Tuple #6 is unused Summary (6 total): 5 unused, 0 normal, 0 dead Normal Heap Page, special space is 0 page information of block 1/2 pd_lsn: 28/305E8DC8 pd_checksum: 0x7579, verify success pd_flags: pd_lower: 36, non-empty pd_upper: 8120, old pd_special: 8168, size 24 Page size & version: 8192, 5 pd_xid_base: 9182880599154648, pd_multi_base: 2138040 pd_prune_xid: 9182880599154648 Heap tuple information on this page Tuple #1 is normal: length 16, offset 8152 t_xmin/t_xmax/t_cid: 0/9182880600203225/1 ctid:(block 0/0, offset 0) t_infomask: HEAP_HAS_NO_UID t_infomask2: Attrs Num: 0 t_hoff: 0 t_bits: Tuple #2 is normal: length 16, offset 8136 t_xmin/t_xmax/t_cid: 0/9182880600203226/2 ctid:(block 0/0, offset 0) t_infomask: HEAP_HASNULL HEAP_HAS_NO_UID t_infomask2: Attrs Num: 0 t_hoff: 16 t_bits: Tuple #3 is normal: length 16, offset 8120 t_xmin/t_xmax/t_cid: 0/9182880600203227/3 ctid:(block 0/0, offset 0) t_infomask: HEAP_HASVARWIDTH HEAP_HAS_NO_UID t_infomask2: Attrs Num: 0 t_hoff: 16 t_bits: Summary (3 total): 0 unused, 3 normal, 0 dead Normal Heap Page, special space is 0 Relation information : pageCount 2. RP information : rpCount 9, rpMax 6, rpAvg 4.500000. TD information : tdCount 0, tdMax 0, tdAvg 0.000000. Freespace information : freeTotal 16204, freeMax 8120, freeAvg 8102.000000. [omm@mogdb1 ~]$ |
从上述输出结果来看,还是非常清晰的。写到这里,我在想MogDB 对于表数据的update和delete是如何进行的呢?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
enmo=# update test1024 set b='mogdb.io' where a=3; UPDATE 1 enmo=# SELECT * FROM heap_page_items(get_raw_page('test1024','main',0)); lp | lp_off | lp_flags | lp_len | t_xmin | t_xmax | t_field3 | t_ctid | t_infomask2 | t_infomask | t_hoff | t_bits | t_oid ----+--------+----------+--------+---------+---------+----------+--------+-------------+------------+--------+--------+------- 1 | 8144 | 1 | 41 | 1841275 | 0 | 0 | (0,1) | 2 | 2306 | 24 | | 2 | 8104 | 1 | 39 | 1841276 | 0 | 0 | (0,2) | 2 | 2306 | 24 | | 3 | 8064 | 1 | 38 | 1841277 | 1841283 | 0 | (0,4) | 16386 | 258 | 24 | | 4 | 8024 | 1 | 37 | 1841283 | 0 | 0 | (0,4) | 32770 | 10242 | 24 | | (4 rows) enmo=# show full_page_writes; full_page_writes ------------------ off (1 row) enmo=# SELECT * FROM bt_page_items('idx_test1024', 1); itemoffset | ctid | itemlen | nulls | vars | data ------------+-------+---------+-------+------+------------------------- 1 | (0,1) | 16 | f | f | 01 00 00 00 00 00 00 00 2 | (0,2) | 16 | f | f | 02 00 00 00 00 00 00 00 3 | (0,3) | 16 | f | f | 03 00 00 00 00 00 00 00 (3 rows) enmo=# delete from test1024 where a=3; DELETE 1 enmo=# SELECT * FROM heap_page_items(get_raw_page('test1024','main',0)); lp | lp_off | lp_flags | lp_len | t_xmin | t_xmax | t_field3 | t_ctid | t_infomask2 | t_infomask | t_hoff | t_bits | t_oid ----+--------+----------+--------+---------+---------+----------+--------+-------------+------------+--------+--------+------- 1 | 8144 | 1 | 41 | 1841275 | 0 | 0 | (0,1) | 2 | 2306 | 24 | | 2 | 8104 | 1 | 39 | 1841276 | 0 | 0 | (0,2) | 2 | 2306 | 24 | | 3 | 8064 | 1 | 38 | 1841277 | 1841283 | 0 | (0,4) | 16386 | 1282 | 24 | | 4 | 8024 | 1 | 37 | 1841283 | 1841284 | 0 | (0,4) | 36866 | 8450 | 24 | | (4 rows) enmo=# select ctid,* from test1024; ctid | a | b -------+---+-------------- (0,1) | 1 | enmotech.com (0,2) | 2 | killdb.com (2 rows) enmo=# SELECT * FROM page_header(get_raw_page('test1024','main',0)); lsn | tli | flags | lower | upper | special | pagesize | version | prune_xid -------------+-----+-------+-------+-------+---------+----------+---------+----------- 28/30C2D3E0 | 0 | 0 | 56 | 8024 | 8192 | 8192 | 6 | 1841283 (1 row) enmo=# vacuum test1024; VACUUM enmo=# SELECT * FROM heap_page_items(get_raw_page('test1024','main',0)); lp | lp_off | lp_flags | lp_len | t_xmin | t_xmax | t_field3 | t_ctid | t_infomask2 | t_infomask | t_hoff | t_bits | t_oid ----+--------+----------+--------+---------+---------+----------+--------+-------------+------------+--------+--------+------- 1 | 8144 | 1 | 41 | 1841275 | 0 | 0 | (0,1) | 2 | 2306 | 24 | | 2 | 8104 | 1 | 39 | 1841276 | 0 | 0 | (0,2) | 2 | 2306 | 24 | | 3 | 4 | 2 | 0 | | | | | | | | | 4 | 8064 | 1 | 37 | 1841283 | 1841284 | 0 | (0,4) | 36866 | 9474 | 24 | | (4 rows) enmo=# SELECT * FROM page_header(get_raw_page('test1024','main',0)); lsn | tli | flags | lower | upper | special | pagesize | version | prune_xid -------------+-----+-------+-------+-------+---------+----------+---------+----------- 28/30C2D860 | 0 | 0 | 56 | 8064 | 8192 | 8192 | 6 | 1841284 (1 row) enmo=# |
我们可以看到对于update操作,实际是跟oracle类似,也是新插入一行,而修改了原行记录标记。如果是delete则是直接打标记。
然后可以vacuum操作之后,我们可以看到相关信息就发生了变化,不分空间被回收了。
上述测试表是基于默认的astore存储引擎,实际上以后主流都是ustore,虽然目前还不算太稳定,ustore的mvcc机制类似oracle了。这样我创建ustore的表然后再用工具来看看有没有什么差别呢?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 |
enmo=# create table test1024_1(a int,b varchar(20)); CREATE TABLE enmo=# create index idx_test1024_1 on test1024_1(a); CREATE INDEX enmo=# insert into test1024_1 values(1,'enmotech.com'); INSERT 0 1 enmo=# insert into test1024_1 values(2,'killdb.com'); INSERT 0 1 enmo=# \d + test1024_1 ERROR: invalid regular expression: quantifier operand invalid enmo=# enmo=# enmo=# \d+ test1024_1 Table "public.test1024_1" Column | Type | Modifiers | Storage | Stats target | Description --------+-----------------------+-----------+----------+--------------+------------- a | integer | | plain | | b | character varying(20) | | extended | | Indexes: "idx_test1024_1" ubtree (a) WITH (storage_type=USTORE) TABLESPACE pg_default Has OIDs: no Options: orientation=row, compression=no, storage_type=USTORE enmo=# select pg_relation_filepath('test1024_1'); pg_relation_filepath ---------------------- base/215125/236695 (1 row) enmo=# select pg_relation_filepath('idx_test1024_1'); pg_relation_filepath ---------------------- base/215125/236698 (1 row) enmo=# \q [omm@mogdb1 ~]$ pagehack -f /opt/mogdb/data/base/215125/236695 | more page information of block 0/1 pd_lsn: 28/35942328 pd_checksum: 0x9E76, verify success pd_flags: pd_lower: 128, non-empty pd_upper: 8138, old pd_special: 8192, size 0 Page size & version: 8192, 7 pd_xid_base: 0, pd_multi_base: 1845439 pd_prune_xid: 270162 Heap tuple information on this page Tuple #1 is unused Tuple #2 is unused Tuple #3 is unused Tuple #4 is unused Tuple #5 is unused Tuple #6 is unused Tuple #7 is unused Tuple #8 is unused Tuple #9 is unused Tuple #10 is unused Tuple #11 is unused Tuple #12 is unused Tuple #13 is unused Tuple #14 is unused Tuple #15 is unused Tuple #16 is unused Tuple #17 is unused Tuple #18 is unused Tuple #19 is unused Tuple #20 is unused Tuple #21 is unused Tuple #22 is unused Tuple #23 is unused Tuple #24 is unused Tuple #25 is normal: length 28, offset 8164 t_xmin/t_xmax/t_cid: 3/2147614721/17498114 ctid:(block 0/6912, offset 28261) t_infomask: HEAP_HASEXTERNAL HEAP_COMPRESSED HEAP_COMBOCID HEAP_XMAX_EXCL_LOCK HEAP_XMIN_COMMITTED HEAP_XMAX_COMMITTED HEAP_UPDATED HEAP_HAS_8BYTE_UID t_infomask2: HEAP_HOT_UPDATED Attrs Num: 1901 t_hoff: 99 t_bits: NNNVNVVN NVVVNVNN VVNNNVVN VVVVNVVN VNVVNVVN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN VVNNVVNV NVNVVNVV VVVNVNVV VNNVVVNV VNNNNNNN VVNVVNNV NNVNVNVN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NVVNVNNN VNVNVNNN VVNVNNVV VNNVVNVN NNVVVVVV VVVVVVVN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNVVNV NVVNVVVV NVNVNNVV VNNVVNVN NNVVVVVV VVVVVVVN NNNNNNNN NNNNNNNN VVVNNNVN NNVVNNVN NNVNVVNN NVVVVVVN VNVNNVVV VNVNVNVN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NVVNVNNN VNVNVNNN VVNVNNVV VNNVVNVN NNVVVVVV VVVVVVVN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN Tuple #26 is normal: length 26, offset 8138 t_xmin/t_xmax/t_cid: 4/2147614722/34275330 ctid:(block 0/5888, offset 26987) t_infomask: HEAP_HASEXTERNAL HEAP_COMBOCID HEAP_XMAX_EXCL_LOCK HEAP_XMIN_INVALID HEAP_UPDATED HEAP_HAS_8BYTE_UID t_infomask2: HEAP_HOT_UPDATED Attrs Num: 1132 t_hoff: 46 t_bits: VVNNNVVN VVVVNVVN VNVVNVVN VVNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN VNNNNNNN NNNNNNNN NVNNNNNN NNNNNNNV NVNNNNNN NNNNNNNN VVNVNNNN VNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN VVNVVNNN VNVNNVVN NVVVNVVN VNVVNVVN VVVVNVVN NNVNVVVN VNVNNVVN VVNNNVVN NNNVNVVN NVVVNVNN VVNNNVVN VVVVNVVN VNVVNVVN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN VVNNVVNV NVNVVNVV VVVNVNVV VNNVVVNV VNNNNNNN VVNVVNNV NNVNVNVN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NVVNVNNN VNVNVNNN VVNVNNVV VNNVVNVN NNVVVVVV VVVVVVVN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNVVNV NVVNVVVV NVNVNNVV VNNVVNVN NNVVVVVV VVVVVVVN NNNNNNNN NNNNNNNN VVVNNNVN NNVVNNVN NNVNVVNN NVVVVVVN VNVNNVVV VNVNVNVN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN NVVNVNNN VNVNVNNN VVNVNNVV VNNVVNVN NNVVVVVV VVVVVVVN NNNNNNNN Summary (26 total): 24 unused, 2 normal, 0 dead Normal Heap Page, special space is 0 Relation information : pageCount 1. RP information : rpCount 26, rpMax 26, rpAvg 26.000000. TD information : tdCount 0, tdMax 0, tdAvg 0.000000. Freespace information : freeTotal 8010, freeMax 8010, freeAvg 8010.000000. [omm@mogdb1 ~]$ [omm@mogdb1 ~]$ pagehack -f /opt/mogdb/data/base/215125/236698 page information of block 0/2 pd_lsn: 28/35942158 pd_checksum: 0x4791, verify success pd_flags: pd_lower: 48, non-empty pd_upper: 8144, old pd_special: 8144, size 48 Page size & version: 8192, 5 pd_xid_base: 8590274914, pd_multi_base: 1 pd_prune_xid: 8590274914 Heap tuple information on this page Tuple #1 is redirected: length 2, offset 12642 Tuple #2 is unused Tuple #3 is unused Tuple #4 is unused Tuple #5 is unused Tuple #6 is unused Summary (6 total): 5 unused, 0 normal, 0 dead Normal Heap Page, special space is 0 page information of block 1/2 pd_lsn: 28/35942388 pd_checksum: 0x2FAB, verify success pd_flags: pd_lower: 32, non-empty pd_upper: 8096, old pd_special: 8144, size 48 Page size & version: 8192, 5 pd_xid_base: 13686308428881848, pd_multi_base: 0 pd_prune_xid: 13686308428881848 Heap tuple information on this page Tuple #1 is normal: length 24, offset 8120 t_xmin/t_xmax/t_cid: 0/13686308429930425/1 ctid:(block 0/0, offset 10434) t_infomask: HEAP_HAS_NO_UID t_infomask2: Attrs Num: 28 t_hoff: 0 t_bits: NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN Tuple #2 is normal: length 24, offset 8096 t_xmin/t_xmax/t_cid: 0/13686308429930426/2 ctid:(block 0/0, offset 10435) t_infomask: HEAP_HAS_NO_UID t_infomask2: Attrs Num: 28 t_hoff: 0 t_bits: NNNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN Summary (2 total): 0 unused, 2 normal, 0 dead Normal Heap Page, special space is 0 Relation information : pageCount 2. RP information : rpCount 8, rpMax 6, rpAvg 4.000000. TD information : tdCount 0, tdMax 0, tdAvg 0.000000. Freespace information : freeTotal 16160, freeMax 8096, freeAvg 8080.000000. |
通过对比我们可以看到其实还有一些差别的。
最后有人可能会用,这2个小工具有什么作用呢?实际上对于一些page损坏的情况下,上述工具就可以派上用场了;另外就是通过工具可以来深入了解一些结构和机制。
Leave a Reply
You must be logged in to post a comment.