代码回合:解决pg_os_threads视图中IncrBgWriter线程信息缺失的问题https://gitee.com/opengauss/openGauss-server/pulls/401

This commit is contained in:
zhang_xubo
2020-12-30 17:04:18 +08:00
committed by zhaowenhao
parent 0be8111b94
commit 15c3b05737

View File

@ -824,6 +824,8 @@ void incre_ckpt_background_writer_main(void)
pg_time_t now = (pg_time_t) time(NULL);
t_thrd.bgwriter_cxt.next_flush_time = now + u_sess->attr.attr_storage.BgWriterDelay;
pgstat_report_appname("IncrBgWriter");
pgstat_report_activity(STATE_IDLE, NULL);
/* Loop forever */
for (;;) {
int rc;
@ -857,7 +859,7 @@ void incre_ckpt_background_writer_main(void)
proc_exit(0);
}
}
pgstat_report_activity(STATE_IDLE, NULL);
sleep_time = get_bgwriter_sleep_time();
rc = WaitLatch(&t_thrd.proc->procLatch, WL_LATCH_SET | WL_TIMEOUT | WL_POSTMASTER_DEATH, sleep_time);
if (rc & WL_POSTMASTER_DEATH) {
@ -866,6 +868,8 @@ void incre_ckpt_background_writer_main(void)
/* Clear any already-pending wakeups */
ResetLatch(&t_thrd.proc->procLatch);
pgstat_report_activity(STATE_RUNNING, NULL);
now = (pg_time_t) time(NULL);
t_thrd.bgwriter_cxt.next_flush_time = now + u_sess->attr.attr_storage.BgWriterDelay;