Compare commits
8 Commits
| Author | SHA1 | Date |
|---|---|---|
|
|
f67a151edc | |
|
|
319c2a2f85 | |
|
|
dafd9e51c8 | |
|
|
ba82225bd0 | |
|
|
fc7c109854 | |
|
|
1563179ec8 | |
|
|
49847211c0 | |
|
|
8f043962aa |
|
|
@ -44,6 +44,7 @@ static void resetCreateFuncFlag()
|
|||
*
|
||||
* Returns a list of raw (un-analyzed) parse trees.
|
||||
*/
|
||||
/* 原始解析器,输入查询字符串,做词法和语法分析,返回原始语法解析树列表 */
|
||||
List* raw_parser(const char* str, List** query_string_locationlist)
|
||||
{
|
||||
core_yyscan_t yyscanner;
|
||||
|
|
@ -60,18 +61,22 @@ List* raw_parser(const char* str, List** query_string_locationlist)
|
|||
resetCreateFuncFlag();
|
||||
|
||||
/* initialize the flex scanner */
|
||||
/* 初始化 flex scanner */
|
||||
yyscanner = scanner_init(str, &yyextra.core_yy_extra, ScanKeywords, NumScanKeywords);
|
||||
|
||||
/* base_yylex() only needs this much initialization */
|
||||
yyextra.lookahead_num = 0;
|
||||
|
||||
/* initialize the bison parser */
|
||||
/* 初始化 bison parser */
|
||||
parser_init(&yyextra);
|
||||
|
||||
/* Parse! */
|
||||
/* 解析 */
|
||||
yyresult = base_yyparse(yyscanner);
|
||||
|
||||
/* Clean up (release memory) */
|
||||
/* 清理释放内存 */
|
||||
scanner_finish(yyscanner);
|
||||
|
||||
if (yyresult) { /* error */
|
||||
|
|
|
|||
|
|
@ -1531,6 +1531,9 @@ int PostmasterMain(int argc, char* argv[])
|
|||
* for example single_node mode,
|
||||
* so need this function to init postmaster level guc.
|
||||
*/
|
||||
/*
|
||||
初始化postmaster配置参数
|
||||
*/
|
||||
InitializePostmasterGUC();
|
||||
|
||||
t_thrd.myLogicTid = noProcLogicTid + POSTMASTER_LID;
|
||||
|
|
@ -1684,6 +1687,7 @@ int PostmasterMain(int argc, char* argv[])
|
|||
CreateDataDirLockFile(true);
|
||||
|
||||
/* Module load callback */
|
||||
/* 初始化审计模块 */
|
||||
pgaudit_agent_init();
|
||||
auto_explain_init();
|
||||
ledger_hook_init();
|
||||
|
|
@ -1696,6 +1700,7 @@ int PostmasterMain(int argc, char* argv[])
|
|||
/*
|
||||
* Establish input sockets.
|
||||
*/
|
||||
/* 建立输入socket监听 */
|
||||
for (i = 0; i < MAXLISTEN; i++)
|
||||
t_thrd.postmaster_cxt.ListenSocket[i] = PGINVALID_SOCKET;
|
||||
|
||||
|
|
@ -1978,12 +1983,14 @@ int PostmasterMain(int argc, char* argv[])
|
|||
/*
|
||||
* Set up shared memory and semaphores.
|
||||
*/
|
||||
/* 建立共享内存和信息量池 */
|
||||
reset_shared(g_instance.attr.attr_network.PostPortNumber);
|
||||
|
||||
/* Alloc array for backend record. */
|
||||
BackendArrayAllocation();
|
||||
|
||||
/* init thread args pool for ever sub threads except signal moniter */
|
||||
/* 初始化postmaster信号管理 */
|
||||
gs_thread_args_pool_init(GLOBAL_ALL_PROCS + EXTERN_SLOTS_NUM, sizeof(BackendParameters));
|
||||
// 1.init signal manage struct
|
||||
//
|
||||
|
|
@ -2016,6 +2023,7 @@ int PostmasterMain(int argc, char* argv[])
|
|||
* Initialize pipe (or process handle on Windows) that allows children to
|
||||
* wake up from sleep on postmaster death.
|
||||
*/
|
||||
/* 初始化宕机监听 */
|
||||
InitPostmasterDeathWatchHandle();
|
||||
|
||||
#ifdef WIN32
|
||||
|
|
@ -2119,12 +2127,14 @@ int PostmasterMain(int argc, char* argv[])
|
|||
* Initialize stats collection subsystem (this does NOT start the
|
||||
* collector process!)
|
||||
*/
|
||||
/* 初始化统计数据收集子系统 */
|
||||
pgstat_init();
|
||||
|
||||
/* Initialize the global stats tracker */
|
||||
GlobalStatsTrackerInit();
|
||||
|
||||
/* initialize workload manager */
|
||||
/* 初始化工作负载管理器 */
|
||||
InitializeWorkloadManager();
|
||||
|
||||
g_instance.global_sysdbcache.Init(INSTANCE_GET_MEM_CXT_GROUP(MEMORY_CONTEXT_DEFAULT));
|
||||
|
|
@ -2159,6 +2169,7 @@ int PostmasterMain(int argc, char* argv[])
|
|||
/* pcmap */
|
||||
RealInitialMMapLockArray();
|
||||
/* init unique sql */
|
||||
/* 初始化unique sql资源 */
|
||||
InitUniqueSQL();
|
||||
/* init hypo index */
|
||||
InitHypopg();
|
||||
|
|
@ -2267,6 +2278,7 @@ int PostmasterMain(int argc, char* argv[])
|
|||
/*
|
||||
* Initialize the autovacuum subsystem (again, no process start yet)
|
||||
*/
|
||||
/* 初始化垃圾清理线程子系统*/
|
||||
autovac_init();
|
||||
|
||||
load_ident();
|
||||
|
|
@ -2335,6 +2347,7 @@ int PostmasterMain(int argc, char* argv[])
|
|||
g_instance.pid_cxt.SysLoggerPID = SysLogger_Start();
|
||||
StartUDFMaster();
|
||||
}
|
||||
/* 准备完毕,启动postmaster主业务循环 */
|
||||
if (status == STATUS_OK)
|
||||
status = ServerLoop();
|
||||
|
||||
|
|
|
|||
|
|
@ -7128,6 +7128,7 @@ void RemoveTempNamespace()
|
|||
* username is the openGauss user name to be used for the session.
|
||||
* ----------------------------------------------------------------
|
||||
*/
|
||||
/* 原始解析器,输入查询字符串,做词法和语法分析,返回原始解析树列表 */
|
||||
int PostgresMain(int argc, char* argv[], const char* dbname, const char* username)
|
||||
{
|
||||
int firstchar;
|
||||
|
|
@ -7450,6 +7451,7 @@ int PostgresMain(int argc, char* argv[], const char* dbname, const char* usernam
|
|||
* it inside InitPostgres() instead. In particular, anything that
|
||||
* involves database access should be there, not here.
|
||||
*/
|
||||
/* 初始化 */
|
||||
t_thrd.proc_cxt.PostInit->SetDatabaseAndUser(dbname, InvalidOid, username);
|
||||
|
||||
/*
|
||||
|
|
@ -7627,6 +7629,7 @@ int PostgresMain(int argc, char* argv[], const char* dbname, const char* usernam
|
|||
*/
|
||||
int curTryCounter;
|
||||
int* oldTryCounter = NULL;
|
||||
/* 自动事务的错误处理 */
|
||||
if (sigsetjmp(local_sigjmp_buf, 1) != 0) {
|
||||
/* reset signal block flag for threadpool worker */
|
||||
ResetInterruptCxt();
|
||||
|
|
@ -7886,6 +7889,7 @@ int PostgresMain(int argc, char* argv[], const char* dbname, const char* usernam
|
|||
}
|
||||
PG_END_TRY();
|
||||
/* statement retry phase : RI */
|
||||
/* 错误语句的重新尝试阶段 */
|
||||
if (IsStmtRetryEnabled() && u_sess->exec_cxt.RetryController->IsQueryRetrying()) {
|
||||
/*
|
||||
* if stmt is retring, we can't send ready for query
|
||||
|
|
@ -7913,6 +7917,7 @@ int PostgresMain(int argc, char* argv[], const char* dbname, const char* usernam
|
|||
/*
|
||||
* Non-error queries loop here.
|
||||
*/
|
||||
/* 无错误查询指令循环处理*/
|
||||
for (;;) {
|
||||
/*
|
||||
* Since max_query_rerty_times is a USERSET GUC, so must check Statement retry
|
||||
|
|
@ -8225,7 +8230,8 @@ int PostgresMain(int argc, char* argv[], const char* dbname, const char* usernam
|
|||
u_sess->proc_cxt.MyProcPort->gs_sock.idx,
|
||||
u_sess->proc_cxt.MyProcPort->gs_sock.sid,
|
||||
firstchar);
|
||||
|
||||
|
||||
/* 按命令类型执行处理流程*/
|
||||
switch (firstchar) {
|
||||
#ifdef ENABLE_MULTIPLE_NODES
|
||||
case 'Z': // exeute plan directly.
|
||||
|
|
|
|||
|
|
@ -211,6 +211,7 @@ static void report_iud_time(QueryDesc *query)
|
|||
* normally call standard_ExecutorStart().
|
||||
* ----------------------------------------------------------------
|
||||
*/
|
||||
/* 执行器启动 */
|
||||
void ExecutorStart(QueryDesc* queryDesc, int eflags)
|
||||
{
|
||||
gstrace_entry(GS_TRC_ID_ExecutorStart);
|
||||
|
|
@ -435,6 +436,7 @@ void standard_ExecutorStart(QueryDesc *queryDesc, int eflags)
|
|||
*
|
||||
* ----------------------------------------------------------------
|
||||
*/
|
||||
/* 执行器运行 */
|
||||
void ExecutorRun(QueryDesc *queryDesc, ScanDirection direction, long count)
|
||||
{
|
||||
/* sql active feature, opeartor history statistics */
|
||||
|
|
@ -496,11 +498,13 @@ void ExecutorRun(QueryDesc *queryDesc, ScanDirection direction, long count)
|
|||
}
|
||||
|
||||
/* SQL Self-Tuning : Analyze query plan issues based on runtime info when query execution is finished */
|
||||
/* SQL 自调优: 查询执行完毕时,基于运行时信息分析查询计划问题 */
|
||||
if (u_sess->exec_cxt.need_track_resource && queryDesc != NULL && has_track_operator &&
|
||||
(IS_PGXC_COORDINATOR || IS_SINGLE_NODE)) {
|
||||
List *issue_results = PlanAnalyzerOperator(queryDesc, queryDesc->planstate);
|
||||
|
||||
/* If plan issue is found, store it in sysview gs_wlm_session_history */
|
||||
/* 如果查询问题找到,存在系统视图 gs_wlm_session_history */
|
||||
if (issue_results != NIL) {
|
||||
RecordQueryPlanIssues(issue_results);
|
||||
}
|
||||
|
|
@ -509,6 +513,7 @@ void ExecutorRun(QueryDesc *queryDesc, ScanDirection direction, long count)
|
|||
instr_stmt_report_query_plan(queryDesc);
|
||||
|
||||
/* sql active feature, opeartor history statistics */
|
||||
/* 查询动态特征, 操作符历史统计信息 */
|
||||
if (can_operator_history_statistics) {
|
||||
u_sess->instr_cxt.can_record_to_table = true;
|
||||
ExplainNodeFinish(queryDesc->planstate, queryDesc->plannedstmt, GetCurrentTimestamp(), false);
|
||||
|
|
@ -655,6 +660,7 @@ void standard_ExecutorRun(QueryDesc *queryDesc, ScanDirection direction, long co
|
|||
*
|
||||
* ----------------------------------------------------------------
|
||||
*/
|
||||
/* 执行器完成 */
|
||||
void ExecutorFinish(QueryDesc *queryDesc)
|
||||
{
|
||||
if (ExecutorFinish_hook) {
|
||||
|
|
@ -711,6 +717,7 @@ void standard_ExecutorFinish(QueryDesc *queryDesc)
|
|||
*
|
||||
* ----------------------------------------------------------------
|
||||
*/
|
||||
/* 执行器结束 */
|
||||
void ExecutorEnd(QueryDesc *queryDesc)
|
||||
{
|
||||
if (ExecutorEnd_hook) {
|
||||
|
|
|
|||
|
|
@ -1674,6 +1674,7 @@ Buffer ReadBuffer(Relation reln, BlockNumber block_num)
|
|||
* If strategy is not NULL, a nondefault buffer access strategy is used.
|
||||
* See buffer/README for details.
|
||||
*/
|
||||
/* 查找或创建一个缓冲区 */
|
||||
Buffer ReadBufferExtended(Relation reln, ForkNumber fork_num, BlockNumber block_num, ReadBufferMode mode,
|
||||
BufferAccessStrategy strategy)
|
||||
{
|
||||
|
|
@ -1685,6 +1686,7 @@ Buffer ReadBufferExtended(Relation reln, ForkNumber fork_num, BlockNumber block_
|
|||
}
|
||||
|
||||
/* Open it at the smgr level if not already done */
|
||||
/* 以smgr(存储管理器)级别打开一个缓冲区 */
|
||||
RelationOpenSmgr(reln);
|
||||
|
||||
/*
|
||||
|
|
@ -1692,6 +1694,7 @@ Buffer ReadBufferExtended(Relation reln, ForkNumber fork_num, BlockNumber block_
|
|||
* likely to get wrong data since we have no visibility into the owning
|
||||
* session's local buffers.
|
||||
*/
|
||||
/* 拒绝读取非局部临时关系的请求,因为可能会获得监控不到的错误数据 */
|
||||
if (RELATION_IS_OTHER_TEMP(reln) && fork_num <= INIT_FORKNUM)
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("cannot access temporary tables of other sessions")));
|
||||
|
|
@ -1700,6 +1703,7 @@ Buffer ReadBufferExtended(Relation reln, ForkNumber fork_num, BlockNumber block_
|
|||
* Read the buffer, and update pgstat counters to reflect a cache hit or
|
||||
* miss.
|
||||
*/
|
||||
/* 读取缓冲区,更新pgstat 数量反馈cache 命中与否情况 */
|
||||
pgstat_count_buffer_read(reln);
|
||||
pgstatCountBlocksFetched4SessionLevel();
|
||||
|
||||
|
|
@ -5235,11 +5239,13 @@ void FlushDatabaseBuffers(Oid dbid)
|
|||
/*
|
||||
* ReleaseBuffer -- release the pin on a buffer
|
||||
*/
|
||||
/* 释放一个缓冲区 */
|
||||
void ReleaseBuffer(Buffer buffer)
|
||||
{
|
||||
BufferDesc *buf_desc = NULL;
|
||||
PrivateRefCountEntry *ref = NULL;
|
||||
|
||||
/* 错误释放处理 */
|
||||
if (!BufferIsValid(buffer)) {
|
||||
ereport(ERROR, (errcode(ERRCODE_INVALID_BUFFER), (errmsg("bad buffer ID: %d", buffer))));
|
||||
}
|
||||
|
|
@ -5252,6 +5258,7 @@ void ReleaseBuffer(Buffer buffer)
|
|||
return;
|
||||
}
|
||||
|
||||
/* 释放当前缓冲区 */
|
||||
buf_desc = GetBufferDescriptor(buffer - 1);
|
||||
|
||||
PrivateRefCountEntry *free_entry = NULL;
|
||||
|
|
@ -5322,6 +5329,7 @@ void IncrBufferRefCount(Buffer buffer)
|
|||
* 3. This function does not guarantee that the buffer is always marked dirty
|
||||
* (due to a race condition), so it cannot be used for important changes.
|
||||
*/
|
||||
/* 标记写脏缓冲区 */
|
||||
void MarkBufferDirtyHint(Buffer buffer, bool buffer_std)
|
||||
{
|
||||
BufferDesc *buf_desc = NULL;
|
||||
|
|
@ -5420,6 +5428,7 @@ void MarkBufferDirtyHint(Buffer buffer, bool buffer_std)
|
|||
|
||||
Assert(BUF_STATE_GET_REFCOUNT(old_buf_state) > 0);
|
||||
|
||||
/* 如果缓冲区不是“脏”状态,则更新相关计数 */
|
||||
if (!(old_buf_state & BM_DIRTY)) {
|
||||
/*
|
||||
* Set the page LSN if we wrote a backup block. We aren't supposed
|
||||
|
|
|
|||
|
|
@ -328,6 +328,7 @@ void CStore::InitRoughCheckEnv(CStoreScanState* state)
|
|||
}
|
||||
}
|
||||
|
||||
/* 扫描 APIs */
|
||||
void CStore::InitScan(CStoreScanState* state, Snapshot snapshot)
|
||||
{
|
||||
Assert(state && state->ps.ps_ProjInfo);
|
||||
|
|
@ -1110,6 +1111,7 @@ void CStore::IncLoadCuDescIdx(int& idx) const
|
|||
*
|
||||
* @return: void
|
||||
*/
|
||||
/* 设置数据压缩单元范围以支持索引扫描 */
|
||||
void CStore::SetScanRange()
|
||||
{
|
||||
Oid cudescOid = m_relation->rd_rel->relcudescrelid;
|
||||
|
|
@ -1409,12 +1411,14 @@ bool CStore::IsEndScan() const
|
|||
}
|
||||
|
||||
FORCE_INLINE
|
||||
/* 延迟读取APIs */
|
||||
bool CStore::IsLateRead(int id) const
|
||||
{
|
||||
Assert(m_lateRead);
|
||||
return m_lateRead[id];
|
||||
}
|
||||
|
||||
/* 更新列存储扫描计时标记 */
|
||||
void CStore::ResetLateRead()
|
||||
{
|
||||
for (int i = 0; i < m_colNum; ++i)
|
||||
|
|
@ -1432,6 +1436,7 @@ void CStore::SetTiming(CStoreScanState* state)
|
|||
m_timing_on = (NULL != ((ScanState*)state)->ps.instrument && ((ScanState*)state)->ps.instrument->need_timer);
|
||||
}
|
||||
|
||||
/* 列存储扫描 */
|
||||
void CStore::ScanByTids(_in_ CStoreIndexScanState* state, _in_ VectorBatch* idxOut, _out_ VectorBatch* vbout)
|
||||
{
|
||||
Assert(state && idxOut && vbout);
|
||||
|
|
@ -2218,6 +2223,7 @@ void CStore::SaveCUDesc(_in_ Relation rel, _in_ CUDesc* cuDescPtr, _in_ int col,
|
|||
* this function is special for adio, third param adio_work control adio like enable_adio_function.
|
||||
* because GetLivedRowNumbers should not work in adio model
|
||||
*/
|
||||
/* 加载数据压缩单元描述信息 */
|
||||
bool CStore::LoadCUDesc(
|
||||
_in_ int col, __inout LoadCUDescCtl* loadCUDescInfoPtr, _in_ bool prefetch_control, _in_ Snapshot snapShot)
|
||||
{
|
||||
|
|
@ -2414,6 +2420,7 @@ bool CStore::LoadCUDesc(
|
|||
return false;
|
||||
}
|
||||
|
||||
/* 缓冲向量填充 APIs */
|
||||
int CStore::FillVecBatch(_out_ VectorBatch* vecBatchOut)
|
||||
{
|
||||
Assert(vecBatchOut);
|
||||
|
|
@ -2503,6 +2510,7 @@ int CStore::FillVecBatch(_out_ VectorBatch* vecBatchOut)
|
|||
}
|
||||
|
||||
// Fill vector of column
|
||||
/* 填充列向量 */
|
||||
template <bool hasDeadRow, int attlen>
|
||||
int CStore::FillVector(_in_ int seq, _in_ CUDesc* cuDescPtr, _out_ ScalarVector* vec)
|
||||
{
|
||||
|
|
@ -3142,6 +3150,7 @@ int CStore::FillTidForLateRead(_in_ CUDesc* cuDescPtr, _out_ ScalarVector* vec)
|
|||
return deadRows;
|
||||
}
|
||||
|
||||
/* 填充系统列 */
|
||||
int CStore::FillSysColVector(_in_ int colIdx, _in_ CUDesc* cuDescPtr, _out_ ScalarVector* vec)
|
||||
{
|
||||
Assert(cuDescPtr && vec);
|
||||
|
|
@ -3197,6 +3206,7 @@ int CStore::FillSysColVector(_in_ int colIdx, _in_ CUDesc* cuDescPtr, _out_ Scal
|
|||
/*
|
||||
* Get CUDesc of column according to cuid.
|
||||
*/
|
||||
/* 从描述表中获取数据压缩单元描述 */
|
||||
bool CStore::GetCUDesc(_in_ int col, _in_ uint32 cuid, _out_ CUDesc* cuDescPtr, _in_ Snapshot snapShot)
|
||||
{
|
||||
ScanKeyData key[2];
|
||||
|
|
@ -3301,6 +3311,7 @@ bool CStore::GetCUDesc(_in_ int col, _in_ uint32 cuid, _out_ CUDesc* cuDescPtr,
|
|||
return found;
|
||||
}
|
||||
|
||||
/* 获取元组删除信息 */
|
||||
void CStore::GetCUDeleteMaskIfNeed(_in_ uint32 cuid, _in_ Snapshot snapShot)
|
||||
{
|
||||
ScanKeyData key[2];
|
||||
|
|
@ -3511,6 +3522,7 @@ void CStore::CheckConsistenceOfCUData(CUDesc* cuDescPtr, CU* cu, AttrNumber col)
|
|||
// 9. Update the memory reservation.
|
||||
// 10.Resume the busy CUbuffer, wakeup any threads waiting for
|
||||
// the cache entry.
|
||||
/* 获得数据压缩单元 */
|
||||
CU* CStore::GetCUData(CUDesc* cuDescPtr, int colIdx, int valSize, int& slotId)
|
||||
{
|
||||
/*
|
||||
|
|
@ -3915,6 +3927,7 @@ bool CStore::GetCURowCount(_in_ int col, __inout LoadCUDescCtl* loadCUDescInfoPt
|
|||
/*
|
||||
* Get the lived row numbers of relation.
|
||||
*/
|
||||
/* 获取实时行号 */
|
||||
int64 CStore::GetLivedRowNumbers(int64* totaldeadrows)
|
||||
{
|
||||
int64 rowNumbers = 0;
|
||||
|
|
@ -3941,6 +3954,7 @@ int64 CStore::GetLivedRowNumbers(int64* totaldeadrows)
|
|||
}
|
||||
|
||||
// It is to judge the row whether dead.
|
||||
/* 判断行是否可用 */
|
||||
bool CStore::IsDeadRow(uint32 cuid, uint32 row) const
|
||||
{
|
||||
Assert(cuid == m_delMaskCUId);
|
||||
|
|
|
|||
|
|
@ -92,6 +92,7 @@ MOTEngine::~MOTEngine()
|
|||
Destroy();
|
||||
}
|
||||
|
||||
/* 创建内存引擎实例 */
|
||||
MOTEngine* MOTEngine::CreateInstance(
|
||||
const char* configFilePath /* = nullptr */, int argc /* = 0 */, char* argv[] /* = nullptr */)
|
||||
{
|
||||
|
|
@ -187,10 +188,12 @@ bool MOTEngine::LoadConfig()
|
|||
// so the envelope can check for conflicts between MOTEngine and envelope configuration
|
||||
}
|
||||
|
||||
/* 内存引擎初始化 */
|
||||
bool MOTEngine::Initialize()
|
||||
{
|
||||
bool result = false;
|
||||
|
||||
/* 初始化应用服务,开始后台任务 */
|
||||
do { // instead of goto
|
||||
m_initStack.push(INIT_CORE_SERVICES_PHASE);
|
||||
result = InitializeCoreServices();
|
||||
|
|
@ -211,11 +214,13 @@ bool MOTEngine::Initialize()
|
|||
} else {
|
||||
MOT_LOG_PANIC("Startup: MOT Engine initialization failed!");
|
||||
// caller is expected to call DestroyInstance() after failure
|
||||
/* 调用方应在失败后调用DestroyInstance() */
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/* 销毁内存引擎实例 */
|
||||
void MOTEngine::Destroy()
|
||||
{
|
||||
MOT_LOG_INFO("Shutdown: Shutting down MOT Engine");
|
||||
|
|
|
|||
|
|
@ -61,6 +61,7 @@ typedef struct f_smgr {
|
|||
void (*smgr_move_buckets)(const RelFileNodeBackend &dest, const RelFileNodeBackend &src, List *bList);
|
||||
} f_smgr;
|
||||
|
||||
/* 文件管理函数列表,包含磁盘初始化、开关、同步等操作函数 */
|
||||
static const f_smgr smgrsw[] = {
|
||||
/* magnetic disk */
|
||||
{ mdinit,
|
||||
|
|
@ -146,10 +147,13 @@ static inline int ChooseSmgrManager(RelFileNode rnode)
|
|||
* case), *not* during postmaster start. Therefore, any resources created
|
||||
* here or destroyed in smgrshutdown are backend-local.
|
||||
*/
|
||||
/*
|
||||
* 存储管理初始化 *
|
||||
* 当服务器后端启动时调用 */
|
||||
void smgrinit(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
/* 初始化所有存储相关管理器 */
|
||||
for (i = 0; i < NSmgr; i++) {
|
||||
if (smgrsw[i].smgr_init) {
|
||||
(*(smgrsw[i].smgr_init))();
|
||||
|
|
@ -157,6 +161,7 @@ void smgrinit(void)
|
|||
}
|
||||
|
||||
/* register the shutdown proc */
|
||||
/* 登记存储管理终止程序 */
|
||||
if (!IS_THREAD_POOL_SESSION || EnableLocalSysCache()) {
|
||||
on_proc_exit(smgrshutdown, 0);
|
||||
}
|
||||
|
|
@ -167,6 +172,7 @@ void smgrinit(void)
|
|||
/*
|
||||
* on_proc_exit hook for smgr cleanup during backend shutdown
|
||||
*/
|
||||
/* 当后端服务关闭时,执行存储管理关闭代码 */
|
||||
void smgrshutdown(int code, Datum arg)
|
||||
{
|
||||
int i;
|
||||
|
|
|
|||
Loading…
Reference in New Issue