checkpoint中用于控制刷盘频率的函数是什么
发表于:2025-11-07 作者:千家信息网编辑
千家信息网最后更新 2025年11月07日,这篇文章主要介绍"checkpoint中用于控制刷盘频率的函数是什么",在日常操作中,相信很多人在checkpoint中用于控制刷盘频率的函数是什么问题上存在疑惑,小编查阅了各式资料,整理出简单好用的
千家信息网最后更新 2025年11月07日checkpoint中用于控制刷盘频率的函数是什么
这篇文章主要介绍"checkpoint中用于控制刷盘频率的函数是什么",在日常操作中,相信很多人在checkpoint中用于控制刷盘频率的函数是什么问题上存在疑惑,小编查阅了各式资料,整理出简单好用的操作方法,希望对大家解答"checkpoint中用于控制刷盘频率的函数是什么"的疑惑有所帮助!接下来,请跟着小编一起来学习吧!
一、数据结构
宏定义
checkpoints request flag bits
checkpoints request flag bits,检查点请求标记位定义.
/* * OR-able request flag bits for checkpoints. The "cause" bits are used only * for logging purposes. Note: the flags must be defined so that it's * sensible to OR together request flags arising from different requestors. *//* These directly affect the behavior of CreateCheckPoint and subsidiaries */#define CHECKPOINT_IS_SHUTDOWN 0x0001 /* Checkpoint is for shutdown */#define CHECKPOINT_END_OF_RECOVERY 0x0002 /* Like shutdown checkpoint, but * issued at end of WAL recovery */#define CHECKPOINT_IMMEDIATE 0x0004 /* Do it without delays */#define CHECKPOINT_FORCE 0x0008 /* Force even if no activity */#define CHECKPOINT_FLUSH_ALL 0x0010 /* Flush all pages, including those * belonging to unlogged tables *//* These are important to RequestCheckpoint */#define CHECKPOINT_WAIT 0x0020 /* Wait for completion */#define CHECKPOINT_REQUESTED 0x0040 /* Checkpoint request has been made *//* These indicate the cause of a checkpoint request */#define CHECKPOINT_CAUSE_XLOG 0x0080 /* XLOG consumption */#define CHECKPOINT_CAUSE_TIME 0x0100 /* Elapsed time */
WRITES_PER_ABSORB
/* interval for calling AbsorbSyncRequests in CheckpointWriteDelay *///调用AbsorbSyncRequests的间隔,默认值为1000#define WRITES_PER_ABSORB 1000
二、源码解读
CheckpointWriteDelay
CheckpointWriteDelay,控制checkpoint的频率,逻辑不复杂,判断checkpoint flags非CHECKPOINT_IMMEDIATE/非shutdown_requested/非CHECKPOINT_IMMEDIATE并且checkpoint处于调度中,如满足上述条件,则调用AbsorbSyncRequests处理sync,休眠100ms;不如满足上述条件,则absorb_counter计数器减一,如计数器≤0,则调用AbsorbSyncRequests处理sync.
/* * CheckpointWriteDelay -- control rate of checkpoint * 控制checkpoint的频率 * * This function is called after each page write performed by BufferSync(). * It is responsible for throttling BufferSync()'s write rate to hit * checkpoint_completion_target. * * The checkpoint request flags should be passed in; currently the only one * examined is CHECKPOINT_IMMEDIATE, which disables delays between writes. * * 'progress' is an estimate of how much of the work has been done, as a * fraction between 0.0 meaning none, and 1.0 meaning all done. */voidCheckpointWriteDelay(int flags, double progress){ static int absorb_counter = WRITES_PER_ABSORB; /* Do nothing if checkpoint is being executed by non-checkpointer process */ if (!AmCheckpointerProcess()) return; /* * Perform the usual duties and take a nap, unless we're behind schedule, * in which case we just try to catch up as quickly as possible. */ if (!(flags & CHECKPOINT_IMMEDIATE) &&//非CHECKPOINT_IMMEDIATE !shutdown_requested &&//非关闭请求 !ImmediateCheckpointRequested() &&//非CHECKPOINT_IMMEDIATE IsCheckpointOnSchedule(progress))//处于checkpoint调度中 { if (got_SIGHUP) { got_SIGHUP = false; ProcessConfigFile(PGC_SIGHUP); /* update shmem copies of config variables */ UpdateSharedMemoryConfig(); } //Absorb吸收(处理)同步请求 AbsorbSyncRequests(); //重置为WRITES_PER_ABSORB(1000) absorb_counter = WRITES_PER_ABSORB; //检查归档是否超时 CheckArchiveTimeout(); /* * Report interim activity statistics to the stats collector. */ //统计信息 pgstat_send_bgwriter(); /* * This sleep used to be connected to bgwriter_delay, typically 200ms. * That resulted in more frequent wakeups if not much work to do. * Checkpointer and bgwriter are no longer related so take the Big * Sleep. */ //休眠100ms pg_usleep(100000L); } else if (--absorb_counter <= 0)//Absorb计数器减一 { //如计数器小于等于0 /* * Absorb pending fsync requests after each WRITES_PER_ABSORB write * operations even when we don't sleep, to prevent overflow of the * fsync request queue. */ //Absorb同步请求 AbsorbSyncRequests(); //重置计数器 absorb_counter = WRITES_PER_ABSORB; }}到此,关于"checkpoint中用于控制刷盘频率的函数是什么"的学习就结束了,希望能够解决大家的疑惑。理论与实践的搭配能更好的帮助大家学习,快去试试吧!若想继续学习更多相关知识,请继续关注网站,小编会继续努力为大家带来更多实用的文章!
频率
控制
计数器
函数
学习
处理
更多
条件
休眠
同步
帮助
检查
调度
复杂
实用
接下来
信息
数据
数据结构
文章
数据库的安全要保护哪些东西
数据库安全各自的含义是什么
生产安全数据库录入
数据库的安全性及管理
数据库安全策略包含哪些
海淀数据库安全审计系统
建立农村房屋安全信息数据库
易用的数据库客户端支持安全管理
连接数据库失败ssl安全错误
数据库的锁怎样保障安全
深度学习服务器系统
如何获得梦幻西游手游服务器
山东网络安全大赛什么时候开战
社交网络安全目标
租用日本服务器光算云怎么样
网络技术四级考试
魔兽世界新服务器下载
长沙游戏软件开发专业
陕西好渔erp软件开发
浙江服务器标准机柜
北京通讯软件开发服务品质保障
服务器显示未能启动
chira是什么数据库
30天软件开发 告别
商海导航服务管理器连不上服务器
理正数据库耕植土
云空间如何安装数据库
什么是网络安全的第二道闸门
php复选框数据库取值
网络安全盘是啥
计算机网络安全具有隐蔽性
同花顺查银行数据库
学哪种软件开发语言
数据库发布订阅项目属性
银行图数据库应用案例
镀膜人才数据库
诚志名远网络技术有限公司
自查加强网络安全
广东综合软件开发销售价格
文件服务器和数据库服务器