接前文  初步学习pg_control文件之十四

再看如下这个:

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);
...

}
}

初步学习pg_control文件之十五的更多相关文章

  1. 初步学习pg_control文件之十四

    接前文 初步学习pg_control文件之十三 看如下几个: /* * Parameter settings that determine if the WAL can be used for arc ...

  2. 初步学习pg_control文件之十二

    接前问,初步学习pg_control文件之十一,再来看下面这个 XLogRecPtr minRecoveryPoint; 看其注释: * minRecoveryPoint is updated to ...

  3. 初步学习pg_control文件之十

    接前文 初步学习pg_control文件之九 看下面这个 XLogRecPtr checkPoint; /* last check point record ptr */ 看看这个pointer究竟保 ...

  4. 初步学习pg_control文件之十三

    接前文,初步学习pg_control文件之十二 看这个: * backupStartPoint is the redo pointer of the backup start checkpoint, ...

  5. 初步学习pg_control文件之十一

    接前文  初步学习pg_control文件之十,再看这个 XLogRecPtr prevCheckPoint; /* previous check point record ptr */ 发生了che ...

  6. 初步学习pg_control文件之九

    接前文,初步学习pg_control文件之八 来看这个: pg_time_t time; /* time stamp of last pg_control update */ 当初初始化的时候,是这样 ...

  7. 初步学习pg_control文件之八

    接前文  初步学习pg_control文件之七  继续 看:catalog_version_no 代码如下: static void WriteControlFile(void) { ... /* * ...

  8. 初步学习pg_control文件之七

    接前文 初步学习pg_control文件之六  看   pg_control_version 以PostgreSQL9.1.1为了,其HISTORY文件中有如下的内容: Release Release ...

  9. 初步学习pg_control文件之六

    接前文:初步学习pg_control文件之五 ,DB_IN_ARCHIVE_RECOVERY何时出现? 看代码:如果recovery.conf文件存在,则返回 InArchiveRecovery = ...

随机推荐

  1. May 09th 2017 Week 19th Tuesday

    Everything you see exists together in a delicate balance. 世上所有的生命都在微妙的平衡中生存. A delicate balance? Can ...

  2. OC extern和变量

    注意: extern只能用来声明全部变量,不能拿来定义变量 #include <stdio.h> // 第一种做法是将a定义在main函数的前面 // int a; // 完整地声明全部变 ...

  3. (转)Wireshark基本介绍和学习TCP三次握手

    原地址https://www.cnblogs.com/TankXiao/archive/2012/10/10/2711777.html#filter 阅读目录 wireshark介绍 wireshar ...

  4. 「bzoj3687: 简单题」

    题目 发现需要一个\(O(n\sum a_i )\)的做法 于是可以直接做一个背包,\(dp[i]\)表示和为\(i\)的子集是否有奇数种 \(bitset\)优化一下就好了 #include< ...

  5. Idea Find in Path 全局搜索的功能

    当我们想查找哪些文件中含有某个关键词时,就要依靠Find in Path,相当于一个全局搜索的功能.

  6. 超简单,快速修改Oracle10g的默认8080端口

    因为Oracle数据库默认的端口是8080,这也是tomcat服务器的默认端口. 为了避免端口冲突,我们通常会修改掉其中一个. 这里我们选择修改Oracle数据库的端口. 第一步:以管理员身份运行cm ...

  7. EJB结合struts2创建项目、发布jboss服务器和访问、父类(BaseDaoImpl)的封装

    一.环境搭建: 1.准备jboss服务器,将对应数据库的xml配置好放到jboss的发布目录下. <?xml version="1.0" encoding="UTF ...

  8. deep learning学习记录一

    最近不小心又赶了一下时髦,在做deep learning.今天去听了复旦吴老师的课程,感觉吴老讲解的还是很清晰的. 上午刚看过cnn,下午讲解的就是这章,相对来说,我听着给了很多启发.

  9. android ListView 与GridView 学习总结(五)

    ListView的使用总结 基本使用:   步骤:在布局文件中定义一个ListView控件-在活动中获得ListView的实例-获得适配器adapter的实例并且传入三个参数-把适配器对象传递给lis ...

  10. 与select2有关的知识点总结

    1.多选下拉框设置提示 var datass = [ { id:0, text: '你好' }, { id:1, text: '好久不见' }, { id:2, text: '好想你' } ]; va ...