摘要
关键词
大对象、大对象的插入
插入数据过程中内存上下文、虚拟文件描述符VFD、高速缓存和缓存池管理BufferDesc等模块之间的交互流程。
目标:结合任务 "gdb调试文本类大对象的插入流程" 串联存储相关的各模块交互流程
1 体系结构
![f790badddd1b9b14a2dfc6f1b46cb5dd.png](https://img-blog.csdnimg.cn/img_convert/f790badddd1b9b14a2dfc6f1b46cb5dd.png)
2 读写元组的过程
![5759f8d80e411f433504858fd0b11480.png](https://img-blog.csdnimg.cn/img_convert/5759f8d80e411f433504858fd0b11480.png)
3 gdb调式大对象的插入流程
3.1 工作环境介绍
os : Red Hat 4.8.5-11
gdb : GNU gdb (GDB) Red Hat Enterprise Linux 7.6.1-94.el7
pg : 8.4.1
3.2 基本调试流程
![a59d36ec5ff771c71e3d2799654ae0ca.png](https://img-blog.csdnimg.cn/img_convert/a59d36ec5ff771c71e3d2799654ae0ca.png)
# 1, start pg
[z00423965@localhost pgsql]$ pg_ctl start -D ./data
server starting
LOG: database system was shut down at 2019-06-27 00:50:55 CST
LOG: database system is ready to accept connections
LOG: autovacuum launcher started
[z00423965@localhost pgsql]$ ps -ef | grep postg
z004239+ 1049 1 0 00:51 pts/7 00:00:00 /home/z00423965/pgsql/build/bin/postgres -D ./data # postmaster
z004239+ 1051 1049 0 00:51 ? 00:00:00 postgres: writer process # bg_writer
z004239+ 1052 1049 0 00:51 ? 00:00:00 postgres: wal writer process # wal_writer
z004239+ 1053 1049 0 00:51 ? 00:00:00 postgres: autovacuum launcher process # auto_vacuum
z004239+ 1054 1049 0 00:51 ? 00:00:00 postgres: stats collector process # pg_stat
# 2, start backend process for this pg_session
# two ssh terminals needed, said T1, T2
[z00423965@localhost pgsql]$ createdb test #@T1
[z00423965@localhost pgsql]$ psql test #@T1
test=# create table t_introduction(item char(256), introduction oid);
[z00423965@localhost pgsql]$ ps -ef | grep postg #@T2
... ...
z004239+ 1757 1049 0 01:01 ? 00:00:00 postgres: z00423965 test [local] idle # backend process for this pg_session
# 3, start gdb
[z00423965@localhost pgsql]$ gdb #@T2
(gdb) layout src #@T2
(gdb) attach 1757 #@T2
(gdb) b lo_import #@T2
(gdb) c #@T2
test=# insert into t_introduction values('pg', lo_import('/home/z00423965/pgsql/pg_