Skip to content

Commit 02e7c0d

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

8 files changed

+721
-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: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ REGRESS = security rum rum_validate rum_hash ruminv timestamp orderby orderby_ha
3434

3535
TAP_TESTS = 1
3636

37+
ISOLATION = predicate-rum predicate-rum-2
38+
ISOLATION_OPTS = --load-extension=rum
39+
EXTRA_CLEAN = pglist_tmp
40+
3741
ifdef USE_PGXS
3842
PG_CONFIG = pg_config
3943
PGXS := $(shell $(PG_CONFIG) --pgxs)
@@ -51,6 +55,14 @@ else
5155
REGRESS += array
5256
endif
5357

58+
# We cannot run isolation test for versions 12,13 in PGXS case
59+
# because 'pg_isolation_regress' is not copied to install
60+
# directory, see src/test/isolation/Makefile
61+
ifeq ($(MAJORVERSION),$(filter 12% 13%,$(MAJORVERSION)))
62+
undefine ISOLATION
63+
undefine ISOLATION_OPTS
64+
endif
65+
5466
# For 9.6-11 we have to make specific target with tap tests
5567
ifeq ($(MAJORVERSION), $(filter 9.6% 10% 11%, $(MAJORVERSION)))
5668
wal-check: temp-install
@@ -69,8 +81,10 @@ rum--$(EXTVERSION).sql: $(DATA_first) $(DATA_updates)
6981
rum--%.sql: gen_rum_sql--%.pl
7082
perl $< > $@
7183

72-
install: installincludes
73-
84+
#
85+
# Make conditional targets to save backward compatibility with PG11, PG10 and PG9.6.
86+
#
87+
ifeq ($(MAJORVERSION), $(filter 9.6% 10% 11%, $(MAJORVERSION)))
7488
installincludes:
7589
$(INSTALL) -d '$(DESTDIR)$(includedir_server)/'
7690
$(INSTALL_DATA) $(addprefix $(srcdir)/, $(RELATIVE_INCLUDES)) '$(DESTDIR)$(includedir_server)/'
@@ -92,3 +106,4 @@ isolationcheck: | submake-isolation submake-rum temp-install
92106
$(pg_isolation_regress_check) \
93107
--temp-config $(top_srcdir)/contrib/rum/logical.conf \
94108
$(ISOLATIONCHECKS)
109+
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)