Skip to content

Commit 704f854

Browse files
[PGPRO-9336] Fix of isolation tests and beautify makefile
1 parent 9e78b97 commit 704f854

8 files changed

+718
-1586
lines changed

.travis.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,5 +33,3 @@ env:
3333
- PG_VERSION=13 LEVEL=hardcore
3434
- PG_VERSION=12
3535
- PG_VERSION=12 LEVEL=hardcore
36-
- PG_VERSION=11
37-
- PG_VERSION=11 LEVEL=hardcore

Makefile

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,15 @@ REGRESS = security rum rum_validate rum_hash ruminv timestamp orderby orderby_ha
3434

3535
TAP_TESTS = 1
3636

37+
# We cannot run isolation test for versions 12,13 in PGXS case
38+
# because 'pg_isolation_regress' is not copied to install
39+
# directory, see src/test/isolation/Makefile
40+
ifneq ($(MAJORVERSION),$(filter 12% 13%,$(MAJORVERSION)))
41+
ISOLATION = predicate-rum predicate-rum-2
42+
ISOLATION_OPTS = --load-extension=rum
43+
endif
44+
EXTRA_CLEAN = pglist_tmp
45+
3746
ifdef USE_PGXS
3847
PG_CONFIG = pg_config
3948
PGXS := $(shell $(PG_CONFIG) --pgxs)
@@ -69,8 +78,10 @@ rum--$(EXTVERSION).sql: $(DATA_first) $(DATA_updates)
6978
rum--%.sql: gen_rum_sql--%.pl
7079
perl $< > $@
7180

72-
install: installincludes
73-
81+
#
82+
# Make conditional targets to save backward compatibility with PG11, PG10 and PG9.6.
83+
#
84+
ifeq ($(MAJORVERSION), $(filter 9.6% 10% 11%, $(MAJORVERSION)))
7485
installincludes:
7586
$(INSTALL) -d '$(DESTDIR)$(includedir_server)/'
7687
$(INSTALL_DATA) $(addprefix $(srcdir)/, $(RELATIVE_INCLUDES)) '$(DESTDIR)$(includedir_server)/'
@@ -92,3 +103,4 @@ isolationcheck: | submake-isolation submake-rum temp-install
92103
$(pg_isolation_regress_check) \
93104
--temp-config $(top_srcdir)/contrib/rum/logical.conf \
94105
$(ISOLATIONCHECKS)
106+
endif

expected/predicate-rum-2.out

Lines changed: 340 additions & 260 deletions
Large diffs are not rendered by default.

expected/predicate-rum-2_1.out

Lines changed: 0 additions & 501 deletions
This file was deleted.

expected/predicate-rum.out

Lines changed: 342 additions & 280 deletions
Large diffs are not rendered by default.

expected/predicate-rum_1.out

Lines changed: 0 additions & 521 deletions
This file was deleted.

specs/predicate-rum-2.spec

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,24 +6,26 @@
66

77
setup
88
{
9-
CREATE EXTENSION rum;
10-
119
CREATE TABLE rum_tbl (id serial, tsv tsvector);
1210

1311
CREATE TABLE text_table (id1 serial, t text[]);
1412

15-
SELECT SETSEED(0.5);
16-
1713
INSERT INTO text_table(t) SELECT array[chr(i) || chr(j)] FROM generate_series(65,90) i,
1814
generate_series(65,90) j ;
1915

20-
INSERT INTO rum_tbl(tsv) SELECT to_tsvector('simple', t[1] ) FROM text_table;
21-
2216
DO $$
17+
DECLARE
18+
c integer := 17;
19+
a integer := 261;
20+
m integer := 6760;
21+
Xi integer := 228;
2322
BEGIN
24-
FOR j in 1..10 LOOP
25-
UPDATE rum_tbl SET tsv = tsv || q.t1 FROM (SELECT id1,to_tsvector('simple', t[1] )
26-
as t1 FROM text_table) as q WHERE id = (random()*q.id1)::integer;
23+
FOR i in 1..338 LOOP
24+
INSERT INTO rum_tbl(tsv) VALUES ('');
25+
FOR j in 1..10 LOOP
26+
UPDATE rum_tbl SET tsv = tsv || (SELECT to_tsvector(t[1]) FROM text_table WHERE id1 = Xi % 676 + 1) WHERE id = i;
27+
Xi = (a * Xi + c) % m;
28+
END LOOP;
2729
END LOOP;
2830
END;
2931
$$;
@@ -35,7 +37,6 @@ teardown
3537
{
3638
DROP TABLE text_table;
3739
DROP TABLE rum_tbl;
38-
DROP EXTENSION rum;
3940
}
4041

4142
session "s1"

specs/predicate-rum.spec

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,24 +6,26 @@
66

77
setup
88
{
9-
CREATE EXTENSION rum;
10-
119
CREATE TABLE rum_tbl (id serial, tsv tsvector);
1210

1311
CREATE TABLE text_table (id1 serial, t text[]);
1412

15-
SELECT SETSEED(0.5);
16-
1713
INSERT INTO text_table(t) SELECT array[chr(i) || chr(j)] FROM generate_series(65,90) i,
1814
generate_series(65,90) j ;
1915

20-
INSERT INTO rum_tbl(tsv) SELECT to_tsvector('simple', t[1] ) FROM text_table;
21-
2216
DO $$
17+
DECLARE
18+
c integer := 17;
19+
a integer := 261;
20+
m integer := 6760;
21+
Xi integer := 228;
2322
BEGIN
24-
FOR j in 1..10 LOOP
25-
UPDATE rum_tbl SET tsv = tsv || q.t1 FROM (SELECT id1,to_tsvector('simple', t[1] )
26-
as t1 FROM text_table) as q WHERE id = (random()*q.id1)::integer;
23+
FOR i in 1..338 LOOP
24+
INSERT INTO rum_tbl(tsv) VALUES ('');
25+
FOR j in 1..10 LOOP
26+
UPDATE rum_tbl SET tsv = tsv || (SELECT to_tsvector(t[1]) FROM text_table WHERE id1 = Xi % 676 + 1) WHERE id = i;
27+
Xi = (a * Xi + c) % m;
28+
END LOOP;
2729
END LOOP;
2830
END;
2931
$$;
@@ -35,7 +37,6 @@ teardown
3537
{
3638
DROP TABLE text_table;
3739
DROP TABLE rum_tbl;
38-
DROP EXTENSION rum;
3940
}
4041

4142
session "s1"

0 commit comments

Comments
 (0)