Skip to content

Commit 404ba54

Browse files
committed
Test BRIN autosummarization
There was no coverage for this code. Reported-by: Nikolay Shaplov, Tom Lane Discussion: https://postgr.es/m/2700647.XEouBYNZic@x200m https://postgr.es/m/13849.1506114543@sss.pgh.pa.us
1 parent aa6b7b7 commit 404ba54

File tree

2 files changed

+44
-2
lines changed

2 files changed

+44
-2
lines changed

src/test/modules/brin/Makefile

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,18 @@ include $(top_builddir)/src/Makefile.global
1616
include $(top_srcdir)/contrib/contrib-global.mk
1717
endif
1818

19-
check: isolation-check
19+
check: isolation-check prove-check
2020

2121
isolation-check: | submake-isolation
2222
$(MKDIR_P) isolation_output
2323
$(pg_isolation_regress_check) \
2424
--outputdir=./isolation_output \
2525
$(ISOLATIONCHECKS)
2626

27-
.PHONY: check isolation-check
27+
prove-check:
28+
$(prove_check)
29+
30+
.PHONY: check isolation-check prove-check
2831

2932
submake-isolation:
3033
$(MAKE) -C $(top_builddir)/src/test/isolation all
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Verify that work items work correctly
2+
3+
use strict;
4+
use warnings;
5+
6+
use TestLib;
7+
use Test::More tests => 2;
8+
use PostgresNode;
9+
10+
my $node = get_new_node('tango');
11+
$node->init;
12+
$node->append_conf('postgresql.conf', 'autovacuum_naptime=1s');
13+
$node->start;
14+
15+
$node->safe_psql('postgres', 'create extension pageinspect');
16+
17+
# Create a table with an autosummarizing BRIN index
18+
$node->safe_psql('postgres',
19+
'create table brin_wi (a int) with (fillfactor = 10);
20+
create index brin_wi_idx on brin_wi using brin (a) with (pages_per_range=1, autosummarize=on);
21+
'
22+
);
23+
my $count = $node->safe_psql('postgres',
24+
"select count(*) from brin_page_items(get_raw_page('brin_wi_idx', 2), 'brin_wi_idx'::regclass)"
25+
);
26+
is($count, '1', "initial index state is correct");
27+
28+
$node->safe_psql('postgres',
29+
'insert into brin_wi select * from generate_series(1, 100)');
30+
31+
$node->poll_query_until('postgres',
32+
"select count(*) > 1 from brin_page_items(get_raw_page('brin_wi_idx', 2), 'brin_wi_idx'::regclass)",
33+
't');
34+
35+
$count = $node->safe_psql('postgres',
36+
"select count(*) > 1 from brin_page_items(get_raw_page('brin_wi_idx', 2), 'brin_wi_idx'::regclass)"
37+
);
38+
is($count, 't', "index got summarized");
39+
$node->stop;

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy