slave replay

Code Source From: Self Code
Description:  [Optional]
Jira:  #[Optional]
市场项目编号(名称):[Optional]
This commit is contained in:
shenzhengntu 2023-03-26 21:09:19 +08:00
parent 37ec5b24b4
commit e24c4f6fc9
3 changed files with 8 additions and 4 deletions

View File

@ -396,7 +396,7 @@ CleanLogIndexMain(int argc, char *argv[])
int hasData = 0;
pushStandbyPrePoint = pushStandbyPoint;
if (push_standby == true||EnableHotStandby == false) {
if (push_standby == true || EnableHotStandby == false) {
pushStandbyPoint = GetXLogPushToDisk();
if (pushStandbyPrePoint < pushStandbyPoint) {
hasData++;

View File

@ -5965,12 +5965,14 @@ ReadRecord(XLogReaderState *xlogreader, int emode,
/* This is the first attempt to read this page. */
lastSourceFailed = false;
#ifndef PG_NOREPLAY
if (push_standby == true && PushPtr == InvalidXLogRecPtr)
if ((push_standby == true || EnableHotStandby == false) &&
xlogreader->streamStart == true &&
PushPtr == InvalidXLogRecPtr)
{
PushPtr = xlogreader->EndRecPtr;
PrePushPtr = xlogreader->EndRecPtr;
ApplyLsn = PrePushPtr;
XLogCtl->pushToDisk = ApplyLsn;
//XLogCtl->pushToDisk = ApplyLsn;
}
#endif
for (;;)
@ -12125,6 +12127,8 @@ void xlog_redo(XLogReaderState *record)
{
CheckPointPtr = record->currRecPtr;
memcpy(&GlobalCheckPoint, XLogRecGetData(record), sizeof(CheckPoint));
// for recover checkpoint must be flush disk,so set GlobalCheckPoint.redo = CheckPointPtr is ok
GlobalCheckPoint.redo = CheckPointPtr;
GlobalState = DB_IN_ARCHIVE_RECOVERY;
}
#endif

View File

@ -722,7 +722,7 @@ restart:
#ifndef PG_NOREPLAY
if (IsBootstrapProcessingMode() != true && InitdbSingle!=true) {
if (getpid() == startupPid) {
if (push_standby == true||EnableHotStandby == false) {
if (push_standby == true || EnableHotStandby == false) {
// Update shared-memory status
XLogRecPtr prevPushPoint = PrePushPtr;
if (!XLogRecPtrIsInvalid(CheckPointPtr)) {