Content-Length: 269844 | pFad | http://github.com/postgrespro/postgres/commit/4753ef37e0eda4ba0af614022d18fcbc5a946cc9

9B Use a WaitLatch for vacuum/autovacuum sleeping · postgrespro/postgres@4753ef3 · GitHub
Skip to content

Commit 4753ef3

Browse files
committed
Use a WaitLatch for vacuum/autovacuum sleeping
Instead of using pg_usleep() in vacuum_delay_point(), use a WaitLatch. This has the advantage that we will realize if the postmaster has been killed since the last time we decided to sleep while vacuuming. Reviewed-by: Thomas Munro Discussion: https://postgr.es/m/CAFh8B=kcdk8k-Y21RfXPu5dX=bgPqJ8TC3p_qxR_ygdBS=JN5w@mail.gmail.com
1 parent 54bb91c commit 4753ef3

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/backend/commands/vacuum.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2080,9 +2080,11 @@ vacuum_delay_point(void)
20802080
if (msec > VacuumCostDelay * 4)
20812081
msec = VacuumCostDelay * 4;
20822082

2083-
pgstat_report_wait_start(WAIT_EVENT_VACUUM_DELAY);
2084-
pg_usleep((long) (msec * 1000));
2085-
pgstat_report_wait_end();
2083+
(void) WaitLatch(MyLatch,
2084+
WL_LATCH_SET | WL_TIMEOUT | WL_EXIT_ON_PM_DEATH,
2085+
msec,
2086+
WAIT_EVENT_VACUUM_DELAY);
2087+
ResetLatch(MyLatch);
20862088

20872089
VacuumCostBalance = 0;
20882090

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/postgrespro/postgres/commit/4753ef37e0eda4ba0af614022d18fcbc5a946cc9

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy