![](https://img-blog.csdnimg.cn/20201014180756922.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
PostgreSQL源码阅读
文章平均质量分 79
aoerqileng
这个作者很懒,什么都没留下…
展开
-
pg源码阅读二
postmaster中使用AuxiliaryProcessMain来启动bgwriter walwriter等,在该类中去分别启动不同的辅助进程 switch (auxType) { case CheckerProcess: bootstrap_signals(); CheckerModeMain();原创 2016-07-18 23:28:27 · 712 阅读 · 0 评论 -
pg源码阅读四
pg中的内存是内存上下文来管理的,有不同类型的上下文,不同的上下文是通过MemoryContextMethods指针操作的,下面的是顶层的上下文 MemoryContext CurrentMemoryContext = NULL;默认的上下文 MemoryContext TopMemoryContext = NULL; MemoryContext ErrorContext = NULL; M原创 2016-07-23 21:07:50 · 604 阅读 · 0 评论 -
pg源码阅读一
入口函数是backend/main/main.c,这个文件中只是根据不同的指定配置启动不同类型的进程,比如postmaster,bootstrap模式,和单独后台进程。 没有指定启动默认,默认就是会启动postmaster,开始会初始化内存上下文,设置一些语言变量,随后调用PostmasterMain方法,随后的palloc()方法请求的内存会在PostmasterContext中分配,postm原创 2016-07-17 12:32:45 · 1238 阅读 · 0 评论 -
pg源码阅读五
在pg启动的时候,会初始化共享内存,下面看下过程 在postmaster中使用下面的调用进入初始化过程 /* * Set up shared memory and semaphores. */ reset_shared(PostPortNumber); 传入的是端口号,每次启动的时候,都是根据这个端口号来分配相同的IPC key, CreateSharedM原创 2016-07-28 23:06:19 · 1232 阅读 · 0 评论 -
pg源码阅读三
之前提到,bgwriter没有检查点就执行BgBufferSync();刷新buffer,下马继续看下多久执行一次,主要是通过BgWriterNap()来配置等待时间 /* * Nap for the configured time, or sleep for 10 seconds if there is no * bgwriter activity configured.原创 2016-07-19 22:34:09 · 704 阅读 · 0 评论