初步学习pg_control文件之十五
2024-09-24 14:13:43
再看如下这个:
int MaxConnections;
应该说,它是一个参考值,在global.c中有如下定义
/*
* Primary determinants of sizes of shared-memory structures. MaxBackends is
* MaxConnections + autovacuum_max_workers + 1 (it is computed by the GUC
* assign hooks for those variables):
*/
int NBuffers = ;
int MaxBackends = ;
int MaxConnections = ;
/*
* This must be called ONCE during postmaster or standalone-backend startup
*/
void
StartupXLOG(void)
{
…
/*
* If any of the critical GUCs have changed, log them before we allow
* backends to write WAL.
*/
LocalSetXLogInsertAllowed();
XLogReportParameters(); …
}
/*
* Check if any of the GUC parameters that are critical for hot standby
* have changed, and update the value in pg_control file if necessary.
*/
static void
XLogReportParameters(void)
{
if (wal_level != ControlFile->wal_level ||
MaxConnections != ControlFile->MaxConnections ||
max_prepared_xacts != ControlFile->max_prepared_xacts ||
max_locks_per_xact != ControlFile->max_locks_per_xact)
{
… ControlFile->MaxConnections = MaxConnections;
ControlFile->max_prepared_xacts = max_prepared_xacts;
ControlFile->max_locks_per_xact = max_locks_per_xact;
ControlFile->wal_level = wal_level;
UpdateControlFile();
}
}
它就是一个参考值:
/*
* This must be called ONCE during postmaster or standalone-backend startup
*/
void
StartupXLOG(void)
{
… /* REDO */
if (InRecovery)
{
…
/* Check that the GUCs used to generate the WAL allow recovery */
CheckRequiredParameterValues(); …
if (record != NULL)
{
…
/*
* main redo apply loop
*/
do
{
…
/*
* If we are attempting to enter Hot Standby mode, process
* XIDs we see
*/
if (standbyState >= STANDBY_INITIALIZED &&
TransactionIdIsValid(record->xl_xid))
RecordKnownAssignedTransactionIds(record->xl_xid); RmgrTable[record->xl_rmid].rm_redo(EndRecPtr, record);
… } while (record != NULL && recoveryContinue);
…
}
…
}
…
}
/*
* XLOG resource manager's routines
*
* Definitions of info values are in include/catalog/pg_control.h, though
* not all record types are related to control file updates.
*/
void
xlog_redo(XLogRecPtr lsn, XLogRecord *record)
{
…
if (info == XLOG_NEXTOID)
{
…
}
…
else if (info == XLOG_PARAMETER_CHANGE)
{
…
/* Check to see if any changes to max_connections give problems */
CheckRequiredParameterValues();
}
}
再看下面:
/*
* Check to see if required parameters are set high enough on this server
* for various aspects of recovery operation.
*/
static void
CheckRequiredParameterValues(void)
{
... if (InArchiveRecovery && EnableHotStandby)
{
.../* We ignore autovacuum_max_workers when we make this test. */
RecoveryRequiresIntParameter("max_connections",
MaxConnections,
ControlFile->MaxConnections);
...
}
}
最新文章
- iOS KVC valueForKeyPath学习心得
- SQL语句:find_in_set的使用方法
- H5标签-canvas实现颜色拾取功能
- [SQL]SUTFF内置函数的用法
- oracle的表名、字段名、constraint名的长度限制分别是多少?
- cocos2d-x 3.1.1 学习笔记[3]Action 动作
- 【线段树/数学/扩展欧几里得】 Bzoj 3913:奇数国
- SQL Server2008数据库如何改名
- 第一节 UPC 码
- CC Subarray LCM (数学)
- Linux下find命令具体解释
- shell-改变分隔符
- Java学习笔记之static
- c#之时间戳与DateTime的相互转换
- 走近webpack(5)--devtool及babel的使用
- Asianux 7.3安装Oracle 11.2.0.4单实例体验
- Qt Installer Framework 使用说明(二)
- matlab 获取网卡MAC地址
- Oracle - 为子查询提供动态结果集
- 【CodeForces】915 E. Physical Education Lessons 线段树
热门文章
- oracle数据库中创建表空间和临时表空间,以及用户和密码以及设置密码永不过期
- python入门5 运算符
- Jmeter入门12 __time函数 jmeter获取当前系统时间
- 2018中国大学生程序设计竞赛 - 网络选拔赛 1010 YJJ's Salesman 【离散化+树状数组维护区间最大值】
- python-实现登录接口
- <;head>; 中的 JavaScript 函数
- android 界面控件 textview 全解
- HTML中id和class选择器
- Django-rest-framework(六)filter,ordering,search
- Git push提示pre-receive hook declined