Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dviPm-0002a5-Py for pgsql-hackers@arkaria.postgresql.org; Sat, 23 Sep 2017 11:16:06 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1dviPl-0007Co-Ct for pgsql-hackers@arkaria.postgresql.org; Sat, 23 Sep 2017 11:16:05 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1dviOC-0004LK-C9 for pgsql-hackers@postgresql.org; Sat, 23 Sep 2017 11:14:28 +0000 Received: from smtprelay0124.b.hostedemail.com ([64.98.42.124] helo=smtprelay.b.hostedemail.com) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1dviO5-0008SL-3o for pgsql-hackers@postgresql.org; Sat, 23 Sep 2017 11:14:27 +0000 Received: from filter.hostedemail.com (10.5.19.248.rfc1918.com [10.5.19.248]) by smtprelay06.b.hostedemail.com (Postfix) with ESMTP id F0BA88D01E; Sat, 23 Sep 2017 11:14:18 +0000 (UTC) X-Session-Marker: 616C76686572726540616C76682E6E6F2D69702E6F7267 X-Spam-Summary: 50,0,0,,d41d8cd98f00b204,alvherre@alvh.no-ip.org,:::,RULES_HIT:41:355:379:599:871:967:973:988:989:1260:1311:1312:1313:1314:1345:1359:1437:1515:1516:1518:1519:1534:1538:1575:1594:1595:1596:1711:1714:1730:1747:1764:1777:1792:2393:2525:2560:2563:2682:2685:2689:2859:2915:2933:2937:2939:2942:2945:2947:2951:2954:3022:3138:3139:3140:3141:3142:3350:3865:3867:3868:3870:3871:3872:3874:3934:3936:3938:3941:3944:3947:3950:3953:3956:3959:4605:5007:6261:6748:7281:9025:9121:10004:10394:10400:10848:11232:11604:11658:11914:13439:13894:13895:14658:14721:14819:21080:21627:30045:30054:30069:30070:30090:30091,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:2,LUA_SUMMARY:none X-HE-Tag: shape10_2599a72317747 X-Filterd-Recvd-Size: 4492 Received: from alvin.alvh.no-ip.org (pd95c76e8.dip0.t-ipconnect.de [217.92.118.232]) (Authenticated sender: alvherre@alvh.no-ip.org) by omf09.b.hostedemail.com (Postfix) with ESMTPA; Sat, 23 Sep 2017 11:14:18 +0000 (UTC) Received: by alvin.alvh.no-ip.org (Postfix, from userid 1000) id 008CEF56; Sat, 23 Sep 2017 13:14:15 +0200 (CEST) Date: Sat, 23 Sep 2017 13:14:15 +0200 From: Alvaro Herrera To: Tom Lane Cc: pgsql-hackers@postgreSQL.org Subject: Re: Rethinking autovacuum.c memory handling Message-ID: <20170923111415.uswmkulp37k4bzcd@alvherre.pgsql> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="4rox7xnkwuxenwtj" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20170923103050.decvu4b3qqnjti67@alvherre.pgsql> User-Agent: NeoMutt/20170306-137-4415bd-dirty (1.8.0) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org --4rox7xnkwuxenwtj Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit 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 --4rox7xnkwuxenwtj Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="0001-Add-autovacuum-work-items-test-for-BRIN.patch" From 196bec86e957cc6413d1e4823cb891a0edc192de Mon Sep 17 00:00:00 2001 From: Alvaro Herrera 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 --4rox7xnkwuxenwtj Content-Type: text/plain Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers --4rox7xnkwuxenwtj--