mirror of
https://gitee.com/he3db/he3pg.git
synced 2024-12-03 12:47:34 +08:00
!107 slave replay
Merge pull request !107 from shenzhengntu/dev_performance
This commit is contained in:
commit
9de3e139af
@ -257,6 +257,7 @@ static pid_t StartupPID = 0,
|
||||
AutoVacPID = 0,
|
||||
PgArchPID = 0,
|
||||
PgStatPID = 0,
|
||||
CleanLogIndexPID = 0,
|
||||
SysLoggerPID = 0;
|
||||
|
||||
/* Startup process's status */
|
||||
@ -565,6 +566,8 @@ static void ShmemBackendArrayRemove(Backend *bn);
|
||||
#define StartCheckpointer() StartChildProcess(CheckpointerProcess)
|
||||
#define StartWalWriter() StartChildProcess(WalWriterProcess)
|
||||
#define StartWalReceiver() StartChildProcess(WalReceiverProcess)
|
||||
#define StartCleanLogIndex() StartChildProcess(CleanLogIndexProcess)
|
||||
|
||||
/* Macros to check exit status of a child process */
|
||||
#define EXIT_STATUS_0(st) ((st) == 0)
|
||||
#define EXIT_STATUS_1(st) (WIFEXITED(st) && WEXITSTATUS(st) == 1)
|
||||
@ -1777,6 +1780,8 @@ ServerLoop(void)
|
||||
CheckpointerPID = StartCheckpointer();
|
||||
if (BgWriterPID == 0)
|
||||
BgWriterPID = StartBackgroundWriter();
|
||||
if (CleanLogIndexPID == 0)
|
||||
CleanLogIndexPID = StartCleanLogIndex();
|
||||
}
|
||||
|
||||
/*
|
||||
@ -2738,6 +2743,8 @@ SIGHUP_handler(SIGNAL_ARGS)
|
||||
signal_child(SysLoggerPID, SIGHUP);
|
||||
if (PgStatPID != 0)
|
||||
signal_child(PgStatPID, SIGHUP);
|
||||
if (CleanLogIndexPID != 0 )
|
||||
signal_child(CleanLogIndexPID, SIGHUP);
|
||||
|
||||
/* Reload authentication config files too */
|
||||
if (!load_hba())
|
||||
@ -3057,6 +3064,8 @@ reaper(SIGNAL_ARGS)
|
||||
BgWriterPID = StartBackgroundWriter();
|
||||
if (WalWriterPID == 0)
|
||||
WalWriterPID = StartWalWriter();
|
||||
if (CleanLogIndexPID == 0)
|
||||
CleanLogIndexPID = StartCleanLogIndex();
|
||||
|
||||
/*
|
||||
* Likewise, start other special children as needed. In a restart
|
||||
@ -3697,6 +3706,17 @@ HandleChildCrash(int pid, int exitstatus, const char *procname)
|
||||
signal_child(PgStatPID, SIGQUIT);
|
||||
allow_immediate_pgstat_restart();
|
||||
}
|
||||
/* Take care of the clean logindex too */
|
||||
if (pid == CleanLogIndexPID)
|
||||
CleanLogIndexPID = 0;
|
||||
else if (CleanLogIndexPID != 0 && take_action)
|
||||
{
|
||||
ereport(DEBUG2,
|
||||
(errmsg_internal("sending %s to process %d",
|
||||
(SendStop ? "SIGSTOP" : "SIGQUIT"),
|
||||
(int) CleanLogIndexPID)));
|
||||
signal_child(CleanLogIndexPID, (SendStop ? SIGSTOP : SIGQUIT));
|
||||
}
|
||||
|
||||
/* We do NOT restart the syslogger */
|
||||
|
||||
@ -3845,6 +3865,8 @@ PostmasterStateMachine(void)
|
||||
signal_child(StartupPID, SIGTERM);
|
||||
if (WalReceiverPID != 0)
|
||||
signal_child(WalReceiverPID, SIGTERM);
|
||||
if (CleanLogIndexPID != 0)
|
||||
signal_child(CleanLogIndexPID, SIGTERM);
|
||||
/* checkpointer, archiver, stats, and syslogger may continue for now */
|
||||
|
||||
|
||||
@ -4183,6 +4205,8 @@ TerminateChildren(int signal)
|
||||
signal_child(PgArchPID, signal);
|
||||
if (PgStatPID != 0)
|
||||
signal_child(PgStatPID, signal);
|
||||
if (CleanLogIndexPID !=0)
|
||||
signal_child(CleanLogIndexPID, signal);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -5311,6 +5335,12 @@ sigusr1_handler(SIGNAL_ARGS)
|
||||
StartALLPageFlushWorker();
|
||||
}
|
||||
|
||||
if (CheckPostmasterSignal(PMSIGNAL_CLEAN_LOGINDEX_WORKER)) {
|
||||
if ( CleanLogIndexPID == 0) {
|
||||
CleanLogIndexPID = StartCleanLogIndex();
|
||||
}
|
||||
}
|
||||
|
||||
if (CheckPostmasterSignal(PMSIGNAL_START_WALRECEIVER))
|
||||
{
|
||||
/* Startup Process wants us to start the walreceiver process. */
|
||||
|
@ -244,9 +244,11 @@ StartupProcessMain(void)
|
||||
//start flushWork
|
||||
#ifndef PG_NOREPLAY
|
||||
if (IsBootstrapProcessingMode() != true && InitdbSingle!=true) {
|
||||
if (push_standby == true) {
|
||||
//if (push_standby == true) {
|
||||
SignalStartFlushWork();
|
||||
}
|
||||
//}
|
||||
pg_usleep(1000);
|
||||
SignalStartCleanLogIndexWork();
|
||||
ResourceOwnerEnlargeBuffers(CurrentResourceOwner);
|
||||
}
|
||||
#endif
|
||||
|
@ -593,7 +593,8 @@ TagNode *GetBufTagByLsnRange(XLogRecPtr start_lsn, XLogRecPtr end_lsn)
|
||||
head_node = InitTagNode();
|
||||
LWLockAcquire(LogIndexMemListLock,LW_SHARED);
|
||||
tbl_index = log_index_mem_list->table_start_index;
|
||||
while(tbl_index != log_index_mem_list->active_table_index)
|
||||
uint64 active_index_next = (log_index_mem_list->active_table_index+1)%(log_index_mem_list->table_cap);
|
||||
while(tbl_index != active_index_next)
|
||||
{
|
||||
LogIndexMemTBL *mem_tbl = &(log_index_mem_list->mem_table[tbl_index]);
|
||||
tbl_index = (tbl_index + 1)%(log_index_mem_list->table_cap);
|
||||
|
Loading…
Reference in New Issue
Block a user