forked from huawei/openGauss-server
进一步完善对将要发送的lsn的合法性校验
This commit is contained in:
parent
e54711814b
commit
7be46e0e8c
|
|
@ -682,9 +682,10 @@ static void pgarch_ArchiverObsCopyLoop(XLogRecPtr flushPtr, doArchive fun)
|
|||
* setting for archive_command as soon as possible, even if there
|
||||
* is a backlog of files to be archived.
|
||||
*/
|
||||
ReplicationSlot* slot = getObsReplicationSlot();
|
||||
if (t_thrd.arch.got_SIGHUP) {
|
||||
ProcessConfigFile(PGC_SIGHUP);
|
||||
if (getObsReplicationSlot() == NULL) {
|
||||
if (slot == NULL) {
|
||||
return;
|
||||
}
|
||||
t_thrd.arch.got_SIGHUP = false;
|
||||
|
|
@ -703,6 +704,14 @@ static void pgarch_ArchiverObsCopyLoop(XLogRecPtr flushPtr, doArchive fun)
|
|||
targetLsn = Min(targetLsn + size, flushPtr);
|
||||
}
|
||||
|
||||
if (targetLsn < slot->data.restart_lsn) {
|
||||
ereport(ERROR,
|
||||
(errmsg("transaction log file \"%X/%X\" is invalid,"
|
||||
"it should be larger than the restart_lsn \"%X/%X\" of slot.",
|
||||
(uint32)(targetLsn >> 32), (uint32)(targetLsn),
|
||||
(uint32)(slot->data.restart_lsn >> 32), (uint32)(slot->data.restart_lsn))));
|
||||
}
|
||||
|
||||
if (!XlogFileIsExisted(t_thrd.proc_cxt.DataDir, targetLsn, DEFAULT_TIMELINE_ID)) {
|
||||
ereport(WARNING,
|
||||
(errmsg("transaction log file \"%X/%X\" does not existed, it may be archived by the old primary.",
|
||||
|
|
|
|||
|
|
@ -732,6 +732,10 @@ static void SyncRepGetOldestSyncRecPtr(XLogRecPtr* receivePtr, XLogRecPtr* write
|
|||
XLogRecPtr apply;
|
||||
|
||||
SpinLockAcquire(&walsnd->mutex);
|
||||
if (walsnd == NULL || walsnd->pid == 0) {
|
||||
SpinLockRelease(&walsnd->mutex);
|
||||
continue;
|
||||
}
|
||||
receive = walsnd->receive;
|
||||
write = walsnd->write;
|
||||
flush = walsnd->flush;
|
||||
|
|
@ -774,6 +778,10 @@ static void SyncRepGetNthLatestSyncRecPtr(XLogRecPtr* receivePtr, XLogRecPtr* wr
|
|||
WalSnd* walsnd = &t_thrd.walsender_cxt.WalSndCtl->walsnds[lfirst_int(cell)];
|
||||
|
||||
SpinLockAcquire(&walsnd->mutex);
|
||||
if (walsnd == NULL || walsnd->pid == 0) {
|
||||
SpinLockRelease(&walsnd->mutex);
|
||||
continue;
|
||||
}
|
||||
receive_array[i] = walsnd->receive;
|
||||
write_array[i] = walsnd->write;
|
||||
flush_array[i] = walsnd->flush;
|
||||
|
|
|
|||
Loading…
Reference in New Issue