standby build按照min recovery 和read的位置中大的位置来获取日志

Offering: openGaussDev

More detail: standby build按照min recovery 和read的位置中大的位置来获取日志

Match-id-284d40865b0eceea3afa77e4ab177d70be60f2a8
This commit is contained in:
openGaussDev 2022-03-09 00:36:12 +08:00 committed by yanghao
parent 0c08e764e0
commit 5547cd8c86
1 changed files with 11 additions and 0 deletions

View File

@ -14644,12 +14644,23 @@ XLogRecPtr StandbyDoStopBackup(char *labelfile)
}
startPoint = (((uint64)hi) << 32) | lo;
remaining = strchr(labelfile, '\n') + 1; /* %n is not portable enough */
XLogRecPtr minRecoveryPoint;
LWLockAcquire(ControlFileLock, LW_SHARED);
stopPoint = t_thrd.shemem_ptr_cxt.ControlFile->checkPointCopy.redo;
minRecoveryPoint = t_thrd.shemem_ptr_cxt.ControlFile->minRecoveryPoint;
LWLockRelease(ControlFileLock);
if (XLByteLE(stopPoint, startPoint)) {
stopPoint = GetXLogReplayRecPtr(NULL);
}
if (XLByteLT(stopPoint, minRecoveryPoint)) {
stopPoint = minRecoveryPoint;
}
if (XLByteLT(stopPoint, g_instance.comm_cxt.predo_cxt.redoPf.read_ptr)) {
stopPoint = g_instance.comm_cxt.predo_cxt.redoPf.read_ptr;
}
return stopPoint;
}