!1825 #I5BKFV[bugfix] 修复主备多次进行切换关闭失败的问题
Merge pull request !1825 from 陈玉标/solve_switchover_problem2
This commit is contained in:
@ -1214,12 +1214,14 @@ static void HandlePageWriterExit() {
|
|||||||
/* Let the pagewriter sub thread exit, then main pagewriter thread exits */
|
/* 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) {
|
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;
|
g_instance.ckpt_cxt_ctl->page_writer_sub_can_exit = true;
|
||||||
pg_write_barrier();
|
pg_write_barrier();
|
||||||
|
|
||||||
/* Wake up the sub thread to exit*/
|
ereport(LOG,
|
||||||
wakeup_sub_thread();
|
(errmodule(MOD_INCRE_CKPT),
|
||||||
/*Wait until all the sub pagewriter thread exit then */
|
errmsg("waiting all the pagewriter sub threads to exit")));
|
||||||
while (true) {
|
|
||||||
|
/* Wait until all the sub pagewriter thread exit then */
|
||||||
|
while (true) {
|
||||||
if (pg_atomic_read_u32(&g_instance.ckpt_cxt_ctl->current_page_writer_count) == 1) {
|
if (pg_atomic_read_u32(&g_instance.ckpt_cxt_ctl->current_page_writer_count) == 1) {
|
||||||
ereport(LOG,
|
ereport(LOG,
|
||||||
(errmodule(MOD_INCRE_CKPT),
|
(errmodule(MOD_INCRE_CKPT),
|
||||||
@ -1233,8 +1235,10 @@ static void HandlePageWriterExit() {
|
|||||||
/* Normal exit from the pagewriter is here */
|
/* Normal exit from the pagewriter is here */
|
||||||
proc_exit(0); /* done */
|
proc_exit(0); /* done */
|
||||||
}
|
}
|
||||||
pg_usleep(MILLISECOND_TO_MICROSECOND);
|
pg_usleep(MILLISECOND_TO_MICROSECOND);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ereport(LOG, (errmodule(MOD_INCRE_CKPT), errmsg("all the pagewriter threads exit")));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user