Skip to content

Commit 2ad36ba

Browse files
[PGPRO-9336] Fix of isolation tests and beautify makefile
1 parent b6e5430 commit 2ad36ba

9 files changed

+741
-1591
lines changed

.travis.yml

-7
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,3 @@ env:
3535
- PG_VERSION=13 LEVEL=hardcore
3636
- PG_VERSION=12
3737
- PG_VERSION=12 LEVEL=hardcore
38-
- PG_VERSION=11
39-
- PG_VERSION=11 LEVEL=hardcore
40-
41-
matrix:
42-
allow_failures:
43-
- env: PG_VERSION=11
44-
- env: PG_VERSION=11 LEVEL=hardcore

Makefile

+17
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,20 @@ REGRESS = security rum rum_validate rum_hash ruminv timestamp orderby orderby_ha
3030

3131
TAP_TESTS = 1
3232

33+
ISOLATION = predicate-rum predicate-rum-2
34+
ISOLATION_OPTS = --load-extension=rum
3335
EXTRA_CLEAN = pglist_tmp
3436

3537
ifdef USE_PGXS
38+
39+
# We cannot run isolation test for versions 12,13 in PGXS case
40+
# because 'pg_isolation_regress' is not copied to install
41+
# directory, see src/test/isolation/Makefile
42+
ifeq ($(MAJORVERSION),$(filter 12% 13%,$(MAJORVERSION)))
43+
undefine ISOLATION
44+
undefine ISOLATION_OPTS
45+
endif
46+
3647
PG_CONFIG = pg_config
3748
PGXS := $(shell $(PG_CONFIG) --pgxs)
3849
include $(PGXS)
@@ -60,6 +71,11 @@ wal-check: temp-install
6071
check: wal-check
6172
endif
6273

74+
#
75+
# Make conditional targets to save backward compatibility with PG11, PG10 and PG9.6.
76+
#
77+
ifeq ($(MAJORVERSION), $(filter 9.6% 10% 11%, $(MAJORVERSION)))
78+
6379
install: installincludes
6480

6581
installincludes:
@@ -83,3 +99,4 @@ isolationcheck: | submake-isolation submake-rum temp-install
8399
$(pg_isolation_regress_check) \
84100
--temp-config $(top_srcdir)/contrib/rum/logical.conf \
85101
$(ISOLATIONCHECKS)
102+
endif

expected/predicate-rum-2.out

+340-260
Large diffs are not rendered by default.

expected/predicate-rum-2_1.out

-501
This file was deleted.

expected/predicate-rum.out

+342-280
Large diffs are not rendered by default.

expected/predicate-rum_1.out

-521
This file was deleted.

meson.build

+14-2
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ rum_sources = files(
2424
if host_system == 'windows'
2525
rum_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
2626
'--NAME', 'rum',
27-
'--FILEDESC', 'rum - provides access method to work with the RUM indexes.',])
27+
'--FILEDESC', 'RUM index access method',])
2828
endif
2929

3030
rum = shared_module('rum',
@@ -87,10 +87,22 @@ tests += {
8787
'expr',
8888
'array',
8989
],
90+
'regress_args': [
91+
'--temp-config', files('logical.conf')
92+
],
9093
},
9194
'tap': {
9295
'tests': [
9396
't/001_wal.pl',
9497
],
9598
},
96-
}
99+
'isolation': {
100+
'specs': [
101+
'predicate-rum',
102+
'predicate-rum-2',
103+
],
104+
'regress_args': [
105+
'--temp-config', files('logical.conf'),
106+
],
107+
},
108+
}

specs/predicate-rum-2.spec

+14-10
Original file line numberDiff line numberDiff line change
@@ -6,24 +6,29 @@
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-
16+
-- We need to use pseudorandom to generate values for test table
17+
-- In this case we use linear congruential generator because random()
18+
-- function may generate different outputs with different systems
2219
DO $$
20+
DECLARE
21+
c integer := 17;
22+
a integer := 261;
23+
m integer := 6760;
24+
Xi integer := 228;
2325
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;
26+
FOR i in 1..338 LOOP
27+
INSERT INTO rum_tbl(tsv) VALUES ('');
28+
FOR j in 1..10 LOOP
29+
UPDATE rum_tbl SET tsv = tsv || (SELECT to_tsvector(t[1]) FROM text_table WHERE id1 = Xi % 676 + 1) WHERE id = i;
30+
Xi = (a * Xi + c) % m;
31+
END LOOP;
2732
END LOOP;
2833
END;
2934
$$;
@@ -35,7 +40,6 @@ teardown
3540
{
3641
DROP TABLE text_table;
3742
DROP TABLE rum_tbl;
38-
DROP EXTENSION rum;
3943
}
4044

4145
session "s1"

specs/predicate-rum.spec

+14-10
Original file line numberDiff line numberDiff line change
@@ -6,24 +6,29 @@
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-
16+
-- We need to use pseudorandom to generate values for test table
17+
-- In this case we use linear congruential generator because random()
18+
-- function may generate different outputs with different systems
2219
DO $$
20+
DECLARE
21+
c integer := 17;
22+
a integer := 261;
23+
m integer := 6760;
24+
Xi integer := 228;
2325
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;
26+
FOR i in 1..338 LOOP
27+
INSERT INTO rum_tbl(tsv) VALUES ('');
28+
FOR j in 1..10 LOOP
29+
UPDATE rum_tbl SET tsv = tsv || (SELECT to_tsvector(t[1]) FROM text_table WHERE id1 = Xi % 676 + 1) WHERE id = i;
30+
Xi = (a * Xi + c) % m;
31+
END LOOP;
2732
END LOOP;
2833
END;
2934
$$;
@@ -35,7 +40,6 @@ teardown
3540
{
3641
DROP TABLE text_table;
3742
DROP TABLE rum_tbl;
38-
DROP EXTENSION rum;
3943
}
4044

4145
session "s1"

0 commit comments

Comments
 (0)