解决按需回放实时构建下,主机redo点位发送错误的问题

This commit is contained in:
chendong76
2024-08-27 17:46:50 +08:00
parent 0395785831
commit 47dcde3ed7
2 changed files with 12 additions and 2 deletions

View File

@ -2225,7 +2225,7 @@ int CBDoCheckpointImmediately(unsigned long long *ckpt_lsn)
Assert(SS_PRIMARY_MODE);
RequestCheckpoint(CHECKPOINT_IMMEDIATE | CHECKPOINT_WAIT);
*ckpt_lsn = (unsigned long long)t_thrd.shemem_ptr_cxt.ControlFile->checkPoint;
*ckpt_lsn = (unsigned long long)t_thrd.shemem_ptr_cxt.ControlFile->checkPointCopy.redo;
return GS_SUCCESS;
}

View File

@ -657,9 +657,19 @@ void OnDemandWaitRealtimeBuildShutDown()
ondemand_extreme_rto::WaitRealtimeBuildShutdown();
}
// only used in ondemand realtime build, for update xlog redo loc in failover
void OnDemandUpdateRealtimeBuildPrunePtr()
{
ondemand_extreme_rto::UpdateCheckpointRedoPtrForPrune(t_thrd.shemem_ptr_cxt.ControlFile->checkPointCopy.redo);
XLogRecPtr primaryRedoLsn = t_thrd.shemem_ptr_cxt.ControlFile->checkPointCopy.redo;
#ifdef USE_ASSERT_CHECKING
if (XLByteLT(primaryRedoLsn, ondemand_extreme_rto::g_dispatcher->ckptRedoPtr)) {
ereport(PANIC, (errmodule(MOD_DMS), errmsg("[SS][On-demand] redo loc %X/%X in primary node %d is less than "
"realtime build node %d, prune loc %X/%X", (uint32)(primaryRedoLsn >> 32), (uint32)primaryRedoLsn,
SS_PRIMARY_ID, SS_MY_INST_ID, (uint32)(ondemand_extreme_rto::g_dispatcher->ckptRedoPtr >> 32),
(uint32)ondemand_extreme_rto::g_dispatcher->ckptRedoPtr)));
}
#endif
ondemand_extreme_rto::UpdateCheckpointRedoPtrForPrune(primaryRedoLsn);
}
void OnDemandBackupControlFile(ControlFileData* controlFile) {