Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitd9c9c43

Browse files
committed
Fix fractional vacuum_cost_delay.
Commit4753ef3 changed vacuum_delay_point() to use the WaitLatch() API,to fix the problem that vacuum could keep running for a very long timeafter the postmaster died.Unfortunately, that broke commitcaf626b's support for fractionalvacuum_cost_delay, which shipped in PostgreSQL 12. WaitLatch() works inwhole milliseconds.For now, revert the change from commit4753ef3, but add an explicitcheck for postmaster death. That's an extra system call on systemsother than Linux and FreeBSD, but that overhead doesn't matter muchconsidering that we willingly went to sleep and woke up again. (Inlater work, we might add higher resolution timeouts to the latch API sothat we could do this with our standard programming pattern, but thatwouldn't be back-patched.)Back-patch to 14, where commit4753ef3 arrived.Reported-by: Melanie Plageman <melanieplageman@gmail.com>Discussion:https://postgr.es/m/CAAKRu_b-q0hXCBUCAATh0Z4Zi6UkiC0k2DFgoD3nC-r3SkR3tg%40mail.gmail.com
1 parent0606691 commitd9c9c43

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

‎src/backend/commands/vacuum.c

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
#include"postmaster/bgworker_internals.h"
5050
#include"storage/bufmgr.h"
5151
#include"storage/lmgr.h"
52+
#include"storage/pmsignal.h"
5253
#include"storage/proc.h"
5354
#include"storage/procarray.h"
5455
#include"utils/acl.h"
@@ -2223,11 +2224,18 @@ vacuum_delay_point(void)
22232224
if (msec>VacuumCostDelay*4)
22242225
msec=VacuumCostDelay*4;
22252226

2226-
(void)WaitLatch(MyLatch,
2227-
WL_LATCH_SET |WL_TIMEOUT |WL_EXIT_ON_PM_DEATH,
2228-
msec,
2229-
WAIT_EVENT_VACUUM_DELAY);
2230-
ResetLatch(MyLatch);
2227+
pgstat_report_wait_start(WAIT_EVENT_VACUUM_DELAY);
2228+
pg_usleep(msec*1000);
2229+
pgstat_report_wait_end();
2230+
2231+
/*
2232+
* We don't want to ignore postmaster death during very long vacuums
2233+
* with vacuum_cost_delay configured. We can't use the usual
2234+
* WaitLatch() approach here because we want microsecond-based sleep
2235+
* durations above.
2236+
*/
2237+
if (IsUnderPostmaster&& !PostmasterIsAlive())
2238+
exit(1);
22312239

22322240
VacuumCostBalance=0;
22332241

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp