optimizer for signal block in threadpool
This commit is contained in:
@ -86,6 +86,7 @@ int StreamMain()
|
||||
int curTryCounter;
|
||||
int* oldTryCounter = NULL;
|
||||
if (sigsetjmp(local_sigjmp_buf, 1) != 0) {
|
||||
t_thrd.int_cxt.ignoreBackendSignal = false;
|
||||
/* reset STP thread local valueables */
|
||||
stp_reset_opt_values();
|
||||
|
||||
|
||||
@ -5421,6 +5421,9 @@ static void drop_unnamed_stmt(void)
|
||||
*/
|
||||
void quickdie(SIGNAL_ARGS)
|
||||
{
|
||||
if (t_thrd.int_cxt.ignoreBackendSignal) {
|
||||
return;
|
||||
}
|
||||
sigaddset(&t_thrd.libpq_cxt.BlockSig, SIGQUIT); /* prevent nested calls */
|
||||
gs_signal_setmask(&t_thrd.libpq_cxt.BlockSig, NULL);
|
||||
|
||||
@ -5474,6 +5477,9 @@ void quickdie(SIGNAL_ARGS)
|
||||
*/
|
||||
void die(SIGNAL_ARGS)
|
||||
{
|
||||
if (t_thrd.int_cxt.ignoreBackendSignal) {
|
||||
return;
|
||||
}
|
||||
int save_errno = errno;
|
||||
|
||||
/* Don't joggle the elbow of proc_exit */
|
||||
@ -5523,6 +5529,9 @@ void die(SIGNAL_ARGS)
|
||||
*/
|
||||
void StatementCancelHandler(SIGNAL_ARGS)
|
||||
{
|
||||
if (t_thrd.int_cxt.ignoreBackendSignal) {
|
||||
return;
|
||||
}
|
||||
int save_errno = errno;
|
||||
|
||||
/*
|
||||
@ -7273,6 +7282,7 @@ int PostgresMain(int argc, char* argv[], const char* dbname, const char* usernam
|
||||
int curTryCounter;
|
||||
int* oldTryCounter = NULL;
|
||||
if (sigsetjmp(local_sigjmp_buf, 1) != 0) {
|
||||
t_thrd.int_cxt.ignoreBackendSignal = false;
|
||||
gstrace_tryblock_exit(true, oldTryCounter);
|
||||
Assert(t_thrd.proc->dw_pos == -1);
|
||||
|
||||
|
||||
@ -534,6 +534,7 @@ static void knl_t_interrupt_init(knl_t_interrupt_context* int_cxt)
|
||||
int_cxt->CritSectionCount = 0;
|
||||
int_cxt->InterruptByCN = false;
|
||||
int_cxt->InterruptCountResetFlag = false;
|
||||
int_cxt->ignoreBackendSignal = false;
|
||||
}
|
||||
|
||||
static void knl_t_proc_init(knl_t_proc_context* proc_cxt)
|
||||
|
||||
@ -144,8 +144,8 @@ int ThreadPoolWorker::StartUp()
|
||||
|
||||
void PreventSignal()
|
||||
{
|
||||
gs_signal_block_sigusr2();
|
||||
gs_signal_setmask(&t_thrd.libpq_cxt.BlockSig, NULL);
|
||||
HOLD_INTERRUPTS();
|
||||
t_thrd.int_cxt.ignoreBackendSignal = true;
|
||||
t_thrd.int_cxt.QueryCancelPending = false;
|
||||
disable_sig_alarm(true);
|
||||
}
|
||||
@ -153,8 +153,8 @@ void PreventSignal()
|
||||
void AllowSignal()
|
||||
{
|
||||
/* now we can accept signal. out of this, we rely on signal handle. */
|
||||
gs_signal_unblock_sigusr2();
|
||||
gs_signal_setmask(&t_thrd.libpq_cxt.UnBlockSig, NULL);
|
||||
t_thrd.int_cxt.ignoreBackendSignal = false;
|
||||
RESUME_INTERRUPTS();
|
||||
}
|
||||
|
||||
void ThreadPoolWorker::WaitMission()
|
||||
|
||||
@ -262,6 +262,9 @@ bool CheckProcSignal(ProcSignalReason reason)
|
||||
*/
|
||||
void procsignal_sigusr1_handler(SIGNAL_ARGS)
|
||||
{
|
||||
if (t_thrd.int_cxt.ignoreBackendSignal) {
|
||||
return;
|
||||
}
|
||||
int save_errno = errno;
|
||||
t_thrd.int_cxt.InterruptByCN = true;
|
||||
|
||||
|
||||
@ -1281,6 +1281,7 @@ typedef struct knl_t_interrupt_context {
|
||||
|
||||
volatile bool InterruptCountResetFlag;
|
||||
|
||||
volatile bool ignoreBackendSignal;
|
||||
} knl_t_interrupt_context;
|
||||
|
||||
typedef int64 pg_time_t;
|
||||
|
||||
Reference in New Issue
Block a user