forked from huawei/openGauss-server
!122 set openGauss thread name and add getting function of t_thrd and u_sess
Merge pull request !122 from chenxiaobin/master
This commit is contained in:
commit
cb2ed43867
|
|
@ -199,7 +199,7 @@ void BootStrapProcessMain(int argc, char* argv[])
|
|||
*/
|
||||
srandom((unsigned int)(t_thrd.proc_cxt.MyProcPid ^ (unsigned int)t_thrd.proc_cxt.MyStartTime));
|
||||
|
||||
t_thrd.proc_cxt.MyProgName = "BootStrap";
|
||||
knl_thread_set_name("BootStrap");
|
||||
/*
|
||||
* Fire up essential subsystems: error and memory management
|
||||
*
|
||||
|
|
|
|||
|
|
@ -9529,13 +9529,13 @@ void commSenderFlowMain()
|
|||
/* reset MyProcPid */
|
||||
t_thrd.proc_cxt.MyProcPid = gs_thread_self();
|
||||
|
||||
t_thrd.proc_cxt.MyProgName = "CommSenderFlowerWorker";
|
||||
knl_thread_set_name("CommSendStream");
|
||||
|
||||
/* record Start Time for logging */
|
||||
t_thrd.proc_cxt.MyStartTime = time(NULL);
|
||||
|
||||
/* Identify myself via ps */
|
||||
init_ps_display("comm sender flower worker process", "", "", "");
|
||||
init_ps_display("CommSendStream worker process", "", "", "");
|
||||
|
||||
/* setup signal process hook */
|
||||
SetupCommSignalHook();
|
||||
|
|
@ -9548,7 +9548,7 @@ void commSenderFlowMain()
|
|||
|
||||
t_thrd.comm_cxt.g_libcomm_poller_list =
|
||||
g_instance.comm_cxt.pollers_cxt.g_s_poller_list->get_poller(); // get poller for monitoring network events
|
||||
LIBCOMM_ELOG(LOG, "Sender flow control thread is initialized.");
|
||||
LIBCOMM_ELOG(LOG, "CommSendStream thread is initialized.");
|
||||
|
||||
sigjmp_buf local_sigjmp_buf;
|
||||
int curTryCounter;
|
||||
|
|
@ -9613,13 +9613,13 @@ void commReceiverFlowMain()
|
|||
/* reset MyProcPid */
|
||||
t_thrd.proc_cxt.MyProcPid = gs_thread_self();
|
||||
|
||||
t_thrd.proc_cxt.MyProgName = "CommReceiverFlowerWorker";
|
||||
knl_thread_set_name("CommRcvStream");
|
||||
|
||||
/* record Start Time for logging */
|
||||
t_thrd.proc_cxt.MyStartTime = time(NULL);
|
||||
|
||||
/* Identify myself via ps */
|
||||
init_ps_display("comm receiver flower worker process", "", "", "");
|
||||
init_ps_display("CommRcvStream worker process", "", "", "");
|
||||
|
||||
/* setup signal process hook */
|
||||
SetupCommSignalHook();
|
||||
|
|
@ -9651,7 +9651,7 @@ void commReceiverFlowMain()
|
|||
}
|
||||
LIBCOMM_PTHREAD_MUTEX_UNLOCK(g_instance.comm_cxt.pollers_cxt.g_r_poller_list_lock);
|
||||
|
||||
LIBCOMM_ELOG(LOG, "Receiver flow control thread is initialized, ready to accept on socket[%d].", ltk);
|
||||
LIBCOMM_ELOG(LOG, "CommRcvStream thread is initialized, ready to accept on socket[%d].", ltk);
|
||||
|
||||
sigjmp_buf local_sigjmp_buf;
|
||||
int curTryCounter;
|
||||
|
|
@ -9712,13 +9712,13 @@ void commAuxiliaryMain()
|
|||
/* reset MyProcPid */
|
||||
t_thrd.proc_cxt.MyProcPid = gs_thread_self();
|
||||
|
||||
t_thrd.proc_cxt.MyProgName = "CommAuxiliaryFlowerWorker";
|
||||
knl_thread_set_name("CommAuxStream");
|
||||
|
||||
/* record Start Time for logging */
|
||||
t_thrd.proc_cxt.MyStartTime = time(NULL);
|
||||
|
||||
/* Identify myself via ps */
|
||||
init_ps_display("comm auxiliary worker process", "", "", "");
|
||||
init_ps_display("CommAuxStream worker process", "", "", "");
|
||||
|
||||
/* setup signal process hook */
|
||||
SetupCommSignalHook();
|
||||
|
|
@ -9732,7 +9732,7 @@ void commAuxiliaryMain()
|
|||
uint64 last_print_time;
|
||||
last_print_time = mc_timers_ms();
|
||||
|
||||
LIBCOMM_ELOG(LOG, "Receiver flow control auxiliary thread is initialized.");
|
||||
LIBCOMM_ELOG(LOG, "CommAuxStream thread is initialized.");
|
||||
|
||||
sigjmp_buf local_sigjmp_buf;
|
||||
int curTryCounter;
|
||||
|
|
@ -9792,13 +9792,13 @@ void init_clean_pooler_idle_connections()
|
|||
/* reset t_thrd.proc_cxt.MyProcPid */
|
||||
t_thrd.proc_cxt.MyProcPid = gs_thread_self();
|
||||
|
||||
t_thrd.proc_cxt.MyProgName = "commPoolerCleaner";
|
||||
knl_thread_set_name("CommPoolCleaner");
|
||||
|
||||
/* record Start Time for logging */
|
||||
t_thrd.proc_cxt.MyStartTime = time(NULL);
|
||||
|
||||
/* Identify myself via ps */
|
||||
init_ps_display("pooler cleaner process", "", "", "");
|
||||
init_ps_display("CommPoolCleaner process", "", "", "");
|
||||
|
||||
/* set processing mode */
|
||||
SetProcessingMode(InitProcessing);
|
||||
|
|
@ -9933,13 +9933,13 @@ void commReceiverMain(void* tid_callback)
|
|||
/* reset MyProcPid */
|
||||
t_thrd.proc_cxt.MyProcPid = gs_thread_self();
|
||||
|
||||
t_thrd.proc_cxt.MyProgName = "CommReceiverWorker";
|
||||
knl_thread_set_name("CommRcvWorker");
|
||||
|
||||
/* record Start Time for logging */
|
||||
t_thrd.proc_cxt.MyStartTime = time(NULL);
|
||||
|
||||
/* Identify myself via ps */
|
||||
init_ps_display("comm receiver worker process", "", "", "");
|
||||
init_ps_display("CommRcvWorker process", "", "", "");
|
||||
|
||||
/* setup signal process hook */
|
||||
SetupCommSignalHook();
|
||||
|
|
@ -9960,7 +9960,7 @@ void commReceiverMain(void* tid_callback)
|
|||
&g_instance.comm_cxt.pollers_cxt.g_libcomm_receiver_poller_list[selfid];
|
||||
LIBCOMM_PTHREAD_MUTEX_UNLOCK(g_instance.comm_cxt.pollers_cxt.g_r_libcomm_poller_list_lock);
|
||||
|
||||
LIBCOMM_ELOG(LOG, "Receiver data receiving thread[%d] is initialized.", selfid + 1);
|
||||
LIBCOMM_ELOG(LOG, "CommRcvWorker thread[%d] is initialized.", selfid + 1);
|
||||
|
||||
sigjmp_buf local_sigjmp_buf;
|
||||
int curTryCounter;
|
||||
|
|
|
|||
|
|
@ -154,14 +154,14 @@ NON_EXEC_STATIC void PercentileMain()
|
|||
t_thrd.proc_cxt.MyProcPid = gs_thread_self();
|
||||
/* record Start Time for logging */
|
||||
t_thrd.proc_cxt.MyStartTime = time(NULL);
|
||||
t_thrd.proc_cxt.MyProgName = "getpercentile";
|
||||
knl_thread_set_name("PercentileJob");
|
||||
if (u_sess->proc_cxt.MyProcPort->remote_host) {
|
||||
pfree(u_sess->proc_cxt.MyProcPort->remote_host);
|
||||
}
|
||||
u_sess->proc_cxt.MyProcPort->remote_host = pstrdup("localhost");
|
||||
u_sess->attr.attr_common.application_name = pstrdup("PercentileJob");
|
||||
/* Identify myself via ps */
|
||||
init_ps_display("instrumention percentile process", "", "", "");
|
||||
init_ps_display("PercentileJob process", "", "", "");
|
||||
SetProcessingMode(InitProcessing);
|
||||
PercentileSpace::init_gspqsignal();
|
||||
/* Early initialization */
|
||||
|
|
|
|||
|
|
@ -1353,7 +1353,7 @@ static void SetMyproc()
|
|||
/* record Start Time for logging */
|
||||
t_thrd.proc_cxt.MyStartTime = time(NULL);
|
||||
|
||||
t_thrd.proc_cxt.MyProgName = "WDRSnapshot";
|
||||
knl_thread_set_name("WDRSnapshot");
|
||||
u_sess->attr.attr_common.application_name = pstrdup("WDRSnapshot");
|
||||
}
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -1795,7 +1795,7 @@ static void NormalBackendInit()
|
|||
/* record Start Time for logging */
|
||||
t_thrd.proc_cxt.MyStartTime = time(NULL);
|
||||
|
||||
t_thrd.proc_cxt.MyProgName = "CPmonitor";
|
||||
knl_thread_set_name("CpMonitor");
|
||||
|
||||
if (u_sess->proc_cxt.MyProcPort->remote_host) {
|
||||
pfree(u_sess->proc_cxt.MyProcPort->remote_host);
|
||||
|
|
@ -1804,7 +1804,7 @@ static void NormalBackendInit()
|
|||
u_sess->proc_cxt.MyProcPort->remote_host = pstrdup("localhost");
|
||||
|
||||
/* Identify myself via ps */
|
||||
init_ps_display("compute pool monitor process", "", "", "");
|
||||
init_ps_display("CpMonitor process", "", "", "");
|
||||
|
||||
/* release all connections on exit. */
|
||||
if (IS_PGXC_COORDINATOR && IsPostmasterEnvironment) {
|
||||
|
|
|
|||
|
|
@ -1104,7 +1104,7 @@ NON_EXEC_STATIC void WLMmonitorMain(void)
|
|||
/* record Start Time for logging */
|
||||
t_thrd.proc_cxt.MyStartTime = time(NULL);
|
||||
|
||||
t_thrd.proc_cxt.MyProgName = "WLMmonitor";
|
||||
knl_thread_set_name("WlmMonitor");
|
||||
|
||||
if (u_sess->proc_cxt.MyProcPort->remote_host) {
|
||||
pfree(u_sess->proc_cxt.MyProcPort->remote_host);
|
||||
|
|
@ -1113,7 +1113,7 @@ NON_EXEC_STATIC void WLMmonitorMain(void)
|
|||
u_sess->proc_cxt.MyProcPort->remote_host = pstrdup("localhost");
|
||||
|
||||
/* Identify myself via ps */
|
||||
init_ps_display("wlm monitor worker process", "", "", "");
|
||||
init_ps_display("WlmMonitor worker process", "", "", "");
|
||||
|
||||
SetProcessingMode(InitProcessing);
|
||||
|
||||
|
|
@ -1278,7 +1278,7 @@ NON_EXEC_STATIC void WLMmonitorMain(void)
|
|||
/* wait until g_statManager is available */
|
||||
while (!WLMIsInfoInit()) {
|
||||
if (t_thrd.wlm_cxt.wlm_got_sigterm) {
|
||||
ereport(LOG, (errmsg("WLMmonitor thread exit!")));
|
||||
ereport(LOG, (errmsg("WlmMonitor thread exit!")));
|
||||
t_thrd.wlm_cxt.wlm_got_sigterm = false;
|
||||
proc_exit(0);
|
||||
}
|
||||
|
|
@ -1288,7 +1288,7 @@ NON_EXEC_STATIC void WLMmonitorMain(void)
|
|||
/*
|
||||
* Identify myself via ps
|
||||
*/
|
||||
ereport(LOG, (errmsg("WLMmonitor thread is starting up.")));
|
||||
ereport(LOG, (errmsg("WlmMonitor thread is starting up.")));
|
||||
|
||||
// initialize thread
|
||||
WLMmonitor_init();
|
||||
|
|
@ -1411,7 +1411,7 @@ NON_EXEC_STATIC void WLMarbiterMain(void)
|
|||
/* record Start Time for logging */
|
||||
t_thrd.proc_cxt.MyStartTime = time(NULL);
|
||||
|
||||
t_thrd.proc_cxt.MyProgName = "WLMarbiter";
|
||||
knl_thread_set_name("WlmArbiter");
|
||||
|
||||
if (u_sess->proc_cxt.MyProcPort->remote_host != NULL) {
|
||||
pfree(u_sess->proc_cxt.MyProcPort->remote_host);
|
||||
|
|
@ -1420,7 +1420,7 @@ NON_EXEC_STATIC void WLMarbiterMain(void)
|
|||
u_sess->proc_cxt.MyProcPort->remote_host = pstrdup("localhost");
|
||||
|
||||
/* Identify myself via ps */
|
||||
init_ps_display("wlm arbiter worker process", "", "", "");
|
||||
init_ps_display("WlmArbiter worker process", "", "", "");
|
||||
|
||||
SetProcessingMode(InitProcessing);
|
||||
|
||||
|
|
@ -1586,7 +1586,7 @@ NON_EXEC_STATIC void WLMarbiterMain(void)
|
|||
/* wait until g_statManager is available */
|
||||
while (!WLMIsInfoInit()) {
|
||||
if (t_thrd.wlm_cxt.wlm_got_sigterm) {
|
||||
ereport(LOG, (errmsg("WLMarbiter thread exit!")));
|
||||
ereport(LOG, (errmsg("WlmArbiter thread exit!")));
|
||||
t_thrd.wlm_cxt.wlm_got_sigterm = false;
|
||||
proc_exit(0);
|
||||
}
|
||||
|
|
@ -1596,7 +1596,7 @@ NON_EXEC_STATIC void WLMarbiterMain(void)
|
|||
/*
|
||||
* Identify myself via ps
|
||||
*/
|
||||
ereport(LOG, (errmsg("WLMarbiter thread is starting up.")));
|
||||
ereport(LOG, (errmsg("WlmArbiter thread is starting up.")));
|
||||
|
||||
// main loop of the thread
|
||||
WLMarbiter_MainLoop();
|
||||
|
|
|
|||
|
|
@ -7495,7 +7495,7 @@ int WLMProcessThreadMain(void)
|
|||
/* record Start Time for logging */
|
||||
t_thrd.proc_cxt.MyStartTime = time(NULL);
|
||||
|
||||
t_thrd.proc_cxt.MyProgName = "WLMCollectWorker";
|
||||
knl_thread_set_name("WlmCollector");
|
||||
|
||||
if (u_sess->proc_cxt.MyProcPort->remote_host) {
|
||||
pfree(u_sess->proc_cxt.MyProcPort->remote_host);
|
||||
|
|
@ -7504,7 +7504,7 @@ int WLMProcessThreadMain(void)
|
|||
u_sess->proc_cxt.MyProcPort->remote_host = pstrdup("localhost");
|
||||
|
||||
/* Identify myself via ps */
|
||||
init_ps_display("wlm collect worker process", "", "", "");
|
||||
init_ps_display("WlmCollector worker process", "", "", "");
|
||||
|
||||
SetProcessingMode(InitProcessing);
|
||||
|
||||
|
|
@ -7665,7 +7665,7 @@ int WLMProcessThreadMain(void)
|
|||
/* init transaction to execute query */
|
||||
WLMInitTransaction(&backinit);
|
||||
|
||||
ereport(LOG, (errmsg("process wlm thread starting up.")));
|
||||
ereport(LOG, (errmsg("WlmCollector thread starting up.")));
|
||||
|
||||
/* build user info and resource pool hash table if does not exist */
|
||||
if (!g_instance.wlm_cxt->stat_manager.infoinit) {
|
||||
|
|
@ -7891,7 +7891,7 @@ int WLMProcessThreadMain(void)
|
|||
|
||||
backinit = false;
|
||||
|
||||
ereport(DEBUG1, (errmsg("exit wlm worker thread!")));
|
||||
ereport(DEBUG1, (errmsg("exit WlmCollector thread!")));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -122,14 +122,14 @@ NON_EXEC_STATIC void JobScheduleMain()
|
|||
/* reset t_thrd.proc_cxt.MyProcPid */
|
||||
t_thrd.proc_cxt.MyProcPid = gs_thread_self();
|
||||
|
||||
t_thrd.proc_cxt.MyProgName = "JobScheduler";
|
||||
knl_thread_set_name("JobScheduler");
|
||||
u_sess->attr.attr_common.application_name = pstrdup("JobScheduler");
|
||||
|
||||
/* record Start Time for logging */
|
||||
t_thrd.proc_cxt.MyStartTime = time(NULL);
|
||||
|
||||
/* Identify myself via ps */
|
||||
init_ps_display("job scheduler process", "", "", "");
|
||||
init_ps_display("JobScheduler process", "", "", "");
|
||||
|
||||
elog(LOG, "job scheduler started");
|
||||
|
||||
|
|
@ -303,7 +303,7 @@ NON_EXEC_STATIC void JobScheduleMain()
|
|||
|
||||
if (t_thrd.job_cxt.got_SIGTERM) {
|
||||
/* Normal exit */
|
||||
ereport(LOG, (errmsg("job scheduler is shutting down")));
|
||||
ereport(LOG, (errmsg("JobScheduler is shutting down")));
|
||||
|
||||
t_thrd.job_cxt.JobScheduleShmem->jsch_pid = 0;
|
||||
|
||||
|
|
@ -359,7 +359,7 @@ NON_EXEC_STATIC void JobScheduleMain()
|
|||
* necessity for manual cleanup of all postmaster children.
|
||||
*/
|
||||
if ((unsigned int)ret & WL_POSTMASTER_DEATH) {
|
||||
elog(LOG, "Job scheduler shutting down with exit code 1");
|
||||
elog(LOG, "JobScheduler shutting down with exit code 1");
|
||||
proc_exit(1);
|
||||
}
|
||||
|
||||
|
|
@ -463,7 +463,7 @@ NON_EXEC_STATIC void JobScheduleMain()
|
|||
}
|
||||
|
||||
/* Normal exit */
|
||||
ereport(LOG, (errmsg("job scheduler is shutting down")));
|
||||
ereport(LOG, (errmsg("JobScheduler is shutting down")));
|
||||
|
||||
t_thrd.job_cxt.JobScheduleShmem->jsch_pid = 0;
|
||||
|
||||
|
|
|
|||
|
|
@ -161,13 +161,13 @@ void JobExecuteWorkerMain()
|
|||
/* reset t_thrd.proc_cxt.MyProcPid */
|
||||
t_thrd.proc_cxt.MyProcPid = gs_thread_self();
|
||||
|
||||
t_thrd.proc_cxt.MyProgName = "JobExecuteWorker";
|
||||
knl_thread_set_name("JobExecutor");
|
||||
|
||||
/* record Start Time for logging */
|
||||
t_thrd.proc_cxt.MyStartTime = time(NULL);
|
||||
|
||||
/* Identify myself via ps */
|
||||
init_ps_display("Job worker process", "", "", "");
|
||||
init_ps_display("JobExecutor worker process", "", "", "");
|
||||
|
||||
/* set processing mode */
|
||||
SetProcessingMode(InitProcessing);
|
||||
|
|
@ -220,7 +220,7 @@ void JobExecuteWorkerMain()
|
|||
EmitErrorReport();
|
||||
|
||||
if (job_id > 0) {
|
||||
ereport(LOG, (errmsg("job worker with job id %d shutdown abnormaly", job_id)));
|
||||
ereport(LOG, (errmsg("JobExecutor with job id %d shutdown abnormaly", job_id)));
|
||||
}
|
||||
|
||||
(void)MemoryContextSwitchTo(t_thrd.mem_cxt.msg_mem_cxt);
|
||||
|
|
@ -269,12 +269,12 @@ void JobExecuteWorkerMain()
|
|||
/* setup shared memory hook */
|
||||
on_shmem_exit(FreeJobWorkerInfo, 0);
|
||||
on_shmem_exit(PGXCNodeCleanAndRelease, 0);
|
||||
ereport(LOG, (errmsg("job worker started with job id: %d", job_id)));
|
||||
ereport(LOG, (errmsg("JobExecutor started with job id: %d", job_id)));
|
||||
} else {
|
||||
LWLockRelease(JobShmemLock);
|
||||
|
||||
/* no worker entry for me, go away */
|
||||
ereport(WARNING, (errmsg("job worker started wihtout worker entry")));
|
||||
ereport(WARNING, (errmsg("JobExecutor started wihtout worker entry")));
|
||||
proc_exit(0);
|
||||
}
|
||||
|
||||
|
|
@ -326,7 +326,7 @@ void JobExecuteWorkerMain()
|
|||
/* execute job procedure */
|
||||
elog(LOG, "Job is running, worker: %lu, job id: %d", t_thrd.proc_cxt.MyProcPid, job_id);
|
||||
execute_job(job_id);
|
||||
elog(LOG, "Job worker is shutdown normal.");
|
||||
elog(LOG, "JobExecutor is shutdown normal.");
|
||||
|
||||
MemoryContextResetAndDeleteChildren(t_thrd.mem_cxt.msg_mem_cxt);
|
||||
|
||||
|
|
|
|||
|
|
@ -467,6 +467,8 @@ void AioCompltrMain(int ac, char** av)
|
|||
/* compltrIdx identifies this thread. */
|
||||
int compltrIdx = atoi(av[3]);
|
||||
|
||||
knl_thread_set_name("AioWorker");
|
||||
|
||||
/*
|
||||
* Global thread local shortcuts to the completer descriptor
|
||||
* in the compltrArray, these are assigned on entry.
|
||||
|
|
@ -528,7 +530,7 @@ void AioCompltrMain(int ac, char** av)
|
|||
(void)gs_signal_unblock_sigusr2();
|
||||
|
||||
/* Announce that the Completer has been started */
|
||||
ereport(LOG, (errmsg("AIO Completer %d STARTED.", compltrIdx)));
|
||||
ereport(LOG, (errmsg("AioWorker %d STARTED.", compltrIdx)));
|
||||
|
||||
for (;;) {
|
||||
int eventsReceived;
|
||||
|
|
@ -551,7 +553,7 @@ void AioCompltrMain(int ac, char** av)
|
|||
if (t_thrd.aio_cxt.shutdown_requested) {
|
||||
timeout = shutdown_timeout;
|
||||
|
||||
ereport(LOG, (errmsg("AIO Completer %d EXITED.", compltrIdx)));
|
||||
ereport(LOG, (errmsg("AioWorker %d EXITED.", compltrIdx)));
|
||||
proc_exit(0);
|
||||
}
|
||||
|
||||
|
|
@ -575,7 +577,7 @@ void AioCompltrMain(int ac, char** av)
|
|||
*/
|
||||
if (eventsReceived < 0) {
|
||||
/* Report error */
|
||||
ereport(PANIC, (errmsg("AIO Completer io_getevents() failed: error %d .", eventsReceived)));
|
||||
ereport(PANIC, (errmsg("AioWorker io_getevents() failed: error %d .", eventsReceived)));
|
||||
}
|
||||
|
||||
Assert(eventsReceived <= max_nr);
|
||||
|
|
@ -590,7 +592,7 @@ void AioCompltrMain(int ac, char** av)
|
|||
}
|
||||
}
|
||||
|
||||
ereport(LOG, (errmsg("AIO Completer %d EXITED.", compltrIdx)));
|
||||
ereport(LOG, (errmsg("AioWorker %d EXITED.", compltrIdx)));
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -119,12 +119,12 @@ NON_EXEC_STATIC void AlarmCheckerMain()
|
|||
t_thrd.proc_cxt.MyStartTime = time(NULL);
|
||||
|
||||
/* reord my name */
|
||||
t_thrd.proc_cxt.MyProgName = "AlarmChecker";
|
||||
knl_thread_set_name("AlarmChecker");
|
||||
|
||||
/* Identify myself via ps */
|
||||
init_ps_display("AlarmChecker", "", "", "");
|
||||
|
||||
AlarmLog(ALM_LOG, "alarm checker started.");
|
||||
AlarmLog(ALM_LOG, "AlarmChecker started.");
|
||||
|
||||
InitializeLatchSupport(); /* needed for latch waits */
|
||||
|
||||
|
|
@ -189,7 +189,7 @@ NON_EXEC_STATIC void AlarmCheckerMain()
|
|||
(void)WaitLatch(&t_thrd.alarm_cxt.AlarmCheckerLatch, WL_LATCH_SET | WL_TIMEOUT, AlarmCheckInterval * 1000);
|
||||
}
|
||||
|
||||
AlarmLog(ALM_LOG, "alarm checker shutting down...");
|
||||
AlarmLog(ALM_LOG, "AlarmChecker shutting down...");
|
||||
|
||||
proc_exit(0);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -356,12 +356,12 @@ NON_EXEC_STATIC void AutoVacLauncherMain()
|
|||
/* record Start Time for logging */
|
||||
t_thrd.proc_cxt.MyStartTime = time(NULL);
|
||||
|
||||
t_thrd.proc_cxt.MyProgName = "AutoVacLauncher";
|
||||
knl_thread_set_name("AutoVacLauncher");
|
||||
|
||||
/* Identify myself via ps */
|
||||
init_ps_display("autovacuum launcher process", "", "", "");
|
||||
init_ps_display("AutoVacLauncher process", "", "", "");
|
||||
|
||||
ereport(LOG, (errmsg("autovacuum launcher started")));
|
||||
ereport(LOG, (errmsg("AutoVacLauncher started")));
|
||||
|
||||
if (u_sess->attr.attr_security.PostAuthDelay)
|
||||
pg_usleep(u_sess->attr.attr_security.PostAuthDelay * 1000000L);
|
||||
|
|
@ -708,7 +708,7 @@ NON_EXEC_STATIC void AutoVacLauncherMain()
|
|||
|
||||
/* Normal exit from the autovac launcher is here */
|
||||
shutdown:
|
||||
ereport(LOG, (errmsg("autovacuum launcher shutting down")));
|
||||
ereport(LOG, (errmsg("AutoVacLauncher shutting down")));
|
||||
t_thrd.autovacuum_cxt.AutoVacuumShmem->av_launcherpid = 0;
|
||||
|
||||
proc_exit(0); /* done */
|
||||
|
|
@ -1299,10 +1299,10 @@ NON_EXEC_STATIC void AutoVacWorkerMain()
|
|||
/* record Start Time for logging */
|
||||
t_thrd.proc_cxt.MyStartTime = time(NULL);
|
||||
|
||||
t_thrd.proc_cxt.MyProgName = "AutoVacWorker";
|
||||
knl_thread_set_name("AutoVacWorker");
|
||||
|
||||
/* Identify myself via ps */
|
||||
init_ps_display("autovacuum worker process", "", "", "");
|
||||
init_ps_display("AutoVacWorker process", "", "", "");
|
||||
|
||||
SetProcessingMode(InitProcessing);
|
||||
|
||||
|
|
@ -1431,7 +1431,7 @@ NON_EXEC_STATIC void AutoVacWorkerMain()
|
|||
gs_signal_send(t_thrd.autovacuum_cxt.AutoVacuumShmem->av_launcherpid, SIGUSR2);
|
||||
} else {
|
||||
/* no worker entry for me, go away */
|
||||
ereport(WARNING, (errmsg("autovacuum worker started without a worker entry")));
|
||||
ereport(WARNING, (errmsg("AutoVacWorker started without a worker entry")));
|
||||
dbid = InvalidOid;
|
||||
LWLockRelease(AutovacuumLock);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -104,7 +104,9 @@ void BackgroundWriterMain(void)
|
|||
|
||||
t_thrd.role = BGWRITER;
|
||||
|
||||
ereport(LOG, (errmsg("bgwriter started")));
|
||||
knl_thread_set_name("BgWriter");
|
||||
|
||||
ereport(LOG, (errmsg("BgWriter started")));
|
||||
|
||||
/*
|
||||
* Properly accept or ignore signals the postmaster might send us.
|
||||
|
|
|
|||
|
|
@ -61,7 +61,9 @@ void CBMWriterMain(void)
|
|||
sigjmp_buf local_sigjmp_buf;
|
||||
ResourceOwner cbmwriter_resourceOwner;
|
||||
|
||||
ereport(LOG, (errmsg("cbm writer started")));
|
||||
knl_thread_set_name("CBMWriter");
|
||||
|
||||
ereport(LOG, (errmsg("CBMWriter started")));
|
||||
u_sess->attr.attr_storage.CheckPointTimeout = g_instance.attr.attr_storage.enableIncrementalCheckpoint
|
||||
? u_sess->attr.attr_storage.incrCheckPointTimeout
|
||||
: u_sess->attr.attr_storage.fullCheckPointTimeout;
|
||||
|
|
|
|||
|
|
@ -184,8 +184,11 @@ void CheckpointerMain(void)
|
|||
u_sess->attr.attr_storage.CheckPointTimeout = g_instance.attr.attr_storage.enableIncrementalCheckpoint
|
||||
? u_sess->attr.attr_storage.incrCheckPointTimeout
|
||||
: u_sess->attr.attr_storage.fullCheckPointTimeout;
|
||||
|
||||
knl_thread_set_name("Checkpointer");
|
||||
|
||||
ereport(
|
||||
LOG, (errmsg("checkpointer started, CheckPointTimeout is %d", u_sess->attr.attr_storage.CheckPointTimeout)));
|
||||
LOG, (errmsg("Checkpointer started, CheckPointTimeout is %d", u_sess->attr.attr_storage.CheckPointTimeout)));
|
||||
|
||||
/*
|
||||
* Properly accept or ignore signals the postmaster might send us
|
||||
|
|
|
|||
|
|
@ -224,6 +224,8 @@ void FencedUDFMasterMain(int argc, char* argv[])
|
|||
u_sess->attr.attr_common.update_process_title = true;
|
||||
set_ps_display("gaussdb fenced UDF master process", true);
|
||||
|
||||
knl_thread_set_name("FencedUDFMaster");
|
||||
|
||||
/* Step 1: Initialize envrionment: signal handle, display info */
|
||||
gs_signal_setmask(&t_thrd.libpq_cxt.BlockSig, NULL);
|
||||
gs_signal_block_sigusr2();
|
||||
|
|
@ -272,7 +274,7 @@ void FencedUDFMasterMain(int argc, char* argv[])
|
|||
ereport(FATAL, (errmodule(MOD_UDF), errmsg("listen socket failed: %m")));
|
||||
}
|
||||
|
||||
ereport(LOG, (errmodule(MOD_UDF), errmsg("Fenced master process start OK.")));
|
||||
ereport(LOG, (errmodule(MOD_UDF), errmsg("FencedUDFMaster process start OK.")));
|
||||
|
||||
/* Step 3: ServerLoop for accept connection and start worker process */
|
||||
UDFMasterServerLoop();
|
||||
|
|
|
|||
|
|
@ -609,7 +609,9 @@ NON_EXEC_STATIC void FaultMonitorMain()
|
|||
|
||||
t_thrd.proc_cxt.MyProcPid = gs_thread_self();
|
||||
|
||||
ereport(DEBUG5, (errmsg("lwlockmonitor process is started: %lu", t_thrd.proc_cxt.MyProcPid)));
|
||||
knl_thread_set_name("LWLockMonitor");
|
||||
|
||||
ereport(DEBUG5, (errmsg("LWLockMonitor process is started: %lu", t_thrd.proc_cxt.MyProcPid)));
|
||||
|
||||
(void)gspqsignal(SIGHUP, LWLockMonitorSigHupHandler); /* set flag to read config file */
|
||||
(void)gspqsignal(SIGINT, LWLockMonitorShutdownHandler); /* request shutdown */
|
||||
|
|
|
|||
|
|
@ -885,9 +885,11 @@ void ckpt_pagewriter_main(void)
|
|||
/* We allow SIGQUIT (quickdie) at all times */
|
||||
(void)sigdelset(&t_thrd.libpq_cxt.BlockSig, SIGQUIT);
|
||||
|
||||
knl_thread_set_name("PageWriter");
|
||||
|
||||
ereport(LOG,
|
||||
(errmodule(MOD_INCRE_CKPT),
|
||||
errmsg("pagewriter started, thread id is %d", t_thrd.pagewriter_cxt.pagewriter_id)));
|
||||
errmsg("PageWriter started, thread id is %d", t_thrd.pagewriter_cxt.pagewriter_id)));
|
||||
|
||||
/*
|
||||
* Create a resource owner to keep track of our resources (currently only
|
||||
|
|
|
|||
|
|
@ -168,11 +168,11 @@ NON_EXEC_STATIC void PgArchiverMain()
|
|||
|
||||
t_thrd.proc_cxt.MyStartTime = time(NULL); /* record Start Time for logging */
|
||||
|
||||
t_thrd.proc_cxt.MyProgName = "PgArchiver";
|
||||
knl_thread_set_name("Archiver");
|
||||
|
||||
t_thrd.myLogicTid = noProcLogicTid + PGARCH_LID;
|
||||
|
||||
ereport(LOG, (errmsg("PgArchiver started")));
|
||||
ereport(LOG, (errmsg("Archiver started")));
|
||||
|
||||
InitializeLatchSupport(); /* needed for latch waits */
|
||||
|
||||
|
|
@ -202,7 +202,7 @@ NON_EXEC_STATIC void PgArchiverMain()
|
|||
/*
|
||||
* Identify myself via ps
|
||||
*/
|
||||
init_ps_display("archiver process", "", "", "");
|
||||
init_ps_display("Archiver process", "", "", "");
|
||||
|
||||
pgarch_MainLoop();
|
||||
|
||||
|
|
|
|||
|
|
@ -374,7 +374,9 @@ NON_EXEC_STATIC void PgAuditorMain()
|
|||
|
||||
t_thrd.role = AUDIT;
|
||||
|
||||
init_ps_display("auditor process", "", "", "");
|
||||
knl_thread_set_name("Auditor");
|
||||
|
||||
init_ps_display("Auditor process", "", "", "");
|
||||
|
||||
/*
|
||||
* Also close our copy of the write end of the pipe. This is needed to
|
||||
|
|
@ -600,7 +602,7 @@ NON_EXEC_STATIC void PgAuditorMain()
|
|||
* seeing this message on the real stderr is annoying - so we make
|
||||
* it DEBUG1 to suppress in normal use.
|
||||
*/
|
||||
ereport(DEBUG1, (errmsg("auditor shutting down")));
|
||||
ereport(DEBUG1, (errmsg("Auditor shutting down")));
|
||||
|
||||
pgaudit_cleanup();
|
||||
pgaudit_update_indexfile(PG_BINARY_W, true);
|
||||
|
|
|
|||
|
|
@ -4928,7 +4928,7 @@ void PgstatCollectorMain()
|
|||
|
||||
t_thrd.proc_cxt.MyStartTime = time(NULL); /* record Start Time for logging */
|
||||
|
||||
t_thrd.proc_cxt.MyProgName = "PgstatCollector";
|
||||
knl_thread_set_name("StatCollector");
|
||||
|
||||
t_thrd.myLogicTid = noProcLogicTid + PGSTAT_LID;
|
||||
|
||||
|
|
@ -4960,7 +4960,7 @@ void PgstatCollectorMain()
|
|||
/*
|
||||
* Identify myself via ps
|
||||
*/
|
||||
init_ps_display("stats collector process", "", "", "");
|
||||
init_ps_display("StatCollector process", "", "", "");
|
||||
|
||||
/*
|
||||
* Arrange to write the initial status file right away
|
||||
|
|
|
|||
|
|
@ -1092,7 +1092,7 @@ int PostmasterMain(int argc, char* argv[])
|
|||
|
||||
IsPostmasterEnvironment = true;
|
||||
|
||||
t_thrd.proc_cxt.MyProgName = "gaussmaster";
|
||||
knl_thread_set_name("GaussMaster");
|
||||
|
||||
/*
|
||||
* for security, no dir or file created can be group or other accessible
|
||||
|
|
@ -7346,12 +7346,12 @@ void ReaperBackendMain()
|
|||
t_thrd.proc_cxt.MyStartTime = time(NULL);
|
||||
|
||||
/* reord my name */
|
||||
t_thrd.proc_cxt.MyProgName = "ReaperBackend";
|
||||
knl_thread_set_name("Reaper");
|
||||
|
||||
/* Identify myself via ps */
|
||||
init_ps_display("ReaperBackend", "", "", "");
|
||||
init_ps_display("Reaper", "", "", "");
|
||||
|
||||
ereport(LOG, (errmsg("reaper backend started.")));
|
||||
ereport(LOG, (errmsg("Reaper backend started.")));
|
||||
|
||||
InitializeLatchSupport(); /* needed for latch waits */
|
||||
|
||||
|
|
@ -9400,10 +9400,10 @@ int GaussDbAuxiliaryThreadMain(knl_thread_arg* arg)
|
|||
* can occur here.
|
||||
*/
|
||||
srandom((unsigned int)(t_thrd.proc_cxt.MyProcPid ^ (unsigned int)t_thrd.proc_cxt.MyStartTime));
|
||||
t_thrd.proc_cxt.MyProgName = "Auxiliary";
|
||||
knl_thread_set_name("AuxMain");
|
||||
|
||||
/* register thread information to PGPROC structure */
|
||||
init_ps_display("Auxiliary", "", "", "");
|
||||
init_ps_display("AuxMain", "", "", "");
|
||||
|
||||
/* Validate we have been given a reasonable-looking t_thrd.proc_cxt.DataDir */
|
||||
Assert(t_thrd.proc_cxt.DataDir);
|
||||
|
|
|
|||
|
|
@ -93,7 +93,9 @@ void RemoteServiceMain(void)
|
|||
MemoryContext remote_service_context;
|
||||
long cur_timeout_ms = 0;
|
||||
|
||||
ereport(LOG, (errmsg("remote service is starting...")));
|
||||
knl_thread_set_name("RemoteSrv");
|
||||
|
||||
ereport(LOG, (errmsg("RemoteSrv is starting...")));
|
||||
|
||||
/*
|
||||
* Properly accept or ignore signals the postmaster might send us.
|
||||
|
|
@ -221,7 +223,7 @@ void RemoteServiceMain(void)
|
|||
|
||||
/* Exit before call RunServer() */
|
||||
if (t_thrd.rs_cxt.shutdown_requested) {
|
||||
ereport(LOG, (errmodule(MOD_REMOTE), errmsg("remote service is closing...")));
|
||||
ereport(LOG, (errmodule(MOD_REMOTE), errmsg("RemoteSrv is closing...")));
|
||||
GRPC_TRY() {
|
||||
ShutdownAndReleaseServer(t_thrd.rs_cxt.server_context);
|
||||
t_thrd.rs_cxt.server_context = NULL;
|
||||
|
|
|
|||
|
|
@ -196,6 +196,8 @@ static void StartupReleaseAllLocks(int code, Datum arg)
|
|||
*/
|
||||
void StartupProcessMain(void)
|
||||
{
|
||||
knl_thread_set_name("StartupProcess");
|
||||
|
||||
/*
|
||||
* Properly accept or ignore signals the postmaster might send us.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -220,7 +220,7 @@ NON_EXEC_STATIC void SysLoggerMain(int fd)
|
|||
t_thrd.proc_cxt.MyStartTime = time(NULL); /* set our start time in case we call elog */
|
||||
now = t_thrd.proc_cxt.MyStartTime;
|
||||
|
||||
t_thrd.proc_cxt.MyProgName = "syslogger";
|
||||
knl_thread_set_name("SysLogger");
|
||||
|
||||
t_thrd.myLogicTid = noProcLogicTid + SYSLOGGER_LID;
|
||||
|
||||
|
|
@ -228,7 +228,7 @@ NON_EXEC_STATIC void SysLoggerMain(int fd)
|
|||
|
||||
t_thrd.role = SYSLOGGER;
|
||||
|
||||
init_ps_display("logger process", "", "", "");
|
||||
init_ps_display("SysLogger process", "", "", "");
|
||||
|
||||
/*
|
||||
* If we restarted, our stderr is already redirected into our own input
|
||||
|
|
@ -567,7 +567,7 @@ NON_EXEC_STATIC void SysLoggerMain(int fd)
|
|||
* seeing this message on the real stderr is annoying - so we make
|
||||
* it DEBUG1 to suppress in normal use.
|
||||
*/
|
||||
ereport(DEBUG1, (errmsg("logger shutting down")));
|
||||
ereport(DEBUG1, (errmsg("SysLogger shutting down")));
|
||||
|
||||
/*
|
||||
* Normal exit from the syslogger is here. Note that we
|
||||
|
|
|
|||
|
|
@ -71,9 +71,11 @@ NON_EXEC_STATIC void TwoPhaseCleanerMain()
|
|||
|
||||
t_thrd.proc_cxt.MyProcPid = gs_thread_self();
|
||||
|
||||
knl_thread_set_name("TwoPhaseCleaner");
|
||||
|
||||
twoPhaseCleanerProc = t_thrd.proc;
|
||||
|
||||
ereport(DEBUG5, (errmsg("twophasecleaner process is started: %lu", t_thrd.proc_cxt.MyProcPid)));
|
||||
ereport(DEBUG5, (errmsg("TwoPhaseCleaner process is started: %lu", t_thrd.proc_cxt.MyProcPid)));
|
||||
|
||||
(void)gspqsignal(SIGHUP, TwoPCSigHupHandler); /* set flag to read config file */
|
||||
(void)gspqsignal(SIGINT, TwoPCShutdownHandler); /* request shutdown */
|
||||
|
|
|
|||
|
|
@ -99,7 +99,9 @@ void WalWriterMain(void)
|
|||
bool hibernating = false;
|
||||
sigset_t oldSigMask;
|
||||
|
||||
ereport(LOG, (errmsg("walwriter started")));
|
||||
knl_thread_set_name("WalWriter");
|
||||
|
||||
ereport(LOG, (errmsg("WalWriter started")));
|
||||
|
||||
/*
|
||||
* Properly accept or ignore signals the postmaster might send us
|
||||
|
|
|
|||
|
|
@ -6446,6 +6446,8 @@ int StreamMain(void* arg)
|
|||
|
||||
t_thrd.proc_cxt.MyProcPid = gs_thread_self();
|
||||
|
||||
knl_thread_set_name("Stream");
|
||||
|
||||
/*
|
||||
* Rebind stream thread to instance bind CPU in thread pool mode.
|
||||
* Otherwise the stream thread will follow its parent thread's bind CPU,
|
||||
|
|
@ -6965,7 +6967,7 @@ int PostgresMain(int argc, char* argv[], const char* dbname, const char* usernam
|
|||
|
||||
t_thrd.proc_cxt.MyStartTime = time(NULL);
|
||||
|
||||
t_thrd.proc_cxt.MyProgName = "gaussdb";
|
||||
knl_thread_set_name("BackendMode");
|
||||
|
||||
/*
|
||||
* Initialize random() for the first time, like PostmasterMain()
|
||||
|
|
@ -6975,7 +6977,7 @@ int PostgresMain(int argc, char* argv[], const char* dbname, const char* usernam
|
|||
*/
|
||||
srandom((unsigned int)(t_thrd.proc_cxt.MyProcPid ^ (unsigned int)t_thrd.proc_cxt.MyStartTime));
|
||||
} else {
|
||||
t_thrd.proc_cxt.MyProgName = "postgres";
|
||||
knl_thread_set_name("gaussdb");
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -1140,3 +1140,8 @@ knl_session_context* create_session_context(MemoryContext parent, uint64 id)
|
|||
MemoryContextSwitchTo(old_cxt);
|
||||
return sess;
|
||||
}
|
||||
|
||||
__attribute__ ((__used__)) knl_session_context *get_current_session()
|
||||
{
|
||||
return u_sess;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1493,3 +1493,19 @@ void knl_thread_init(knl_thread_role role)
|
|||
knl_t_poolcleaner_init(&t_thrd.poolcleaner_cxt);
|
||||
knl_t_mot_init(&t_thrd.mot_cxt);
|
||||
}
|
||||
|
||||
void knl_thread_set_name(const char* name)
|
||||
{
|
||||
t_thrd.proc_cxt.MyProgName = (char*)name;
|
||||
/*
|
||||
* The length of thread name is restricted to 16 characters,
|
||||
* including the terminating null byte ('\0').
|
||||
*/
|
||||
Assert(strlen(name) < MAX_THREAD_NAME_LENGTH);
|
||||
pthread_setname_np(pthread_self(), name);
|
||||
}
|
||||
|
||||
__attribute__ ((__used__)) knl_thrd_context *get_current_thread()
|
||||
{
|
||||
return &t_thrd;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ static void listener_sigusrl_handler(SIGNAL_ARGS)
|
|||
|
||||
void TpoolListenerMain(ThreadPoolListener* listener)
|
||||
{
|
||||
t_thrd.proc_cxt.MyProgName = "ThreadPoolListener";
|
||||
knl_thread_set_name("ThdPoolListener");
|
||||
pgstat_report_appname("ThreadPoolListener");
|
||||
|
||||
(void)gspqsignal(SIGHUP, SIG_IGN);
|
||||
|
|
|
|||
|
|
@ -492,6 +492,9 @@ void BatchRedoMain()
|
|||
{
|
||||
void** eleArry;
|
||||
uint32 eleNum;
|
||||
|
||||
knl_thread_set_name("RedoBatch");
|
||||
|
||||
XLogParseBufferInitFunc(MAX_PARSE_BUFF_NUM, &recordRefOperate);
|
||||
while (SPSCBlockingQueueGetAll(g_redoWorker->queue, &eleArry, &eleNum)) {
|
||||
bool isEnd = BatchRedoDistributeItems(eleArry, eleNum);
|
||||
|
|
@ -762,6 +765,9 @@ void RedoPageManagerMain()
|
|||
{
|
||||
void** eleArry;
|
||||
uint32 eleNum;
|
||||
|
||||
knl_thread_set_name("RedoPageMgr");
|
||||
|
||||
XLogParseBufferInitFunc(MAX_PARSE_BUFF_NUM, &recordRefOperate);
|
||||
while (SPSCBlockingQueueGetAll(g_redoWorker->queue, &eleArry, &eleNum)) {
|
||||
bool isEnd = PageManagerRedoDistributeItems(eleArry, eleNum);
|
||||
|
|
@ -857,6 +863,8 @@ void WaitLsnUpdate(bool force)
|
|||
|
||||
void TrxnManagerMain()
|
||||
{
|
||||
knl_thread_set_name("RedoTxnMgr");
|
||||
|
||||
XLogParseBufferInitFunc(MAX_PARSE_BUFF_NUM, &recordRefOperate);
|
||||
while (true) {
|
||||
HandlePageRedoInterrupts();
|
||||
|
|
@ -892,6 +900,8 @@ void TrxnWorkerProcLsnForwarder(RedoItem* lsnForwarder)
|
|||
|
||||
void TrxnWorkMain()
|
||||
{
|
||||
knl_thread_set_name("RedoTxnWorker");
|
||||
|
||||
RedoItem* item = nullptr;
|
||||
MOTBeginRedoRecovery();
|
||||
if (ParseStateWithoutCache())
|
||||
|
|
@ -997,6 +1007,8 @@ void RedoPageWorkerRedoBcmBlock(XLogRecParseState* procState)
|
|||
|
||||
void RedoPageWorkerMain()
|
||||
{
|
||||
knl_thread_set_name("RedoPageWorker");
|
||||
|
||||
XLogRecParseState* redoblockstateHead = nullptr;
|
||||
if (ParseStateWithoutCache())
|
||||
XLogRedoBufferInitFunc(MAX_LOCAL_BUFF_NUM, &recordRefOperate);
|
||||
|
|
@ -1306,6 +1318,8 @@ void XLogReadManagerMain()
|
|||
XLogReaderState* xlogreader = nullptr;
|
||||
XLogReaderState* newxlogreader = nullptr;
|
||||
|
||||
knl_thread_set_name("RedoReadMgr");
|
||||
|
||||
g_recordbuffer = &g_dispatcher->recordstate;
|
||||
GetRecoveryLatch();
|
||||
/* init readstate */
|
||||
|
|
@ -1362,6 +1376,8 @@ void XLogReadWorkerMain()
|
|||
uint32 waitcount = 0;
|
||||
const uint32 sleepTime = 50; /* 50 us */
|
||||
|
||||
knl_thread_set_name("RedoReadWorker");
|
||||
|
||||
g_recordbuffer = &g_dispatcher->recordstate;
|
||||
startreadworker = pg_atomic_read_u32(&(g_recordbuffer->startreadworker));
|
||||
while (startreadworker != READ_NOTIFY_EXIT) {
|
||||
|
|
@ -1538,9 +1554,11 @@ void WaitStateNormal()
|
|||
/* Run from the worker thread. */
|
||||
void ParallelRedoThreadMain()
|
||||
{
|
||||
knl_thread_set_name("ExtremeRTO");
|
||||
|
||||
ParallelRedoThreadRegister();
|
||||
ereport(LOG,
|
||||
(errmsg("Page-redo-worker thread %u started, role:%u, slotId:%u.",
|
||||
(errmsg("ExtremeRTO thread %u started, role:%u, slotId:%u.",
|
||||
g_redoWorker->id,
|
||||
g_redoWorker->role,
|
||||
g_redoWorker->slotId)));
|
||||
|
|
@ -1554,7 +1572,7 @@ void ParallelRedoThreadMain()
|
|||
int retCode = RedoMainLoop();
|
||||
ResourceManagerStop();
|
||||
ereport(LOG,
|
||||
(errmsg("Page-redo-worker thread %u terminated, role:%u, slotId:%u, retcode %u.",
|
||||
(errmsg("ExtremeRTO thread %u terminated, role:%u, slotId:%u, retcode %u.",
|
||||
g_redoWorker->id,
|
||||
g_redoWorker->role,
|
||||
g_redoWorker->slotId,
|
||||
|
|
|
|||
|
|
@ -247,6 +247,8 @@ void HandlePageRedoInterrupts()
|
|||
/* Run from the worker thread. */
|
||||
void PageRedoWorkerMain()
|
||||
{
|
||||
knl_thread_set_name("ParallelRecov");
|
||||
|
||||
bool isWorkerStarting = false;
|
||||
SpinLockAcquire(&(g_instance.comm_cxt.predo_cxt.rwlock));
|
||||
isWorkerStarting = ((g_instance.comm_cxt.predo_cxt.state == REDO_STARTING_BEGIN) ? true : false);
|
||||
|
|
@ -257,11 +259,11 @@ void PageRedoWorkerMain()
|
|||
}
|
||||
SpinLockRelease(&(g_instance.comm_cxt.predo_cxt.rwlock));
|
||||
if (!isWorkerStarting) {
|
||||
ereport(WARNING, (errmsg("PageRedoWorkerMain Page-redo-worker %u exit.", (uint32)isWorkerStarting)));
|
||||
ereport(WARNING, (errmsg("PageRedoWorkerMain ParallelRecov %u exit.", (uint32)isWorkerStarting)));
|
||||
SetPageWorkStateByThreadId(PAGE_REDO_WORKER_EXIT);
|
||||
proc_exit(0);
|
||||
}
|
||||
ereport(LOG, (errmsg("Page-redo-worker thread %u started.", g_redoWorker->id)));
|
||||
ereport(LOG, (errmsg("ParallelRecov thread %u started.", g_redoWorker->id)));
|
||||
|
||||
SetupSignalHandlers();
|
||||
InitGlobals();
|
||||
|
|
@ -274,7 +276,7 @@ void PageRedoWorkerMain()
|
|||
(void)MemoryContextSwitchTo(g_redoWorker->oldCtx);
|
||||
|
||||
ResourceManagerStop();
|
||||
ereport(LOG, (errmsg("Page-redo-worker thread %u terminated, retcode %d.", g_redoWorker->id, retCode)));
|
||||
ereport(LOG, (errmsg("ParallelRecov thread %u terminated, retcode %d.", g_redoWorker->id, retCode)));
|
||||
LastMarkReached();
|
||||
pg_atomic_write_u32(&(g_instance.comm_cxt.predo_cxt.pageRedoThreadStatusList[g_redoWorker->originId].threadState),
|
||||
PAGE_REDO_WORKER_EXIT);
|
||||
|
|
|
|||
|
|
@ -199,10 +199,10 @@ NON_EXEC_STATIC void CatchupMain()
|
|||
/* record Start Time for logging */
|
||||
t_thrd.proc_cxt.MyStartTime = time(NULL);
|
||||
|
||||
t_thrd.proc_cxt.MyProgName = "Catchup";
|
||||
knl_thread_set_name("Catchup");
|
||||
|
||||
/* Identify myself via ps */
|
||||
init_ps_display("catchup process", "", "", "");
|
||||
init_ps_display("Catchup process", "", "", "");
|
||||
|
||||
SetProcessingMode(InitProcessing);
|
||||
|
||||
|
|
|
|||
|
|
@ -96,7 +96,9 @@ void DataRcvWriterMain(void)
|
|||
MemoryContext datarcvWriterContext;
|
||||
t_thrd.xlog_cxt.InRecovery = true;
|
||||
|
||||
ereport(LOG, (errmsg("datarcvwriter thread started")));
|
||||
knl_thread_set_name("DataRcvWriter");
|
||||
|
||||
ereport(LOG, (errmsg("DataRcvWriter thread started")));
|
||||
/*
|
||||
* Reset some signals that are accepted by postmaster but not here
|
||||
*/
|
||||
|
|
@ -268,7 +270,7 @@ void DataRcvWriterMain(void)
|
|||
;
|
||||
|
||||
if (t_thrd.datarcvwriter_cxt.shutdownRequested) {
|
||||
ereport(LOG, (errmsg("datarcvwriter thread shut down")));
|
||||
ereport(LOG, (errmsg("DataRcvWriter thread shut down")));
|
||||
/*
|
||||
* From here on, elog(ERROR) should end with exit(1), not send
|
||||
* control back to the sigsetjmp block above
|
||||
|
|
@ -280,7 +282,7 @@ void DataRcvWriterMain(void)
|
|||
|
||||
rc = WaitLatch(&t_thrd.proc->procLatch, WL_LATCH_SET | WL_TIMEOUT | WL_POSTMASTER_DEATH, (long)1000 /* ms */);
|
||||
if (rc & WL_POSTMASTER_DEATH) {
|
||||
ereport(LOG, (errmsg("datarcvwriter thread shut down with exit code 1")));
|
||||
ereport(LOG, (errmsg("DataRcvWriter thread shut down with exit code 1")));
|
||||
gs_thread_exit(1);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -204,7 +204,9 @@ void DataReceiverMain(void)
|
|||
|
||||
AssertEreport(datarcv != nullptr, MOD_FUNCTION, "datarcv should not be null");
|
||||
|
||||
ereport(LOG, (errmsg("datareceiver thread started")));
|
||||
knl_thread_set_name("DataReceiver");
|
||||
|
||||
ereport(LOG, (errmsg("DataReceiver thread started")));
|
||||
/*
|
||||
* Mark datareceiver as running in shared memory.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -133,13 +133,13 @@ int DataSenderMain(void)
|
|||
{
|
||||
MemoryContext datasnd_context;
|
||||
|
||||
t_thrd.proc_cxt.MyProgName = "DataSender";
|
||||
knl_thread_set_name("DataSender");
|
||||
|
||||
/* Create a per-datasender data structure in shared memory */
|
||||
InitDataSnd();
|
||||
catchupDone = false;
|
||||
|
||||
ereport(LOG, (errmsg("datasender thread started")));
|
||||
ereport(LOG, (errmsg("DataSender thread started")));
|
||||
/*
|
||||
* Create a memory context that we will do all our work in. We do this so
|
||||
* that we can reset the context during error recovery and thereby avoid
|
||||
|
|
|
|||
|
|
@ -269,7 +269,7 @@ void heartbeat_main(void)
|
|||
MemoryContext heartbeat_context;
|
||||
|
||||
t_thrd.role = HEARTBEAT;
|
||||
t_thrd.proc_cxt.MyProgName = "Heartbeat";
|
||||
knl_thread_set_name("Heartbeater");
|
||||
|
||||
heartbeat_init();
|
||||
|
||||
|
|
@ -333,7 +333,7 @@ void heartbeat_main(void)
|
|||
gs_signal_setmask(&t_thrd.libpq_cxt.UnBlockSig, NULL);
|
||||
(void)gs_signal_unblock_sigusr2();
|
||||
|
||||
ereport(LOG, (errmsg("heartbeat thread started")));
|
||||
ereport(LOG, (errmsg("Heartbeater thread started")));
|
||||
proc_exit(server_loop());
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -702,7 +702,9 @@ void walrcvWriterMain(void)
|
|||
sigset_t oldSigMask;
|
||||
MemoryContext walrcvWriterContext;
|
||||
|
||||
ereport(LOG, (errmsg("walrcvwriter thread started")));
|
||||
knl_thread_set_name("WalRcvWriter");
|
||||
|
||||
ereport(LOG, (errmsg("WalRcvWriter thread started")));
|
||||
/*
|
||||
* Reset some signals that are accepted by postmaster but not here
|
||||
*/
|
||||
|
|
@ -867,7 +869,7 @@ void walrcvWriterMain(void)
|
|||
;
|
||||
|
||||
if (t_thrd.walrcvwriter_cxt.shutdownRequested) {
|
||||
ereport(LOG, (errmsg("walrcvwriter thread shut down")));
|
||||
ereport(LOG, (errmsg("WalRcvWriter thread shut down")));
|
||||
/*
|
||||
* From here on, elog(ERROR) should end with exit(1), not send
|
||||
* control back to the sigsetjmp block above
|
||||
|
|
@ -879,7 +881,7 @@ void walrcvWriterMain(void)
|
|||
|
||||
rc = WaitLatch(&t_thrd.proc->procLatch, WL_LATCH_SET | WL_TIMEOUT | WL_POSTMASTER_DEATH, (long)1000 /* ms */);
|
||||
if (rc & WL_POSTMASTER_DEATH) {
|
||||
ereport(LOG, (errmsg("walrcvwriter thread shut down with code 1")));
|
||||
ereport(LOG, (errmsg("WalRcvWriter thread shut down with code 1")));
|
||||
gs_thread_exit(1);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -306,7 +306,9 @@ void WalReceiverMain(void)
|
|||
*/
|
||||
Assert(walrcv != NULL);
|
||||
|
||||
ereport(LOG, (errmsg("walreceiver thread started")));
|
||||
knl_thread_set_name("WalReceiver");
|
||||
|
||||
ereport(LOG, (errmsg("WalReceiver thread started")));
|
||||
|
||||
/* Initialize walrcv buffer for walreceive optimization */
|
||||
walRcvCtlBlockInit();
|
||||
|
|
|
|||
|
|
@ -212,7 +212,7 @@ int WalSenderMain(void)
|
|||
MemoryContext walsnd_context;
|
||||
int nRet = 0;
|
||||
|
||||
t_thrd.proc_cxt.MyProgName = "WalSender";
|
||||
knl_thread_set_name("WalSender");
|
||||
if (RecoveryInProgress()) {
|
||||
t_thrd.role = WAL_STANDBY_SENDER;
|
||||
}
|
||||
|
|
@ -225,7 +225,7 @@ int WalSenderMain(void)
|
|||
/* Create a per-walsender data structure in shared memory */
|
||||
InitWalSnd();
|
||||
|
||||
ereport(LOG, (errmsg("walsender thread started")));
|
||||
ereport(LOG, (errmsg("WalSender thread started")));
|
||||
/*
|
||||
* Create a memory context that we will do all our work in. We do this so
|
||||
* that we can reset the context during error recovery and thereby avoid
|
||||
|
|
|
|||
|
|
@ -74,6 +74,8 @@
|
|||
|
||||
#define RESERVE_SIZE 32
|
||||
|
||||
#define MAX_THREAD_NAME_LENGTH 16
|
||||
|
||||
typedef struct ResourceOwnerData* ResourceOwner;
|
||||
|
||||
typedef struct knl_t_codegen_context {
|
||||
|
|
@ -2802,5 +2804,6 @@ typedef struct knl_thrd_context {
|
|||
extern void knl_thread_mot_init();
|
||||
extern void knl_thread_init(knl_thread_role role);
|
||||
extern THR_LOCAL knl_thrd_context t_thrd;
|
||||
extern void knl_thread_set_name(const char* name);
|
||||
|
||||
#endif /* SRC_INCLUDE_KNL_KNL_THRD_H_ */
|
||||
|
|
|
|||
Loading…
Reference in New Issue