PostgreSQL启动恢复通过checkpoint open wal文件

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了PostgreSQL启动恢复通过checkpoint open wal文件相关的知识,希望对你有一定的参考价值。

StartupLOG::
->record = ReadCheckpointRecord(xlogreader, ControlFile->checkPoint, 1, true)
->record = ReadRecord(xlogreader, ControlFile->checkPoint, LOG, true)
->record = XLogReadRecord(xlogreader, ControlFile->checkPoint, &errormsg);
->readOff = ReadPageInternal(state,ControlFile->checkPoint - (ControlFile->checkPoint % XLOG_BLCKSZ), Min(ontrolFile->checkPoint % XLOG_BLCKSZ + SizeOfXLogRecord, XLOG_BLCKSZ));
->|--pageptr=ControlFile->checkPoint - (ControlFile->checkPoint % XLOG_BLCKSZ)
  |--targetPageOff = (pageptr % XLogSegSize);//段文件偏移
  |--targetSegmentPtr = pageptr - targetPageOff;
  |--readLen = state->read_page(state, targetSegmentPtr(0?), XLOG_BLCKSZ,ControlFile->checkPoint, state->readBuf, &state->readPageTLI);
->WaitForWALToBecomeAvailable(targetSegmentPtr(0?) + XLOG_BLCKSZ,private->randAccess,1,targetRecPtr)
->readFile = XLogFileReadAnyTLI(targetSegmentPtr/XLogSegSize, DEBUG2,currentSource == XLOG_FROM_ARCHIVE ? XLOG_FROM_ANY :currentSource)
->fd = XLogFileRead(segno, emode, tli,XLOG_FROM_ARCHIVE或者XLOG_FROM_PG_WAL, true)
->fd = BasicOpenFile(path, O_RDONLY | PG_BINARY, 0);
->fd = open(fileName, fileFlags, fileMode)

以上是关于PostgreSQL启动恢复通过checkpoint open wal文件的主要内容,如果未能解决你的问题,请参考以下文章

PostgreSQL启动恢复期间,恢复到的时间线的确定

PostgreSQL启动恢复流程框架

PostgreSQL启动恢复读取checkpoint记录失败的条件

从数据库启动日志看PostgreSQL的崩溃恢复

mysql 之 checkpoint和LSN详解

PostgreSQL 免费公开课(第14期)(CUUG)(2020年)