博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
对PostgreSQL中bufmgr.c 的BgBufferSync的静态变量学习 --prev_strategy_buf_id
阅读量:5102 次
发布时间:2019-06-13

本文共 2956 字,大约阅读时间需要 9 分钟。

开始

bool                BgBufferSync(void)                {                    ……                /*                 * Information saved between calls so we can determine the strategy                 * point's advance rate and avoid scanning already-cleaned buffers.                 */                static           bool          saved_info_valid = false;                static           int        prev_strategy_buf_id;        static          uint32         prev_strategy_passes;        static          int        next_to_clean;        static     uint32     next_passes;                      /* Moving averages of allocation rate and clean-buffer density */                static     float     smoothed_alloc = 0;        static     float     smoothed_density = 10.0;                        ……                             if (saved_info_valid)                {                    ……                strategy_delta = strategy_buf_id - prev_strategy_buf_id;                strategy_delta += (long) passes_delta *NBuffers;                ……         }                else                {                    ……            }                fprintf(stderr,"before saving, prev_strategy_buf_id is %d \n", prev_strategy_buf_id);                /* Update saved info for next time */                prev_strategy_buf_id = strategy_buf_id;                prev_strategy_passes = strategy_passes;                saved_info_valid = true;                                ……                                fprintf(stderr,"prev_strategy_buf_id is %d \n", prev_strategy_buf_id);                /* Return true if OK to hibernate */                return (bufs_to_lap == 0 && recent_alloc == 0);            }

执行的结果显示,即使我用psql 变更了某行的值,直到最后,prev_strategy_buf_id 的值也没有发生根本性的变化。

[postgres@localhost bin]$ ./postgres -D /usr/local/pgsql/data        LOG:  database system was shut down at 2012-11-02 15:30:38 CST        saved_info_valid false.        before saving,prev_strategy_buf_id is: 0        prev_strategy_buf_id is 0         LOG:  autovacuum launcher started        LOG:  database system is ready to accept connections        before saving,prev_strategy_buf_id is: 0        prev_strategy_buf_id is 0         before saving,prev_strategy_buf_id is: 0        prev_strategy_buf_id is 0         before saving,prev_strategy_buf_id is: 0        prev_strategy_buf_id is 0         before saving,prev_strategy_buf_id is: 0        prev_strategy_buf_id is 0         before saving,prev_strategy_buf_id is: 0        prev_strategy_buf_id is 0                 ……                        before saving,prev_strategy_buf_id is: 0        prev_strategy_buf_id is 0         LOG:  received fast shutdown request        LOG:  aborting any active transactions        LOG:  autovacuum launcher shutting down        LOG:  shutting down        LOG:  database system is shut down        [postgres@localhost bin]$

[作者:技术者高健@博客园  mail:  ]

结束

转载于:https://www.cnblogs.com/gaojian/archive/2012/11/02/2751375.html

你可能感兴趣的文章
如何终止线程的运行(C/C++)
查看>>
"远程桌面连接--“发生身份验证错误。要求的函数不受支持
查看>>
【BZOJ1565】 植物大战僵尸
查看>>
视频:"我是设计师"高清完整版Plus拍摄花絮
查看>>
sicp solutions
查看>>
VALSE2019总结(4)-主题报告
查看>>
浅谈 unix, linux, ios, android 区别和联系
查看>>
PhotoZoom放大图片,真的能无损吗?
查看>>
转载分享移动网站最佳实践
查看>>
spark--环境搭建--4.ZooKeeper345集群搭建
查看>>
Codeforces Round #426 (Div. 2) C. The Meaningless Game
查看>>
51nod 1428 活动安排问题 (贪心+优先队列)
查看>>
leetcode - Next Permutation
查看>>
C#创建Windows服务程序
查看>>
Spring Boot 2.0系列文章(五):Spring Boot 2.0 项目源码结构预览
查看>>
中国烧鹅系列:利用烧鹅自动执行SD卡上的自定义程序(含视频)
查看>>
Solaris11修改主机名
查看>>
latex for wordpress(一)
查看>>
如何在maven工程中加载oracle驱动
查看>>
Flask 系列之 SQLAlchemy
查看>>