Thread: Regression test coverage of GiST index build is awful

Regression test coverage of GiST index build is awful

From
Tom Lane
Date:
This tells a pretty scary story:

https://coverage.postgresql.org/src/backend/access/gist/index.html

In particular, gistbuildbuffers.c is not entered *at all*, and
gistbuild.c is only 21% covered.

I noticed this after adding an assertion that I expected
gistInitBuildBuffers to fail on, and nonetheless getting
through check-world just fine.

Why is this so bad?  It's not like the gist regression test isn't
ridiculously expensive already; I'd have expected it to provide
darn near 100% coverage for what it's costing in runtime.

            regards, tom lane



Re: Regression test coverage of GiST index build is awful

From
Alexander Korotkov
Date:
On Wed, Apr 24, 2019 at 9:31 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
> This tells a pretty scary story:
>
> https://coverage.postgresql.org/src/backend/access/gist/index.html
>
> In particular, gistbuildbuffers.c is not entered *at all*, and
> gistbuild.c is only 21% covered.
>
> I noticed this after adding an assertion that I expected
> gistInitBuildBuffers to fail on, and nonetheless getting
> through check-world just fine.
>
> Why is this so bad?  It's not like the gist regression test isn't
> ridiculously expensive already; I'd have expected it to provide
> darn near 100% coverage for what it's costing in runtime.

I don't think there is any idea behind this.  Seems to be just oversight.

Do you like me to write a patch improving coverage here?

------
Alexander Korotkov
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company



Re: Regression test coverage of GiST index build is awful

From
Tom Lane
Date:
Alexander Korotkov <a.korotkov@postgrespro.ru> writes:
> On Wed, Apr 24, 2019 at 9:31 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> Why is this so bad?  It's not like the gist regression test isn't
>> ridiculously expensive already; I'd have expected it to provide
>> darn near 100% coverage for what it's costing in runtime.

> I don't think there is any idea behind this.  Seems to be just oversight.

After poking at it a bit, the answer seems to be that the gist buffering
code isn't invoked till we get to an index size of effective_cache_size/4,
which by default would be way too much for any regression test index.

> Do you like me to write a patch improving coverage here?

Somebody needs to... that's an awful lot of code to not be testing.

            regards, tom lane