pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
tweak to a few index tests to hits ambuildempty() routine.
21+ messages / 7 participants
[nested] [flat]

Commits from this thread:
  2022-09-25 1d2fec990c 7a84c35fe6  Avoid loss of code coverage with unlogged-index test cases.
  2022-06-25 2f2e24d90c  Use --no-unlogged-table-data in t/027_stream_regress.pl.
  2022-04-25 4fb5c794e5  Cover brin/gin/gist/spgist ambuildempty routines in regression tests
* tweak to a few index tests to hits ambuildempty() routine.
@ 2021-11-29 05:04  Amul Sul <sulamul@gmail.com>
  0 siblings, 3 replies; 21+ messages in thread

From: Amul Sul @ 2021-11-29 05:04 UTC (permalink / raw)
  To: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>

Hi,

Attached patch is doing small changes to brin, gin & gist index tests
to use an unlogged table without changing the original intention of
those tests and that is able to hit ambuildempty() routing which is
otherwise not reachable by the current tests.

-- 
Regards,
Amul Sul
EDB: http://www.enterprisedb.com

Attachments:

v1_index_test_for_ambuildempty.patch (application/octet-stream, 3.3K) download diff --git a/src/test/regress/expected/brin.out b/src/test/regress/expected/brin.out index e53d6e48856..ae4c424e79f 100644 --- a/src/test/regress/expected/brin.out +++ b/src/test/regress/expected/brin.out @@ -484,7 +484,7 @@ ERROR: block number out of range: -1 SELECT brin_summarize_range('brin_summarize_idx', 4294967296); ERROR: block number out of range: 4294967296 -- test value merging in add_value -CREATE TABLE brintest_2 (n numrange); +CREATE UNLOGGED TABLE brintest_2 (n numrange); CREATE INDEX brinidx_2 ON brintest_2 USING brin (n); INSERT INTO brintest_2 VALUES ('empty'); INSERT INTO brintest_2 VALUES (numrange(0, 2^1000::numeric)); diff --git a/src/test/regress/expected/gin.out b/src/test/regress/expected/gin.out index 6402e89c7ff..1a0c3c6167f 100644 --- a/src/test/regress/expected/gin.out +++ b/src/test/regress/expected/gin.out @@ -74,7 +74,7 @@ select count(*) > 0 as ok from gin_test_tbl where i @> array[1]; reset gin_fuzzy_search_limit; -- Test optimization of empty queries -create temp table t_gin_test_tbl(i int4[], j int4[]); +create unlogged table t_gin_test_tbl(i int4[], j int4[]); create index on t_gin_test_tbl using gin (i, j); insert into t_gin_test_tbl values diff --git a/src/test/regress/expected/gist.out b/src/test/regress/expected/gist.out index 90edb4061d4..c1af87f7f32 100644 --- a/src/test/regress/expected/gist.out +++ b/src/test/regress/expected/gist.out @@ -36,7 +36,7 @@ reindex index gist_pointidx; -- -- Test Index-only plans on GiST indexes -- -create table gist_tbl (b box, p point, c circle); +create unlogged table gist_tbl (b box, p point, c circle); insert into gist_tbl select box(point(0.05*i, 0.05*i), point(0.05*i, 0.05*i)), point(0.05*i, 0.05*i), diff --git a/src/test/regress/sql/brin.sql b/src/test/regress/sql/brin.sql index 3bd866d947a..33a30fcf777 100644 --- a/src/test/regress/sql/brin.sql +++ b/src/test/regress/sql/brin.sql @@ -449,7 +449,7 @@ SELECT brin_summarize_range('brin_summarize_idx', -1); SELECT brin_summarize_range('brin_summarize_idx', 4294967296); -- test value merging in add_value -CREATE TABLE brintest_2 (n numrange); +CREATE UNLOGGED TABLE brintest_2 (n numrange); CREATE INDEX brinidx_2 ON brintest_2 USING brin (n); INSERT INTO brintest_2 VALUES ('empty'); INSERT INTO brintest_2 VALUES (numrange(0, 2^1000::numeric)); diff --git a/src/test/regress/sql/gin.sql b/src/test/regress/sql/gin.sql index 5194afcc1f5..746880937bb 100644 --- a/src/test/regress/sql/gin.sql +++ b/src/test/regress/sql/gin.sql @@ -52,7 +52,7 @@ select count(*) > 0 as ok from gin_test_tbl where i @> array[1]; reset gin_fuzzy_search_limit; -- Test optimization of empty queries -create temp table t_gin_test_tbl(i int4[], j int4[]); +create unlogged table t_gin_test_tbl(i int4[], j int4[]); create index on t_gin_test_tbl using gin (i, j); insert into t_gin_test_tbl values diff --git a/src/test/regress/sql/gist.sql b/src/test/regress/sql/gist.sql index b9d398ea941..3849b649a2c 100644 --- a/src/test/regress/sql/gist.sql +++ b/src/test/regress/sql/gist.sql @@ -41,7 +41,7 @@ reindex index gist_pointidx; -- Test Index-only plans on GiST indexes -- -create table gist_tbl (b box, p point, c circle); +create unlogged table gist_tbl (b box, p point, c circle); insert into gist_tbl select box(point(0.05*i, 0.05*i), point(0.05*i, 0.05*i)),
^ permalink raw reply [nested|flat] 21+ messages in thread

* Re: tweak to a few index tests to hits ambuildempty() routine.
@ 2022-01-18 06:25  Rushabh Lathia <rushabh.lathia@gmail.com>
  parent: Amul Sul <sulamul@gmail.com>
  2 siblings, 0 replies; 21+ messages in thread

From: Rushabh Lathia @ 2022-01-18 06:25 UTC (permalink / raw)
  To: Amul Sul <sulamul@gmail.com>; +Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>

On Mon, Nov 29, 2021 at 10:34 AM Amul Sul <sulamul@gmail.com> wrote:

> Hi,
>
> Attached patch is doing small changes to brin, gin & gist index tests
> to use an unlogged table without changing the original intention of
> those tests and that is able to hit ambuildempty() routing which is
> otherwise not reachable by the current tests.
>

+1 for the idea as it does the better code coverage.



>
> --
> Regards,
> Amul Sul
> EDB: http://www.enterprisedb.com
>


-- 
Rushabh Lathia

^ permalink  raw  reply  [nested|flat] 21+ messages in thread

* Re: tweak to a few index tests to hits ambuildempty() routine.
@ 2022-04-25 13:05  Alvaro Herrera <alvherre@alvh.no-ip.org>
  parent: Amul Sul <sulamul@gmail.com>
  2 siblings, 1 reply; 21+ messages in thread

From: Alvaro Herrera @ 2022-04-25 13:05 UTC (permalink / raw)
  To: Amul Sul <sulamul@gmail.com>; +Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>

On 2021-Nov-29, Amul Sul wrote:

> Attached patch is doing small changes to brin, gin & gist index tests
> to use an unlogged table without changing the original intention of
> those tests and that is able to hit ambuildempty() routing which is
> otherwise not reachable by the current tests.

I added one change to include spgist too, which was uncovered, and
pushed this.

Thanks for the patch!

-- 
Álvaro Herrera         PostgreSQL Developer  —  https://www.EnterpriseDB.com/
"I am amazed at [the pgsql-sql] mailing list for the wonderful support, and
lack of hesitasion in answering a lost soul's question, I just wished the rest
of the mailing list could be like this."                               (Fotis)
               (http://archives.postgresql.org/pgsql-sql/2006-06/msg00265.php)





^ permalink  raw  reply  [nested|flat] 21+ messages in thread

* Re: tweak to a few index tests to hits ambuildempty() routine.
@ 2022-04-25 13:34  Alvaro Herrera <alvherre@alvh.no-ip.org>
  parent: Alvaro Herrera <alvherre@alvh.no-ip.org>
  0 siblings, 1 reply; 21+ messages in thread

From: Alvaro Herrera @ 2022-04-25 13:34 UTC (permalink / raw)
  To: Amul Sul <sulamul@gmail.com>; +Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>

On 2022-Apr-25, Alvaro Herrera wrote:

> I added one change to include spgist too, which was uncovered, and
> pushed this.

Looking into the recoveryCheck failure in buildfarm.

-- 
Álvaro Herrera        Breisgau, Deutschland  —  https://www.EnterpriseDB.com/





^ permalink  raw  reply  [nested|flat] 21+ messages in thread

* Re: tweak to a few index tests to hits ambuildempty() routine.
@ 2022-04-25 13:53  Alvaro Herrera <alvherre@alvh.no-ip.org>
  parent: Alvaro Herrera <alvherre@alvh.no-ip.org>
  0 siblings, 2 replies; 21+ messages in thread

From: Alvaro Herrera @ 2022-04-25 13:53 UTC (permalink / raw)
  To: Amul Sul <sulamul@gmail.com>; +Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>

On 2022-Apr-25, Alvaro Herrera wrote:

> On 2022-Apr-25, Alvaro Herrera wrote:
> 
> > I added one change to include spgist too, which was uncovered, and
> > pushed this.
> 
> Looking into the recoveryCheck failure in buildfarm.

Hmm, so 027_stream_regress.pl is not prepared to deal with any unlogged
tables that may be left in the regression database (which is what my
spgist addition did).  I first tried doing a TRUNCATE of the unlogged
table, but that doesn't work either, and it turns out that the
regression database does not have any UNLOGGED relations.  Maybe that's
something we need to cater for, eventually, but for now dropping the
table suffices.  I have pushed that.

-- 
Álvaro Herrera               48°01'N 7°57'E  —  https://www.EnterpriseDB.com/
Tom: There seems to be something broken here.
Teodor: I'm in sackcloth and ashes...  Fixed.
        http://archives.postgresql.org/message-id/482D1632.8010507@sigaev.ru





^ permalink  raw  reply  [nested|flat] 21+ messages in thread

* Re: tweak to a few index tests to hits ambuildempty() routine.
@ 2022-04-25 13:57  Amul Sul <sulamul@gmail.com>
  parent: Alvaro Herrera <alvherre@alvh.no-ip.org>
  1 sibling, 0 replies; 21+ messages in thread

From: Amul Sul @ 2022-04-25 13:57 UTC (permalink / raw)
  To: Alvaro Herrera <alvherre@alvh.no-ip.org>; +Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>

On Mon, Apr 25, 2022 at 7:23 PM Alvaro Herrera <alvherre@alvh.no-ip.org> wrote:
>
> On 2022-Apr-25, Alvaro Herrera wrote:
>
> > On 2022-Apr-25, Alvaro Herrera wrote:
> >
> > > I added one change to include spgist too, which was uncovered, and
> > > pushed this.
> >

Thanks for the commit with the improvement.

Regards,
Amul





^ permalink  raw  reply  [nested|flat] 21+ messages in thread

* Re: tweak to a few index tests to hits ambuildempty() routine.
@ 2022-04-25 14:05  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Alvaro Herrera <alvherre@alvh.no-ip.org>
  1 sibling, 1 reply; 21+ messages in thread

From: Tom Lane @ 2022-04-25 14:05 UTC (permalink / raw)
  To: Alvaro Herrera <alvherre@alvh.no-ip.org>; +Cc: Amul Sul <sulamul@gmail.com>; PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>

Alvaro Herrera <alvherre@alvh.no-ip.org> writes:
> Hmm, so 027_stream_regress.pl is not prepared to deal with any unlogged
> tables that may be left in the regression database (which is what my
> spgist addition did).  I first tried doing a TRUNCATE of the unlogged
> table, but that doesn't work either, and it turns out that the
> regression database does not have any UNLOGGED relations.  Maybe that's
> something we need to cater for, eventually, but for now dropping the
> table suffices.  I have pushed that.

It does seem like the onus should be on 027_stream_regress.pl to
deal with that, rather than restricting what the core tests can
leave behind.

Maybe we could have it look for unlogged tables and drop them
before making the dumps?  Although I don't understand why
TRUNCATE wouldn't do the job equally well.

			regards, tom lane





^ permalink  raw  reply  [nested|flat] 21+ messages in thread

* Re: tweak to a few index tests to hits ambuildempty() routine.
@ 2022-05-21 06:15  Noah Misch <noah@leadboat.com>
  parent: Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 21+ messages in thread

From: Noah Misch @ 2022-05-21 06:15 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Alvaro Herrera <alvherre@alvh.no-ip.org>; Amul Sul <sulamul@gmail.com>; PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>

On Mon, Apr 25, 2022 at 10:05:08AM -0400, Tom Lane wrote:
> Alvaro Herrera <alvherre@alvh.no-ip.org> writes:
> > Hmm, so 027_stream_regress.pl is not prepared to deal with any unlogged
> > tables that may be left in the regression database (which is what my
> > spgist addition did).  I first tried doing a TRUNCATE of the unlogged
> > table, but that doesn't work either, and it turns out that the
> > regression database does not have any UNLOGGED relations.  Maybe that's
> > something we need to cater for, eventually, but for now dropping the
> > table suffices.  I have pushed that.
> 
> It does seem like the onus should be on 027_stream_regress.pl to
> deal with that, rather than restricting what the core tests can
> leave behind.

Yeah.  Using "pg_dumpall --no-unlogged-table-data", as attached, suffices.

> Maybe we could have it look for unlogged tables and drop them
> before making the dumps?  Although I don't understand why
> TRUNCATE wouldn't do the job equally well.

After TRUNCATE, one still gets a setval for sequences and a zero-row COPY for
tables.  When dumping a standby or using --no-unlogged-table-data, those
commands are absent.

Attachments:

stream-regress-unlogged-v1.patch (text/plain, 975B) download Author: Noah Misch <noah@leadboat.com> Commit: Noah Misch <noah@leadboat.com> Use --no-unlogged-table-data in t/027_stream_regress.pl. This removes the need to drop unlogged relations in the src/test/regress suite, like commit dec8ad367e46180f826d5b6dc820fbecba1b71d2 did. Reviewed by FIXME. Discussion: https://postgr.es/m/39945.1650895508@sss.pgh.pa.us diff --git a/src/test/recovery/t/027_stream_regress.pl b/src/test/recovery/t/027_stream_regress.pl index fdb4ea0..7982ac0 100644 --- a/src/test/recovery/t/027_stream_regress.pl +++ b/src/test/recovery/t/027_stream_regress.pl @@ -100,7 +100,8 @@ $node_primary->wait_for_catchup($node_standby_1, 'replay', command_ok( [ 'pg_dumpall', '-f', $outputdir . '/primary.dump', - '--no-sync', '-p', $node_primary->port + '--no-sync', '-p', $node_primary->port, + '--no-unlogged-table-data' # if unlogged, standby has schema only ], 'dump primary server'); command_ok(
^ permalink raw reply [nested|flat] 21+ messages in thread

* Re: tweak to a few index tests to hits ambuildempty() routine.
@ 2022-05-22 04:24  Thomas Munro <thomas.munro@gmail.com>
  parent: Noah Misch <noah@leadboat.com>
  0 siblings, 1 reply; 21+ messages in thread

From: Thomas Munro @ 2022-05-22 04:24 UTC (permalink / raw)
  To: Noah Misch <noah@leadboat.com>; +Cc: Tom Lane <tgl@sss.pgh.pa.us>; Alvaro Herrera <alvherre@alvh.no-ip.org>; Amul Sul <sulamul@gmail.com>; PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>

On Sat, May 21, 2022 at 6:15 PM Noah Misch <noah@leadboat.com> wrote:
> On Mon, Apr 25, 2022 at 10:05:08AM -0400, Tom Lane wrote:
> > Alvaro Herrera <alvherre@alvh.no-ip.org> writes:
> > > Hmm, so 027_stream_regress.pl is not prepared to deal with any unlogged
> > > tables that may be left in the regression database (which is what my
> > > spgist addition did).  I first tried doing a TRUNCATE of the unlogged
> > > table, but that doesn't work either, and it turns out that the
> > > regression database does not have any UNLOGGED relations.  Maybe that's
> > > something we need to cater for, eventually, but for now dropping the
> > > table suffices.  I have pushed that.
> >
> > It does seem like the onus should be on 027_stream_regress.pl to
> > deal with that, rather than restricting what the core tests can
> > leave behind.
>
> Yeah.  Using "pg_dumpall --no-unlogged-table-data", as attached, suffices.

                'pg_dumpall', '-f', $outputdir . '/primary.dump',
-               '--no-sync', '-p', $node_primary->port
+               '--no-sync',  '-p', $node_primary->port,
+               '--no-unlogged-table-data'    # if unlogged, standby
has schema only

LGTM, except for the stray extra whitespace.  I tested by reverting
dec8ad36 locally, at which point "gmake check" still passed but "gmake
-C src/test/recovery/ check PROVE_TESTS=t/027_stream_regress.pl
PROVE_FLAGS=-v" failed, and then your change fixed that.





^ permalink  raw  reply  [nested|flat] 21+ messages in thread

* Re: tweak to a few index tests to hits ambuildempty() routine.
@ 2022-05-22 04:54  Noah Misch <noah@leadboat.com>
  parent: Thomas Munro <thomas.munro@gmail.com>
  0 siblings, 0 replies; 21+ messages in thread

From: Noah Misch @ 2022-05-22 04:54 UTC (permalink / raw)
  To: Thomas Munro <thomas.munro@gmail.com>; +Cc: Tom Lane <tgl@sss.pgh.pa.us>; Alvaro Herrera <alvherre@alvh.no-ip.org>; Amul Sul <sulamul@gmail.com>; PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>

On Sun, May 22, 2022 at 04:24:16PM +1200, Thomas Munro wrote:
> On Sat, May 21, 2022 at 6:15 PM Noah Misch <noah@leadboat.com> wrote:
> > On Mon, Apr 25, 2022 at 10:05:08AM -0400, Tom Lane wrote:
> > > Alvaro Herrera <alvherre@alvh.no-ip.org> writes:
> > > > Hmm, so 027_stream_regress.pl is not prepared to deal with any unlogged
> > > > tables that may be left in the regression database (which is what my
> > > > spgist addition did).  I first tried doing a TRUNCATE of the unlogged
> > > > table, but that doesn't work either, and it turns out that the
> > > > regression database does not have any UNLOGGED relations.  Maybe that's
> > > > something we need to cater for, eventually, but for now dropping the
> > > > table suffices.  I have pushed that.
> > >
> > > It does seem like the onus should be on 027_stream_regress.pl to
> > > deal with that, rather than restricting what the core tests can
> > > leave behind.
> >
> > Yeah.  Using "pg_dumpall --no-unlogged-table-data", as attached, suffices.
> 
>                 'pg_dumpall', '-f', $outputdir . '/primary.dump',
> -               '--no-sync', '-p', $node_primary->port
> +               '--no-sync',  '-p', $node_primary->port,
> +               '--no-unlogged-table-data'    # if unlogged, standby
> has schema only
> 
> LGTM, except for the stray extra whitespace.

perltidy contributes the prior-line whitespace change.





^ permalink  raw  reply  [nested|flat] 21+ messages in thread

* Re: tweak to a few index tests to hits ambuildempty() routine.
@ 2022-09-12 08:47  a.kozhemyakin@postgrespro.ru
  parent: Amul Sul <sulamul@gmail.com>
  2 siblings, 1 reply; 21+ messages in thread

From: a.kozhemyakin@postgrespro.ru @ 2022-09-12 08:47 UTC (permalink / raw)
  To: pgsql-hackers@lists.postgresql.org

Hi,

The commit 4fb5c794e5 eliminates the ginbulkdelete() test coverage 
provided by the commit 4c51a2d1e4 two years ago.
With the following Assert added:
@@ -571,7 +571,7 @@ ginbulkdelete(IndexVacuumInfo *info, 
IndexBulkDeleteResult *stats,
         Buffer          buffer;
         BlockNumber rootOfPostingTree[BLCKSZ / (sizeof(IndexTupleData) + 
sizeof(ItemId))];
         uint32          nRoot;
-
+       Assert(0);
         gvs.tmpCxt = AllocSetContextCreate(CurrentMemoryContext,
                                                                          
   "Gin vacuum temporary context",
                                                                          
   ALLOCSET_DEFAULT_SIZES);
I have check-world passed successfully.

Amul Sul писал 2021-11-29 12:04:
> Hi,
> 
> Attached patch is doing small changes to brin, gin & gist index tests
> to use an unlogged table without changing the original intention of
> those tests and that is able to hit ambuildempty() routing which is
> otherwise not reachable by the current tests.





^ permalink  raw  reply  [nested|flat] 21+ messages in thread

* Re: tweak to a few index tests to hits ambuildempty() routine.
@ 2022-09-14 06:46  a.kozhemyakin@postgrespro.ru
  parent: a.kozhemyakin@postgrespro.ru
  0 siblings, 1 reply; 21+ messages in thread

From: a.kozhemyakin@postgrespro.ru @ 2022-09-14 06:46 UTC (permalink / raw)
  To: pgsql-hackers@lists.postgresql.org, Amul Sul <sulamul@gmail.com>

I still wonder, if assert doesn't catch why that place is marked as 
covered here?
https://coverage.postgresql.org/src/backend/access/gin/ginvacuum.c.gcov.html

a.kozhemyakin@postgrespro.ru писал 2022-09-12 15:47:
> Hi,
> 
> The commit 4fb5c794e5 eliminates the ginbulkdelete() test coverage
> provided by the commit 4c51a2d1e4 two years ago.
> With the following Assert added:
> @@ -571,7 +571,7 @@ ginbulkdelete(IndexVacuumInfo *info,
> IndexBulkDeleteResult *stats,
>         Buffer          buffer;
>         BlockNumber rootOfPostingTree[BLCKSZ / (sizeof(IndexTupleData)
> + sizeof(ItemId))];
>         uint32          nRoot;
> -
> +       Assert(0);
>         gvs.tmpCxt = AllocSetContextCreate(CurrentMemoryContext,
> 
>     "Gin vacuum temporary context",
> 
>     ALLOCSET_DEFAULT_SIZES);
> I have check-world passed successfully.
> 
> Amul Sul писал 2021-11-29 12:04:
>> Hi,
>> 
>> Attached patch is doing small changes to brin, gin & gist index tests
>> to use an unlogged table without changing the original intention of
>> those tests and that is able to hit ambuildempty() routing which is
>> otherwise not reachable by the current tests.





^ permalink  raw  reply  [nested|flat] 21+ messages in thread

* Re: tweak to a few index tests to hits ambuildempty() routine.
@ 2022-09-14 07:28  Amul Sul <sulamul@gmail.com>
  parent: a.kozhemyakin@postgrespro.ru
  0 siblings, 1 reply; 21+ messages in thread

From: Amul Sul @ 2022-09-14 07:28 UTC (permalink / raw)
  To: a.kozhemyakin@postgrespro.ru; +Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>

On Wed, Sep 14, 2022 at 12:16 PM <a.kozhemyakin@postgrespro.ru> wrote:
>
> I still wonder, if assert doesn't catch why that place is marked as
> covered here?
> https://coverage.postgresql.org/src/backend/access/gin/ginvacuum.c.gcov.html
>

Probably other tests cover that.

Regards,
Amul





^ permalink  raw  reply  [nested|flat] 21+ messages in thread

* Re: tweak to a few index tests to hits ambuildempty() routine.
@ 2022-09-21 07:10  a.kozhemyakin@postgrespro.ru
  parent: Amul Sul <sulamul@gmail.com>
  0 siblings, 2 replies; 21+ messages in thread

From: a.kozhemyakin@postgrespro.ru @ 2022-09-21 07:10 UTC (permalink / raw)
  To: Amul Sul <sulamul@gmail.com>; +Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>; thomas.munro@gmail.com; tgl@sss.pgh.pa.us; alvherre@alvh.no-ip.org; sulamul@gmail.com; noah@leadboat.com

After analyzing this, I found out why we don't reach that Assert but we 
have coverage shown - firstly, it reached via another test, vacuum; 
secondly, it depends on the gcc optimization flag. We reach that Assert 
only when using -O0.
If we build with -O2 or -Og that function is not reached (due to 
different results of the heap_prune_satisfies_vacuum() check inside 
heap_page_prune()).
But as  the make checks mostly (including the buildfarm testing) 
performed  with -O2/-Og, it looks like that after 4fb5c794e5 we have 
lost the coverage provided by the 4c51a2d1e4.

Amul Sul писал 2022-09-14 14:28:
> On Wed, Sep 14, 2022 at 12:16 PM <a.kozhemyakin@postgrespro.ru> wrote:
>> 
>> I still wonder, if assert doesn't catch why that place is marked as
>> covered here?
>> https://coverage.postgresql.org/src/backend/access/gin/ginvacuum.c.gcov.html
>> 
> 
> Probably other tests cover that.
> 
> Regards,
> Amul





^ permalink  raw  reply  [nested|flat] 21+ messages in thread

* Re: tweak to a few index tests to hits ambuildempty() routine.
@ 2022-09-21 11:58  Alvaro Herrera <alvherre@alvh.no-ip.org>
  parent: a.kozhemyakin@postgrespro.ru
  1 sibling, 0 replies; 21+ messages in thread

From: Alvaro Herrera @ 2022-09-21 11:58 UTC (permalink / raw)
  To: a.kozhemyakin@postgrespro.ru; +Cc: Amul Sul <sulamul@gmail.com>; PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>; thomas.munro@gmail.com; tgl@sss.pgh.pa.us; noah@leadboat.com

On 2022-Sep-21, a.kozhemyakin@postgrespro.ru wrote:

> After analyzing this, I found out why we don't reach that Assert but we have
> coverage shown - firstly, it reached via another test, vacuum; secondly, it
> depends on the gcc optimization flag. We reach that Assert only when using
> -O0.
> If we build with -O2 or -Og that function is not reached (due to different
> results of the heap_prune_satisfies_vacuum() check inside
> heap_page_prune()).
> But as  the make checks mostly (including the buildfarm testing) performed
> with -O2/-Og, it looks like that after 4fb5c794e5 we have lost the coverage
> provided by the 4c51a2d1e4.

Hmm, so if we merely revert the change to gin.sql then we still won't
get the coverage back?  I was thinking that a simple change would be to
revert the change from temp to unlogged for that table, and create
another unlogged table; but maybe that's not enough.  Do we need a
better test for GIN vacuuming that works regardless of the optimization
level?

-- 
Álvaro Herrera               48°01'N 7°57'E  —  https://www.EnterpriseDB.com/
"Investigación es lo que hago cuando no sé lo que estoy haciendo"
(Wernher von Braun)





^ permalink  raw  reply  [nested|flat] 21+ messages in thread

* Re: tweak to a few index tests to hits ambuildempty() routine.
@ 2022-09-24 17:20  Noah Misch <noah@leadboat.com>
  parent: a.kozhemyakin@postgrespro.ru
  1 sibling, 1 reply; 21+ messages in thread

From: Noah Misch @ 2022-09-24 17:20 UTC (permalink / raw)
  To: a.kozhemyakin@postgrespro.ru; +Cc: Amul Sul <sulamul@gmail.com>; PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>; thomas.munro@gmail.com; tgl@sss.pgh.pa.us; alvherre@alvh.no-ip.org

On Wed, Sep 21, 2022 at 02:10:42PM +0700, a.kozhemyakin@postgrespro.ru wrote:
> After analyzing this, I found out why we don't reach that Assert but we have
> coverage shown - firstly, it reached via another test, vacuum; secondly, it
> depends on the gcc optimization flag. We reach that Assert only when using
> -O0.
> If we build with -O2 or -Og that function is not reached (due to different
> results of the heap_prune_satisfies_vacuum() check inside
> heap_page_prune()).

With "make check MAX_CONNECTIONS=1", does that difference between -O0 and -O2
still appear?  Compiler optimization shouldn't consistently change pruning
decisions.  It could change pruning decisions probabilistically, by changing
which parallel actions overlap.  If the difference disappears under
MAX_CONNECTIONS=1, the system is likely fine.





^ permalink  raw  reply  [nested|flat] 21+ messages in thread

* Re: tweak to a few index tests to hits ambuildempty() routine.
@ 2022-09-25 13:49  a.kozhemyakin@postgrespro.ru
  parent: Noah Misch <noah@leadboat.com>
  0 siblings, 1 reply; 21+ messages in thread

From: a.kozhemyakin@postgrespro.ru @ 2022-09-25 13:49 UTC (permalink / raw)
  To: Noah Misch <noah@leadboat.com>; +Cc: Amul Sul <sulamul@gmail.com>; PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>; thomas.munro@gmail.com; tgl@sss.pgh.pa.us; alvherre@alvh.no-ip.org

Yes, with MAX_CONNECTIONS=1 and -O2 the function ginbulkdelete() is 
reached while the vacuum test.
But my point is that after 4fb5c794e5 for most developer setups and 
buildfarm members, e.g.:
https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=guaibasaurus&dt=2022-09-25%2001%3A01%3A1...
https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=tayra&dt=2022-09-24%2020%3A40%3A00
the ginbulkdelete() most probably is not tested.
In other words, it seems that we've just lost the effect of 4c51a2d1e4:
Add a test case that exercises vacuum's deletion of empty GIN
posting pages.  Since this is a temp table, it should now work
reliably to delete a bunch of rows and immediately VACUUM.
Before the preceding commit, this would not have had the desired
effect, at least not in parallel regression tests.

Noah Misch писал 2022-09-25 00:20:
> On Wed, Sep 21, 2022 at 02:10:42PM +0700, a.kozhemyakin@postgrespro.ru 
> wrote:
>> After analyzing this, I found out why we don't reach that Assert but 
>> we have
>> coverage shown - firstly, it reached via another test, vacuum; 
>> secondly, it
>> depends on the gcc optimization flag. We reach that Assert only when 
>> using
>> -O0.
>> If we build with -O2 or -Og that function is not reached (due to 
>> different
>> results of the heap_prune_satisfies_vacuum() check inside
>> heap_page_prune()).
> 
> With "make check MAX_CONNECTIONS=1", does that difference between -O0 
> and -O2
> still appear?  Compiler optimization shouldn't consistently change 
> pruning
> decisions.  It could change pruning decisions probabilistically, by 
> changing
> which parallel actions overlap.  If the difference disappears under
> MAX_CONNECTIONS=1, the system is likely fine.





^ permalink  raw  reply  [nested|flat] 21+ messages in thread

* Re: tweak to a few index tests to hits ambuildempty() routine.
@ 2022-09-25 14:49  Tom Lane <tgl@sss.pgh.pa.us>
  parent: a.kozhemyakin@postgrespro.ru
  0 siblings, 1 reply; 21+ messages in thread

From: Tom Lane @ 2022-09-25 14:49 UTC (permalink / raw)
  To: a.kozhemyakin@postgrespro.ru; +Cc: Noah Misch <noah@leadboat.com>; Amul Sul <sulamul@gmail.com>; PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>; thomas.munro@gmail.com; alvherre@alvh.no-ip.org

a.kozhemyakin@postgrespro.ru writes:
> But my point is that after 4fb5c794e5 for most developer setups and 
> buildfarm members, e.g.:
> https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=guaibasaurus&dt=2022-09-25%2001%3A01%3A1...
> https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=tayra&dt=2022-09-24%2020%3A40%3A00
> the ginbulkdelete() most probably is not tested.
> In other words, it seems that we've just lost the effect of 4c51a2d1e4:
> Add a test case that exercises vacuum's deletion of empty GIN
> posting pages.

Yeah.  You can see that the coverage-test animal is not reaching it
anymore:
https://coverage.postgresql.org/src/backend/access/gin/ginvacuum.c.gcov.html

So it seems clear that 4fb5c794e5 made at least some coverage worse
not better.  I think we'd better rejigger it to add some new indexes
not repurpose old ones.

			regards, tom lane





^ permalink  raw  reply  [nested|flat] 21+ messages in thread

* Re: tweak to a few index tests to hits ambuildempty() routine.
@ 2022-09-25 15:51  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 21+ messages in thread

From: Tom Lane @ 2022-09-25 15:51 UTC (permalink / raw)
  To: a.kozhemyakin@postgrespro.ru; +Cc: Noah Misch <noah@leadboat.com>; Amul Sul <sulamul@gmail.com>; PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>; thomas.munro@gmail.com; alvherre@alvh.no-ip.org

I wrote:
> Yeah.  You can see that the coverage-test animal is not reaching it
> anymore:
> https://coverage.postgresql.org/src/backend/access/gin/ginvacuum.c.gcov.html

That's what it's saying *now*, but after rereading this whole thread
I see that it apparently said something different last week.  So the
coverage is probabilistic, which squares with this discussion and
with some tests I just did locally.  That's not good.  I shudder to
imagine how much time somebody might waste trying to locate a bug
in this area, if a test failure appears and disappears regardless
of code changes they make while chasing it.

I propose that we revert 4fb5c794e and instead add separate test
cases that just create unlogged indexes (I guess they don't actually
need to *do* anything with them?).  Looks like dec8ad367 could be
reverted as well, in view of 2f2e24d90.

			regards, tom lane





^ permalink  raw  reply  [nested|flat] 21+ messages in thread

* Re: tweak to a few index tests to hits ambuildempty() routine.
@ 2022-09-25 15:57  Alvaro Herrera <alvherre@alvh.no-ip.org>
  parent: Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 21+ messages in thread

From: Alvaro Herrera @ 2022-09-25 15:57 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: a.kozhemyakin@postgrespro.ru, Noah Misch <noah@leadboat.com>; Amul Sul <sulamul@gmail.com>; PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>; thomas.munro@gmail.com

On 2022-Sep-25, Tom Lane wrote:

> That's what it's saying *now*, but after rereading this whole thread
> I see that it apparently said something different last week.  So the
> coverage is probabilistic, which squares with this discussion and
> with some tests I just did locally.  That's not good.

Completely agreed.

> I propose that we revert 4fb5c794e and instead add separate test
> cases that just create unlogged indexes (I guess they don't actually
> need to *do* anything with them?).

WFM.  I can do it next week, or feel free to do so if you want.

> Looks like dec8ad367 could be reverted as well, in view of 2f2e24d90.

Yeah, sounds good.

-- 
Álvaro Herrera               48°01'N 7°57'E  —  https://www.EnterpriseDB.com/





^ permalink  raw  reply  [nested|flat] 21+ messages in thread

* Re: tweak to a few index tests to hits ambuildempty() routine.
@ 2022-09-25 16:19  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Alvaro Herrera <alvherre@alvh.no-ip.org>
  0 siblings, 0 replies; 21+ messages in thread

From: Tom Lane @ 2022-09-25 16:19 UTC (permalink / raw)
  To: Alvaro Herrera <alvherre@alvh.no-ip.org>; +Cc: a.kozhemyakin@postgrespro.ru, Noah Misch <noah@leadboat.com>; Amul Sul <sulamul@gmail.com>; PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>; thomas.munro@gmail.com

Alvaro Herrera <alvherre@alvh.no-ip.org> writes:
> On 2022-Sep-25, Tom Lane wrote:
>> I propose that we revert 4fb5c794e and instead add separate test
>> cases that just create unlogged indexes (I guess they don't actually
>> need to *do* anything with them?).

> WFM.  I can do it next week, or feel free to do so if you want.

On it now.

			regards, tom lane





^ permalink  raw  reply  [nested|flat] 21+ messages in thread


end of thread, other threads:[~2022-09-25 16:19 UTC | newest]

Thread overview: 21+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2021-11-29 05:04 tweak to a few index tests to hits ambuildempty() routine. Amul Sul <sulamul@gmail.com>
2022-01-18 06:25 ` Rushabh Lathia <rushabh.lathia@gmail.com>
2022-04-25 13:05 ` Alvaro Herrera <alvherre@alvh.no-ip.org>
2022-04-25 13:34   ` Alvaro Herrera <alvherre@alvh.no-ip.org>
2022-04-25 13:53     ` Alvaro Herrera <alvherre@alvh.no-ip.org>
2022-04-25 13:57       ` Amul Sul <sulamul@gmail.com>
2022-04-25 14:05       ` Tom Lane <tgl@sss.pgh.pa.us>
2022-05-21 06:15         ` Noah Misch <noah@leadboat.com>
2022-05-22 04:24           ` Thomas Munro <thomas.munro@gmail.com>
2022-05-22 04:54             ` Noah Misch <noah@leadboat.com>
2022-09-12 08:47 ` a.kozhemyakin@postgrespro.ru
2022-09-14 06:46   ` a.kozhemyakin@postgrespro.ru
2022-09-14 07:28     ` Amul Sul <sulamul@gmail.com>
2022-09-21 07:10       ` a.kozhemyakin@postgrespro.ru
2022-09-21 11:58         ` Alvaro Herrera <alvherre@alvh.no-ip.org>
2022-09-24 17:20         ` Noah Misch <noah@leadboat.com>
2022-09-25 13:49           ` a.kozhemyakin@postgrespro.ru
2022-09-25 14:49             ` Tom Lane <tgl@sss.pgh.pa.us>
2022-09-25 15:51               ` Tom Lane <tgl@sss.pgh.pa.us>
2022-09-25 15:57                 ` Alvaro Herrera <alvherre@alvh.no-ip.org>
2022-09-25 16:19                   ` Tom Lane <tgl@sss.pgh.pa.us>

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