!2133 [bugfix] 修复openGauss数据库关闭时pagewriter主线程退出失败的问题
Merge pull request !2133 from chenxiaobin/fixExit
This commit is contained in:
@ -1202,7 +1202,8 @@ void dw_upgrade_single()
|
||||
return;
|
||||
}
|
||||
|
||||
static void HandlePageWriterExit() {
|
||||
static void HandlePageWriterExit()
|
||||
{
|
||||
/* Let the pagewriter sub thread exit, then main pagewriter thread exits */
|
||||
if (t_thrd.pagewriter_cxt.shutdown_requested && g_instance.ckpt_cxt_ctl->page_writer_can_exit) {
|
||||
g_instance.ckpt_cxt_ctl->page_writer_sub_can_exit = true;
|
||||
@ -1224,6 +1225,10 @@ static void HandlePageWriterExit() {
|
||||
* control back to the sigsetjmp block above.
|
||||
*/
|
||||
u_sess->attr.attr_common.ExitOnAnyError = true;
|
||||
|
||||
/* release compression ctx */
|
||||
crps_destory_ctxs();
|
||||
|
||||
/* Normal exit from the pagewriter is here */
|
||||
proc_exit(0); /* done */
|
||||
}
|
||||
@ -1248,28 +1253,6 @@ static void HandlePageWriterMainInterrupts()
|
||||
PageWriterSyncWithAbsorption();
|
||||
t_thrd.pagewriter_cxt.sync_retry = false;
|
||||
}
|
||||
|
||||
/* main thread should finally exit. */
|
||||
while (t_thrd.pagewriter_cxt.shutdown_requested && g_instance.ckpt_cxt_ctl->page_writer_can_exit) {
|
||||
if (pg_atomic_read_u32(&g_instance.ckpt_cxt_ctl->current_page_writer_count) == 1) {
|
||||
ereport(LOG,
|
||||
(errmodule(MOD_INCRE_CKPT),
|
||||
errmsg("pagewriter thread shut down, id is %d", t_thrd.pagewriter_cxt.pagewriter_id)));
|
||||
|
||||
/*
|
||||
* From here on, elog(ERROR) should end with exit(1), not send
|
||||
* control back to the sigsetjmp block above.
|
||||
*/
|
||||
u_sess->attr.attr_common.ExitOnAnyError = true;
|
||||
|
||||
/* release compression ctx */
|
||||
crps_destory_ctxs();
|
||||
|
||||
/* Normal exit from the pagewriter is here */
|
||||
proc_exit(0); /* done */
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
static void ckpt_pagewriter_main_thread_loop(void)
|
||||
@ -1295,7 +1278,7 @@ static void ckpt_pagewriter_main_thread_loop(void)
|
||||
HandlePageWriterMainInterrupts();
|
||||
|
||||
candidate_num = get_curr_candidate_nums(false) + get_curr_candidate_nums(true);
|
||||
if (candidate_num == 0 && !t_thrd.pagewriter_cxt.shutdown_requested) {
|
||||
if (candidate_num == 0) {
|
||||
/* wakeup sub thread scan the buffer pool, init the candidate list */
|
||||
wakeup_sub_thread();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user