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

Commita4d5872

Browse files
committed
Disallow the cost balancing code from resulting in a zero cost limit, which
causes a division-by-zero error in the vacuum code. This can happen when thereare more workers than cost limit units.Per report from Galy Lee in<200705310914.l4V9E6JA094603@wwwmaster.postgresql.org>.
1 parent2b438c1 commita4d5872

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

‎src/backend/postmaster/autovacuum.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
*
1111
*
1212
* IDENTIFICATION
13-
* $PostgreSQL: pgsql/src/backend/postmaster/autovacuum.c,v 1.48 2007/06/08 21:09:49 alvherre Exp $
13+
* $PostgreSQL: pgsql/src/backend/postmaster/autovacuum.c,v 1.49 2007/06/08 21:21:28 alvherre Exp $
1414
*
1515
*-------------------------------------------------------------------------
1616
*/
@@ -1599,7 +1599,11 @@ autovac_balance_cost(void)
15991599
intlimit= (int)
16001600
(cost_avail*worker->wi_cost_limit_base /cost_total);
16011601

1602-
worker->wi_cost_limit=Min(limit,worker->wi_cost_limit_base);
1602+
/*
1603+
* We put a lower bound of 1 to the cost_limit, to avoid division-
1604+
* by-zero in the vacuum code.
1605+
*/
1606+
worker->wi_cost_limit=Max(Min(limit,worker->wi_cost_limit_base),1);
16031607

16041608
elog(DEBUG2,"autovac_balance_cost(pid=%u db=%u, rel=%u, cost_limit=%d, cost_delay=%d)",
16051609
worker->wi_workerpid,worker->wi_dboid,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp