pg.ddx.io pgsql-committers@postgresql.org mailing list archive
help / color / mirror / Atom feedpgsql: Increase upper limit for vacuum_cleanup_index_scale_factor
9+ messages / 5 participants
[nested] [flat]
Commits from this thread:
2019-04-15 1e87198182 0d68ad3fc2 Fix division by zero in _bt_vacuum_needs_cleanup()
2018-06-26 4d54543efa Fix upper limit for vacuum_cleanup_index_scale_factor
* pgsql: Increase upper limit for vacuum_cleanup_index_scale_factor
@ 2018-06-26 12:35 Alexander Korotkov <akorotkov@postgresql.org>
0 siblings, 2 replies; 9+ messages in thread
From: Alexander Korotkov @ 2018-06-26 12:35 UTC (permalink / raw)
To: pgsql-committers@lists.postgresql.org
Increase upper limit for vacuum_cleanup_index_scale_factor
Upper limits for vacuum_cleanup_index_scale_factor GUC and reloption
were initially set to 100.0 in 857f9c36. However, after further
discussion, it appears that some users like to disable B-tree cleanup
index scan completely (assuming there are no deleted pages).
vacuum_cleanup_index_scale_factor is used barely to protect against
stalled index statistics. And after detailed consideration it appears
that risk of stalled index statistics is low. And it would be nice to
allow advanced users setting higher values of
vacuum_cleanup_index_scale_factor. So, set upper limit for these
GUC and reloption to DBL_MAX.
Author: Alexander Korotkov
Reviewed-by: Masahiko Sawada
Discussion: https://postgr.es/m/CAC8Q8tJCb%3DgxhzcV7T6ctx7PY-Ux1oA-AsTJc6cAVNsQiYcCzA%40mail.gmail.com
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/6ca33a885bf892a7fa34020a2620c83ccec3cdd7
Modified Files
--------------
doc/src/sgml/config.sgml | 2 +-
src/backend/access/common/reloptions.c | 2 +-
src/backend/access/nbtree/nbtree.c | 8 +++++---
src/backend/utils/misc/guc.c | 2 +-
src/test/regress/expected/btree_index.out | 2 +-
5 files changed, 9 insertions(+), 7 deletions(-)
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: pgsql: Increase upper limit for vacuum_cleanup_index_scale_factor
@ 2018-06-26 12:59 Alexander Korotkov <a.korotkov@postgrespro.ru>
parent: Alexander Korotkov <akorotkov@postgresql.org>
1 sibling, 2 replies; 9+ messages in thread
From: Alexander Korotkov @ 2018-06-26 12:59 UTC (permalink / raw)
To: Alexander Korotkov <akorotkov@postgresql.org>; +Cc: pgsql-committers <pgsql-committers@lists.postgresql.org>
On Tue, Jun 26, 2018 at 3:35 PM Alexander Korotkov
<akorotkov@postgresql.org> wrote:
> vacuum_cleanup_index_scale_factor is used barely to protect against
> stalled index statistics. And after detailed consideration it appears
> that risk of stalled index statistics is low. And it would be nice to
> allow advanced users setting higher values of
> vacuum_cleanup_index_scale_factor. So, set upper limit for these
> GUC and reloption to DBL_MAX.
BTW, this line looks cumbersome.
+DETAIL: Valid values are between "0.000000" and
"179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.000000".
It's not something introduced by this patch, because other reloptions
behave the same. Should we change output format for real reloption
boundaries to '%g' (as guc.c does). It looks much better.
ERROR: -1 is outside the valid range for parameter "random_page_cost"
(0 .. 1.79769e+308)
------
Alexander Korotkov
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: pgsql: Increase upper limit for vacuum_cleanup_index_scale_factor
@ 2018-06-26 13:11 Alexander Korotkov <a.korotkov@postgrespro.ru>
parent: Alexander Korotkov <a.korotkov@postgrespro.ru>
1 sibling, 0 replies; 9+ messages in thread
From: Alexander Korotkov @ 2018-06-26 13:11 UTC (permalink / raw)
To: Alexander Korotkov <akorotkov@postgresql.org>; +Cc: pgsql-committers <pgsql-committers@lists.postgresql.org>
On Tue, Jun 26, 2018 at 3:59 PM Alexander Korotkov
<a.korotkov@postgrespro.ru> wrote:
>
> On Tue, Jun 26, 2018 at 3:35 PM Alexander Korotkov
> <akorotkov@postgresql.org> wrote:
> > vacuum_cleanup_index_scale_factor is used barely to protect against
> > stalled index statistics. And after detailed consideration it appears
> > that risk of stalled index statistics is low. And it would be nice to
> > allow advanced users setting higher values of
> > vacuum_cleanup_index_scale_factor. So, set upper limit for these
> > GUC and reloption to DBL_MAX.
>
> BTW, this line looks cumbersome.
>
> +DETAIL: Valid values are between "0.000000" and
> "179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.000000".
>
> It's not something introduced by this patch, because other reloptions
> behave the same. Should we change output format for real reloption
> boundaries to '%g' (as guc.c does). It looks much better.
>
> ERROR: -1 is outside the valid range for parameter "random_page_cost"
> (0 .. 1.79769e+308)
See attached patch changing output format for reloption real
boundaries from "%f" to "%g".
------
Alexander Korotkov
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company
Attachments:
change-reloption-real-boundaries-output-format.patch (application/octet-stream, 2.9K) download
diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 5671bb6830..fae865f3f2 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -1204,7 +1204,7 @@ parse_one_reloption(relopt_value *option, char *text_str, int text_len,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("value %s out of bounds for option \"%s\"",
value, option->gen->name),
- errdetail("Valid values are between \"%f\" and \"%f\".",
+ errdetail("Valid values are between \"%g\" and \"%g\".",
optreal->min, optreal->max)));
}
break;
diff --git a/src/test/regress/expected/btree_index.out b/src/test/regress/expected/btree_index.out
index 1ad33190a2..628d9be91b 100644
--- a/src/test/regress/expected/btree_index.out
+++ b/src/test/regress/expected/btree_index.out
@@ -165,7 +165,7 @@ select reloptions from pg_class WHERE oid = 'btree_idx1'::regclass;
-- Fail while setting improper values
create index btree_idx_err on btree_test(a) with (vacuum_cleanup_index_scale_factor = -10.0);
ERROR: value -10.0 out of bounds for option "vacuum_cleanup_index_scale_factor"
-DETAIL: Valid values are between "0.000000" and "179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.000000".
+DETAIL: Valid values are between "0" and "1.79769e+308".
create index btree_idx_err on btree_test(a) with (vacuum_cleanup_index_scale_factor = 100.0);
create index btree_idx_err on btree_test(a) with (vacuum_cleanup_index_scale_factor = 'string');
ERROR: invalid value for floating point option "vacuum_cleanup_index_scale_factor": string
diff --git a/src/test/regress/expected/reloptions.out b/src/test/regress/expected/reloptions.out
index df3c99d1eb..636151d4a4 100644
--- a/src/test/regress/expected/reloptions.out
+++ b/src/test/regress/expected/reloptions.out
@@ -16,10 +16,10 @@ ERROR: value 110 out of bounds for option "fillfactor"
DETAIL: Valid values are between "10" and "100".
CREATE TABLE reloptions_test2(i INT) WITH (autovacuum_analyze_scale_factor = -10.0);
ERROR: value -10.0 out of bounds for option "autovacuum_analyze_scale_factor"
-DETAIL: Valid values are between "0.000000" and "100.000000".
+DETAIL: Valid values are between "0" and "100".
CREATE TABLE reloptions_test2(i INT) WITH (autovacuum_analyze_scale_factor = 110.0);
ERROR: value 110.0 out of bounds for option "autovacuum_analyze_scale_factor"
-DETAIL: Valid values are between "0.000000" and "100.000000".
+DETAIL: Valid values are between "0" and "100".
-- Fail when option and namespace do not exist
CREATE TABLE reloptions_test2(i INT) WITH (not_existing_option=2);
ERROR: unrecognized parameter "not_existing_option"
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: pgsql: Increase upper limit for vacuum_cleanup_index_scale_factor
@ 2018-06-26 16:00 Tom Lane <tgl@sss.pgh.pa.us>
parent: Alexander Korotkov <a.korotkov@postgrespro.ru>
1 sibling, 1 reply; 9+ messages in thread
From: Tom Lane @ 2018-06-26 16:00 UTC (permalink / raw)
To: Alexander Korotkov <a.korotkov@postgrespro.ru>; +Cc: Alexander Korotkov <akorotkov@postgresql.org>; pgsql-committers <pgsql-committers@lists.postgresql.org>
Alexander Korotkov <a.korotkov@postgrespro.ru> writes:
> BTW, this line looks cumbersome.
> +DETAIL: Valid values are between "0.000000" and
> "179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.000000".
> It's not something introduced by this patch, because other reloptions
> behave the same. Should we change output format for real reloption
> boundaries to '%g' (as guc.c does). It looks much better.
> ERROR: -1 is outside the valid range for parameter "random_page_cost"
> (0 .. 1.79769e+308)
%g, unmodified, is a bad idea because it loses a lot of precision
in some cases (due to the assumption that nobody cares about more
than six digits). Maybe you could fix that by using %.15g or some
such, but...
I think that the original patch to use DBL_MAX was itself a bad idea
and should be rethought. It creates (what is in principle) a
platform-dependent limit, for no adequate justification. Why not
just set it to 1e9 or 1e10 or some such?
regards, tom lane
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: pgsql: Increase upper limit for vacuum_cleanup_index_scale_factor
@ 2018-06-26 17:22 Alexander Korotkov <a.korotkov@postgrespro.ru>
parent: Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 0 replies; 9+ messages in thread
From: Alexander Korotkov @ 2018-06-26 17:22 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-committers <pgsql-committers@lists.postgresql.org>
On Tue, Jun 26, 2018 at 7:00 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
>
> Alexander Korotkov <a.korotkov@postgrespro.ru> writes:
> > BTW, this line looks cumbersome.
>
> > +DETAIL: Valid values are between "0.000000" and
> > "179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.000000".
>
> > It's not something introduced by this patch, because other reloptions
> > behave the same. Should we change output format for real reloption
> > boundaries to '%g' (as guc.c does). It looks much better.
> > ERROR: -1 is outside the valid range for parameter "random_page_cost"
> > (0 .. 1.79769e+308)
>
> %g, unmodified, is a bad idea because it loses a lot of precision
> in some cases (due to the assumption that nobody cares about more
> than six digits). Maybe you could fix that by using %.15g or some
> such, but...
>
> I think that the original patch to use DBL_MAX was itself a bad idea
> and should be rethought. It creates (what is in principle) a
> platform-dependent limit, for no adequate justification. Why not
> just set it to 1e9 or 1e10 or some such?
Yes, I see that it was a bad idea, because many of buildfarm member
are turning red...
I choose DBL_MAX for the sake of uniformity, because we're currently
using DBL_MAX for floating point GUCs and reloptions, which allows
large values. But we didn't test them for overflow yet...
So, let's switch to 1e10 limit? Patch is attached.
------
Alexander Korotkov
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company
Attachments:
vacuum_cleanup_index_scale_factor-max-3.patch (application/octet-stream, 2.6K) download
diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml
index 574837889b..cc2873f536 100644
--- a/doc/src/sgml/config.sgml
+++ b/doc/src/sgml/config.sgml
@@ -6989,7 +6989,8 @@ COPY postgres_log FROM '/full/path/to/logfile.csv' WITH csv;
</para>
<para>
- The value should be non-negative.
+ The value can range from <literal>0</literal> to
+ <literal>10000000000</literal>.
When <varname>vacuum_cleanup_index_scale_factor</varname> is set to
<literal>0</literal>, index scans are never skipped during
<command>VACUUM</command> cleanup. The default value is <literal>0.1</literal>.
diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 5671bb6830..db84da0678 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -416,7 +416,7 @@ static relopt_real realRelOpts[] =
RELOPT_KIND_BTREE,
ShareUpdateExclusiveLock
},
- -1, 0.0, DBL_MAX
+ -1, 0.0, 1e10
},
/* list terminator */
{{NULL}}
diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c
index daa2894c5a..b05fb209bb 100644
--- a/src/backend/utils/misc/guc.c
+++ b/src/backend/utils/misc/guc.c
@@ -3253,7 +3253,7 @@ static struct config_real ConfigureNamesReal[] =
NULL
},
&vacuum_cleanup_index_scale_factor,
- 0.1, 0.0, DBL_MAX,
+ 0.1, 0.0, 1e10,
NULL, NULL, NULL
},
diff --git a/src/test/regress/expected/btree_index.out b/src/test/regress/expected/btree_index.out
index 1ad33190a2..0bd48dc5a0 100644
--- a/src/test/regress/expected/btree_index.out
+++ b/src/test/regress/expected/btree_index.out
@@ -165,7 +165,7 @@ select reloptions from pg_class WHERE oid = 'btree_idx1'::regclass;
-- Fail while setting improper values
create index btree_idx_err on btree_test(a) with (vacuum_cleanup_index_scale_factor = -10.0);
ERROR: value -10.0 out of bounds for option "vacuum_cleanup_index_scale_factor"
-DETAIL: Valid values are between "0.000000" and "179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.000000".
+DETAIL: Valid values are between "0.000000" and "10000000000.000000".
create index btree_idx_err on btree_test(a) with (vacuum_cleanup_index_scale_factor = 100.0);
create index btree_idx_err on btree_test(a) with (vacuum_cleanup_index_scale_factor = 'string');
ERROR: invalid value for floating point option "vacuum_cleanup_index_scale_factor": string
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: pgsql: Increase upper limit for vacuum_cleanup_index_scale_factor
@ 2019-04-14 19:59 Piotr Stefaniak <postgres@piotr-stefaniak.me>
parent: Alexander Korotkov <akorotkov@postgresql.org>
1 sibling, 1 reply; 9+ messages in thread
From: Piotr Stefaniak @ 2019-04-14 19:59 UTC (permalink / raw)
To: pgsql-committers@lists.postgresql.org <pgsql-committers@lists.postgresql.org>
On 26/06/2018 14.35, Alexander Korotkov wrote:
> Increase upper limit for vacuum_cleanup_index_scale_factor
>
> Upper limits for vacuum_cleanup_index_scale_factor GUC and reloption
> were initially set to 100.0 in 857f9c36. However, after further
> discussion, it appears that some users like to disable B-tree cleanup
> index scan completely (assuming there are no deleted pages).
>
> vacuum_cleanup_index_scale_factor is used barely to protect against
> stalled index statistics. And after detailed consideration it appears
> that risk of stalled index statistics is low. And it would be nice to
> allow advanced users setting higher values of
> vacuum_cleanup_index_scale_factor. So, set upper limit for these
> GUC and reloption to DBL_MAX.
UB Sanitizer points out that prev_num_heap_tuples is sometimes 0,
leading to division by 0 in
(info->num_heap_tuples - prev_num_heap_tuples) /
prev_num_heap_tuples >= cleanup_scale_factor)
which are currently lines 839-840 in nbtree.c.
Attaching my idea of a fix.
Attachments:
zero-divide-prev_num_heap_tuples.patch (text/x-patch, 633B) download
diff --git a/src/backend/access/nbtree/nbtree.c b/src/backend/access/nbtree/nbtree.c
index 7370379c6..caf84de1d 100644
--- a/src/backend/access/nbtree/nbtree.c
+++ b/src/backend/access/nbtree/nbtree.c
@@ -835,7 +835,9 @@ _bt_vacuum_needs_cleanup(IndexVacuumInfo *info)
prev_num_heap_tuples = metad->btm_last_cleanup_num_heap_tuples;
if (cleanup_scale_factor <= 0 ||
- prev_num_heap_tuples < 0 ||
+ prev_num_heap_tuples < 0)
+ result = true;
+ else if (prev_num_heap_tuples != 0 &&
(info->num_heap_tuples - prev_num_heap_tuples) /
prev_num_heap_tuples >= cleanup_scale_factor)
result = true;
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: pgsql: Increase upper limit for vacuum_cleanup_index_scale_factor
@ 2019-04-15 02:21 Alexander Korotkov <a.korotkov@postgrespro.ru>
parent: Piotr Stefaniak <postgres@piotr-stefaniak.me>
0 siblings, 1 reply; 9+ messages in thread
From: Alexander Korotkov @ 2019-04-15 02:21 UTC (permalink / raw)
To: Piotr Stefaniak <postgres@piotr-stefaniak.me>; +Cc: pgsql-committers@lists.postgresql.org <pgsql-committers@lists.postgresql.org>
Hi!
On Sun, Apr 14, 2019 at 11:00 PM Piotr Stefaniak
<postgres@piotr-stefaniak.me> wrote:
> On 26/06/2018 14.35, Alexander Korotkov wrote:
> > Increase upper limit for vacuum_cleanup_index_scale_factor
> >
> > Upper limits for vacuum_cleanup_index_scale_factor GUC and reloption
> > were initially set to 100.0 in 857f9c36. However, after further
> > discussion, it appears that some users like to disable B-tree cleanup
> > index scan completely (assuming there are no deleted pages).
> >
> > vacuum_cleanup_index_scale_factor is used barely to protect against
> > stalled index statistics. And after detailed consideration it appears
> > that risk of stalled index statistics is low. And it would be nice to
> > allow advanced users setting higher values of
> > vacuum_cleanup_index_scale_factor. So, set upper limit for these
> > GUC and reloption to DBL_MAX.
>
> UB Sanitizer points out that prev_num_heap_tuples is sometimes 0,
> leading to division by 0 in
> (info->num_heap_tuples - prev_num_heap_tuples) /
> prev_num_heap_tuples >= cleanup_scale_factor)
> which are currently lines 839-840 in nbtree.c.
>
> Attaching my idea of a fix.
Thank you for noticing. BTW, I've more trivial idea for fixing this: replace
prev_num_heap_tuples < 0
with
prev_num_heap_tuples <= 0
If prev_num_heap_tuples == 0, subsequent part of expression isn't
evaluated because result is known to be true. And I think it's right
to don't skip cleanup when prev_num_heap_tuples == 0.
------
Alexander Korotkov
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company
Attachments:
fix-division-by-zero-bt-vacuum-needs-cleanup.patch (application/octet-stream, 565B) download
diff --git a/src/backend/access/nbtree/nbtree.c b/src/backend/access/nbtree/nbtree.c
index 7370379c6a1..02fb352b94a 100644
--- a/src/backend/access/nbtree/nbtree.c
+++ b/src/backend/access/nbtree/nbtree.c
@@ -835,7 +835,7 @@ _bt_vacuum_needs_cleanup(IndexVacuumInfo *info)
prev_num_heap_tuples = metad->btm_last_cleanup_num_heap_tuples;
if (cleanup_scale_factor <= 0 ||
- prev_num_heap_tuples < 0 ||
+ prev_num_heap_tuples <= 0 ||
(info->num_heap_tuples - prev_num_heap_tuples) /
prev_num_heap_tuples >= cleanup_scale_factor)
result = true;
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: pgsql: Increase upper limit for vacuum_cleanup_index_scale_factor
@ 2019-04-15 08:23 Masahiko Sawada <sawada.mshk@gmail.com>
parent: Alexander Korotkov <a.korotkov@postgrespro.ru>
0 siblings, 1 reply; 9+ messages in thread
From: Masahiko Sawada @ 2019-04-15 08:23 UTC (permalink / raw)
To: Alexander Korotkov <a.korotkov@postgrespro.ru>; +Cc: Piotr Stefaniak <postgres@piotr-stefaniak.me>; pgsql-committers@lists.postgresql.org <pgsql-committers@lists.postgresql.org>
On Mon, Apr 15, 2019 at 11:57 AM Alexander Korotkov
<a.korotkov@postgrespro.ru> wrote:
>
> Hi!
>
> On Sun, Apr 14, 2019 at 11:00 PM Piotr Stefaniak
> <postgres@piotr-stefaniak.me> wrote:
> > On 26/06/2018 14.35, Alexander Korotkov wrote:
> > > Increase upper limit for vacuum_cleanup_index_scale_factor
> > >
> > > Upper limits for vacuum_cleanup_index_scale_factor GUC and reloption
> > > were initially set to 100.0 in 857f9c36. However, after further
> > > discussion, it appears that some users like to disable B-tree cleanup
> > > index scan completely (assuming there are no deleted pages).
> > >
> > > vacuum_cleanup_index_scale_factor is used barely to protect against
> > > stalled index statistics. And after detailed consideration it appears
> > > that risk of stalled index statistics is low. And it would be nice to
> > > allow advanced users setting higher values of
> > > vacuum_cleanup_index_scale_factor. So, set upper limit for these
> > > GUC and reloption to DBL_MAX.
> >
> > UB Sanitizer points out that prev_num_heap_tuples is sometimes 0,
> > leading to division by 0 in
> > (info->num_heap_tuples - prev_num_heap_tuples) /
> > prev_num_heap_tuples >= cleanup_scale_factor)
> > which are currently lines 839-840 in nbtree.c.
Thank you pointing out it.
> >
> > Attaching my idea of a fix.
>
> Thank you for noticing. BTW, I've more trivial idea for fixing this: replace
> prev_num_heap_tuples < 0
> with
> prev_num_heap_tuples <= 0
>
> If prev_num_heap_tuples == 0, subsequent part of expression isn't
> evaluated because result is known to be true. And I think it's right
> to don't skip cleanup when prev_num_heap_tuples == 0.
+1. It looks good to me.
Regards,
--
Masahiko Sawada
NIPPON TELEGRAPH AND TELEPHONE CORPORATION
NTT Open Source Software Center
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: pgsql: Increase upper limit for vacuum_cleanup_index_scale_factor
@ 2019-04-15 18:57 Alexander Korotkov <a.korotkov@postgrespro.ru>
parent: Masahiko Sawada <sawada.mshk@gmail.com>
0 siblings, 0 replies; 9+ messages in thread
From: Alexander Korotkov @ 2019-04-15 18:57 UTC (permalink / raw)
To: Masahiko Sawada <sawada.mshk@gmail.com>; +Cc: Piotr Stefaniak <postgres@piotr-stefaniak.me>; pgsql-committers@lists.postgresql.org <pgsql-committers@lists.postgresql.org>
On Mon, Apr 15, 2019 at 11:28 AM Masahiko Sawada <sawada.mshk@gmail.com> wrote:
> On Mon, Apr 15, 2019 at 11:57 AM Alexander Korotkov
> <a.korotkov@postgrespro.ru> wrote:
> >
> > Hi!
> >
> > On Sun, Apr 14, 2019 at 11:00 PM Piotr Stefaniak
> > <postgres@piotr-stefaniak.me> wrote:
> > > UB Sanitizer points out that prev_num_heap_tuples is sometimes 0,
> > > leading to division by 0 in
> > > (info->num_heap_tuples - prev_num_heap_tuples) /
> > > prev_num_heap_tuples >= cleanup_scale_factor)
> > > which are currently lines 839-840 in nbtree.c.
>
> Thank you pointing out it.
>
> > >
> > > Attaching my idea of a fix.
> >
> > Thank you for noticing. BTW, I've more trivial idea for fixing this: replace
> > prev_num_heap_tuples < 0
> > with
> > prev_num_heap_tuples <= 0
> >
> > If prev_num_heap_tuples == 0, subsequent part of expression isn't
> > evaluated because result is known to be true. And I think it's right
> > to don't skip cleanup when prev_num_heap_tuples == 0.
>
> +1. It looks good to me.
Thank you for the feedback!
Pushed.
------
Alexander Korotkov
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company
^ permalink raw reply [nested|flat] 9+ messages in thread
end of thread, other threads:[~2019-04-15 18:57 UTC | newest]
Thread overview: 9+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2018-06-26 12:35 pgsql: Increase upper limit for vacuum_cleanup_index_scale_factor Alexander Korotkov <akorotkov@postgresql.org>
2018-06-26 12:59 ` Alexander Korotkov <a.korotkov@postgrespro.ru>
2018-06-26 13:11 ` Alexander Korotkov <a.korotkov@postgrespro.ru>
2018-06-26 16:00 ` Tom Lane <tgl@sss.pgh.pa.us>
2018-06-26 17:22 ` Alexander Korotkov <a.korotkov@postgrespro.ru>
2019-04-14 19:59 ` Piotr Stefaniak <postgres@piotr-stefaniak.me>
2019-04-15 02:21 ` Alexander Korotkov <a.korotkov@postgrespro.ru>
2019-04-15 08:23 ` Masahiko Sawada <sawada.mshk@gmail.com>
2019-04-15 18:57 ` Alexander Korotkov <a.korotkov@postgrespro.ru>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox