博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
初步学习pg_control文件之十五
阅读量:6295 次
发布时间:2019-06-22

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

接前文  

再看如下这个:

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 = 1000;int            MaxBackends = 100;int            MaxConnections = 90;
/*                                 * 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); ...                        }                                            }

转载地址:http://uytta.baihongyu.com/

你可能感兴趣的文章
[汇编语言学习笔记][第四章第一个程序的编写]
查看>>
android 打开各种文件(setDataAndType)转:
查看>>
补交:最最原始的第一次作业(当时没有选上课,所以不知道)
查看>>
Vue实例初始化的选项配置对象详解
查看>>
PLM产品技术的发展趋势 来源:e-works 作者:清软英泰 党伟升 罗先海 耿坤瑛
查看>>
vue part3.3 小案例ajax (axios) 及页面异步显示
查看>>
浅谈MVC3自定义分页
查看>>
.net中ashx文件有什么用?功能有那些,一般用在什么情况下?
查看>>
select、poll、epoll之间的区别总结[整理]【转】
查看>>
CSS基础知识(上)
查看>>
PHP中常见的面试题2(附答案)
查看>>
26.Azure备份服务器(下)
查看>>
mybatis学习
查看>>
LCD的接口类型详解
查看>>
Spring Boot Unregistering JMX-exposed beans on shutdown
查看>>
poi 导入导出的api说明(大全)
查看>>
Mono for Android 优势与劣势
查看>>
将图片转成base64字符串并在JSP页面显示的Java代码
查看>>
js 面试题
查看>>
sqoop数据迁移(基于Hadoop和关系数据库服务器之间传送数据)
查看>>