mirror of
https://gitee.com/he3db/he3pg.git
synced 2024-11-29 18:58:35 +08:00
fix:#I7D0PS
This commit is contained in:
commit
e7a0fbb0ed
@ -14587,8 +14587,8 @@ consumerXLogBatchRead(XLogReaderState *xlogreader, XLogRecPtr startPtr, int reqL
|
||||
}
|
||||
continue;
|
||||
} else {
|
||||
elog(LOG, "stream startPtr %X gt FirstData.startLsn %X, need clean wals which ge startPtr.",
|
||||
FirstData->startLsn,startPtr);
|
||||
elog(LOG, "stream FirstData.startLsn %X gt startPtr %X, need clean wals which ge startPtr.",
|
||||
FirstData->startLsn, startPtr);
|
||||
DelRangeWals(ThisTimeLineID, FirstData->startLsn, PG_UINT64_MAX);
|
||||
WalTaskImmediateFree();
|
||||
return -1;
|
||||
|
@ -1346,3 +1346,9 @@ FirstCallSinceLastCheckpoint(void)
|
||||
|
||||
return FirstCall;
|
||||
}
|
||||
|
||||
pid_t
|
||||
He3DBQueryCkpPid(void)
|
||||
{
|
||||
return CheckpointerShmem->checkpointer_pid;
|
||||
}
|
||||
|
@ -3156,7 +3156,7 @@ reaper(SIGNAL_ARGS)
|
||||
*/
|
||||
SignalChildren(SIGUSR2);
|
||||
|
||||
pmState = PM_SHUTDOWN_2;
|
||||
// pmState = PM_SHUTDOWN_2;
|
||||
|
||||
/*
|
||||
* We can also shut down the stats collector now; there's
|
||||
@ -3192,13 +3192,24 @@ reaper(SIGNAL_ARGS)
|
||||
continue;
|
||||
}
|
||||
|
||||
// if (pid == SecondBufferPID)
|
||||
// {
|
||||
// SecondBufferPID = 0;
|
||||
// if (!EXIT_STATUS_0(exitstatus))
|
||||
// HandleChildCrash(pid, exitstatus,
|
||||
// _("second buffer process"));
|
||||
// }
|
||||
if (pid == SecondBufferPID)
|
||||
{
|
||||
SecondBufferPID = 0;
|
||||
if (EXIT_STATUS_0(exitstatus) && pmState == PM_SHUTDOWN)
|
||||
{
|
||||
Assert(Shutdown > NoShutdown);
|
||||
pmState = PM_SHUTDOWN_2;
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Any unexpected exit of the checkpointer (including FATAL
|
||||
* exit) is treated as a crash.
|
||||
*/
|
||||
HandleChildCrash(pid, exitstatus,
|
||||
_("second buffer process"));
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Was it the wal receiver? If exit status is zero (normal) or one
|
||||
|
@ -1132,13 +1132,36 @@ MovePageFromSecondBufferToLocalBuffer()
|
||||
|
||||
LWLock *partitionLock = NULL;
|
||||
uint32 newHash;
|
||||
bool canShutDown = false;
|
||||
pid_t ckp_pid;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
// exit when postmaster stop
|
||||
ResetLatch(MyLatch);
|
||||
if (ShutdownRequestPending)
|
||||
proc_exit(0);
|
||||
{
|
||||
if (canShutDown)
|
||||
proc_exit(0);
|
||||
|
||||
ckp_pid = He3DBQueryCkpPid();
|
||||
if (ckp_pid == 0)
|
||||
canShutDown = true;
|
||||
|
||||
if (kill(ckp_pid, 0) == -1)
|
||||
{
|
||||
if (errno == ESRCH)
|
||||
{
|
||||
elog(LOG, "checkpoint process is shutdown, we can shutdown secondbuffer process after flush all buffer into lmdb");
|
||||
canShutDown = true;
|
||||
}
|
||||
else
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_INTERNAL_ERROR),
|
||||
errmsg("could not check the existence of the backend with PID %d: %m",
|
||||
ckp_pid)));
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < SDNUM; i ++)
|
||||
{
|
||||
|
@ -822,7 +822,7 @@ int he3db_mdread_pagexlog(SMgrRelation reln, ForkNumber forknum, BlockNumber blo
|
||||
nbytes, BLCKSZ)));
|
||||
}
|
||||
|
||||
if (push_standby)
|
||||
if (push_standby || !EnableHotStandby || *isPromoteIsTriggered)
|
||||
{
|
||||
return nbytes;
|
||||
}
|
||||
|
@ -803,7 +803,7 @@ smgrtruncatelsn(SMgrRelation reln, ForkNumber *forknum, int nforks, BlockNumber
|
||||
sleep(1);
|
||||
minApplyLsn = He3DBQueryMinLsnFromAllStanby();
|
||||
printf("====pushlsn=%lx==lsn==%lx==\n",minApplyLsn,lsn);
|
||||
} while(minApplyLsn!=InvalidXLogRecPtr && minApplyLsn<lsn);
|
||||
} while(minApplyLsn<lsn);
|
||||
flag = true;
|
||||
}
|
||||
}
|
||||
|
@ -41,5 +41,6 @@ extern Size CheckpointerShmemSize(void);
|
||||
extern void CheckpointerShmemInit(void);
|
||||
|
||||
extern bool FirstCallSinceLastCheckpoint(void);
|
||||
extern pid_t He3DBQueryCkpPid(void);
|
||||
|
||||
#endif /* _BGWRITER_H */
|
||||
|
Loading…
Reference in New Issue
Block a user