From: | jian he <jian(dot)universality(at)gmail(dot)com> |
---|---|
To: | PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | autoprewarm main function not tested background worker not listed in pg_stat_activity |
Date: | 2023-12-29 07:21:00 |
Message-ID: | CACJufxGZ4TzRw76AE3==Rg+CxQfcihQZnNMdm_35UGurFdM5SA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi.
https://coverage.postgresql.org/contrib/pg_prewarm/autoprewarm.c.gcov.html
function autoprewarm_start_worker never gets tested, but
autoprewarm_start_worker listed in our doc
(https://www.postgresql.org/docs/16/pgprewarm.html)
Maybe we should test it.
also this part in function autoprewarm_main not tested.
247 : /* Compute the next dump time. */
248 0 : next_dump_time =
249 0 :
TimestampTzPlusMilliseconds(last_dump_time,
250 :
autoprewarm_interval * 1000);
251 : delay_in_ms =
252 0 :
TimestampDifferenceMilliseconds(GetCurrentTimestamp(),
253 :
next_dump_time);
254 :
255 : /* Perform a dump if it's time. */
256 0 : if (delay_in_ms <= 0)
257 : {
258 0 : last_dump_time = GetCurrentTimestamp();
259 0 : apw_dump_now(true, false);
260 0 : continue;
261 : }
262 :
263 : /* Sleep until the next dump time. */
264 0 : (void) WaitLatch(MyLatch,
265 : WL_LATCH_SET |
WL_TIMEOUT | WL_EXIT_ON_PM_DEATH,
266 : delay_in_ms,
267 : WAIT_EVENT_EXTENSION);
I don't fully understand this module, but I kind of get the meaning of
the worker_spi module.
i didn't configure shared_preload_libraries.
I changed from
worker.bgw_flags = BGWORKER_SHMEM_ACCESS;
to
worker.bgw_flags = BGWORKER_SHMEM_ACCESS |
BGWORKER_BACKEND_DATABASE_CONNECTION;
but still, the following query will not list the autoprewarm background worker.
SELECT datname, pid, state, backend_type, wait_event_type, wait_event
FROM pg_stat_activity;
I thought pg_stat_activity will list all related pid for this cluster.
but it seems not in this case.
So here, is it a good idea to make the autoprewarm background worker
listed in pg_stat_activity?
From | Date | Subject | |
---|---|---|---|
Next Message | Richard Guo | 2023-12-29 08:06:53 | Re: Revise the Asserts added to bimapset manipulation functions |
Previous Message | Amit Kapila | 2023-12-29 07:02:08 | Re: Synchronizing slots from primary to standby |