pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alvaro Herrera <alvherre@alvh.no-ip.org>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-hackers@postgreSQL.org
Subject: Re: Rethinking autovacuum.c memory handling
Date: Sat, 23 Sep 2017 13:14:15 +0200
Message-ID: <20170923111415.uswmkulp37k4bzcd@alvherre.pgsql> (raw)
In-Reply-To: <20170923103050.decvu4b3qqnjti67@alvherre.pgsql>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>

Alvaro Herrera wrote:

> One idea I just had is to somehow add it to src/test/modules/brin, and
> set up the postmaster in that test with autovacuum_naptime=1s.  I'll go
> check how feasible that is.  (By placing it there we could also verify
> that the index does indeed contain the index entries we expect, since it
> has pageinspect available.)

Yeah, this works, as per the attached patch.

-- 
Álvaro Herrera                https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Attachments:

0001-Add-autovacuum-work-items-test-for-BRIN.patch (text/plain, 2.6K) download From 196bec86e957cc6413d1e4823cb891a0edc192de Mon Sep 17 00:00:00 2001 From: Alvaro Herrera <alvherre@alvh.no-ip.org> Date: Sat, 23 Sep 2017 12:56:56 +0200 Subject: [PATCH] Add autovacuum work-items test for BRIN --- src/test/modules/brin/Makefile | 7 ++++-- src/test/modules/brin/t/01_workitems.pl | 39 +++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+), 2 deletions(-) create mode 100644 src/test/modules/brin/t/01_workitems.pl diff --git a/src/test/modules/brin/Makefile b/src/test/modules/brin/Makefile index dda84c23c7..18c5cafd5e 100644 --- a/src/test/modules/brin/Makefile +++ b/src/test/modules/brin/Makefile @@ -16,7 +16,7 @@ include $(top_builddir)/src/Makefile.global include $(top_srcdir)/contrib/contrib-global.mk endif -check: isolation-check +check: isolation-check prove-check isolation-check: | submake-isolation $(MKDIR_P) isolation_output @@ -24,7 +24,10 @@ isolation-check: | submake-isolation --outputdir=./isolation_output \ $(ISOLATIONCHECKS) -.PHONY: check isolation-check +prove-check: + $(prove_check) + +.PHONY: check isolation-check prove-check submake-isolation: $(MAKE) -C $(top_builddir)/src/test/isolation all diff --git a/src/test/modules/brin/t/01_workitems.pl b/src/test/modules/brin/t/01_workitems.pl new file mode 100644 index 0000000000..11c9981d40 --- /dev/null +++ b/src/test/modules/brin/t/01_workitems.pl @@ -0,0 +1,39 @@ +# Verify that work items work correctly + +use strict; +use warnings; + +use TestLib; +use Test::More tests => 2; +use PostgresNode; + +my $node = get_new_node('tango'); +$node->init; +$node->append_conf('postgresql.conf', 'autovacuum_naptime=1s'); +$node->start; + +$node->safe_psql('postgres', 'create extension pageinspect'); + +# Create a table with an autosummarizing BRIN index +$node->safe_psql('postgres', + 'create table brin_wi (a int) with (fillfactor = 10); + create index brin_wi_idx on brin_wi using brin (a) with (pages_per_range=1, autosummarize=on); + ' +); +my $count = $node->safe_psql('postgres', + "select count(*) from brin_page_items(get_raw_page('brin_wi_idx', 2), 'brin_wi_idx'::regclass)" +); +is($count, '1', "initial index state is correct"); + +$node->safe_psql('postgres', + 'insert into brin_wi select * from generate_series(1, 100)'); + +$node->poll_query_until('postgres', + "select count(*) > 1 from brin_page_items(get_raw_page('brin_wi_idx', 2), 'brin_wi_idx'::regclass)", + 't'); + +$count = $node->safe_psql('postgres', + "select count(*) > 1 from brin_page_items(get_raw_page('brin_wi_idx', 2), 'brin_wi_idx'::regclass)" +); +is($count, 't', "index got summarized"); +$node->stop; -- 2.11.0

view thread (9+ messages)  latest in thread

Message-ID: <20170923111415.uswmkulp37k4bzcd@alvherre.pgsql>
Permalink:  ../20170923111415.uswmkulp37k4bzcd@alvherre.pgsql/
Also on:    postgresql.org/message-id/20170923111415.uswmkulp37k4bzcd@alvherre.pgsql

 ·  · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: alvherre@alvh.no-ip.org, tgl@sss.pgh.pa.us
  Subject: Re: Rethinking autovacuum.c memory handling
  In-Reply-To: <20170923111415.uswmkulp37k4bzcd@alvherre.pgsql>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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