Skip to content

Commit

Permalink
[PGPRO-9336] Fix of isolation tests and beautify makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
VadimMinigaliev committed Feb 18, 2025
1 parent b6e5430 commit b8a447f
Show file tree
Hide file tree
Showing 9 changed files with 746 additions and 1,591 deletions.
7 changes: 0 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,3 @@ env:
- PG_VERSION=13 LEVEL=hardcore
- PG_VERSION=12
- PG_VERSION=12 LEVEL=hardcore
- PG_VERSION=11
- PG_VERSION=11 LEVEL=hardcore

matrix:
allow_failures:
- env: PG_VERSION=11
- env: PG_VERSION=11 LEVEL=hardcore
22 changes: 22 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,25 @@ REGRESS = security rum rum_validate rum_hash ruminv timestamp orderby orderby_ha

TAP_TESTS = 1

ISOLATION = predicate-rum predicate-rum-2
ISOLATION_OPTS = --load-extension=rum
# Isolation test predicate_rum prints errors with correct output for 12 version
ifeq ($(MAJORVERSION),$(filter 12%,$(MAJORVERSION)))
undefine ISOLATION
undefine ISOLATION_OPTS
endif
EXTRA_CLEAN = pglist_tmp

ifdef USE_PGXS

# We cannot run isolation test for version 13 in PGXS case
# because 'pg_isolation_regress' is not copied to install
# directory, see src/test/isolation/Makefile
ifeq ($(MAJORVERSION),$(filter 13%,$(MAJORVERSION)))
undefine ISOLATION
undefine ISOLATION_OPTS
endif

PG_CONFIG = pg_config
PGXS := $(shell $(PG_CONFIG) --pgxs)
include $(PGXS)
Expand Down Expand Up @@ -60,6 +76,11 @@ wal-check: temp-install
check: wal-check
endif

#
# Make conditional targets to save backward compatibility with PG11, PG10 and PG9.6.
#
ifeq ($(MAJORVERSION), $(filter 9.6% 10% 11%, $(MAJORVERSION)))

install: installincludes

installincludes:
Expand All @@ -83,3 +104,4 @@ isolationcheck: | submake-isolation submake-rum temp-install
$(pg_isolation_regress_check) \
--temp-config $(top_srcdir)/contrib/rum/logical.conf \
$(ISOLATIONCHECKS)
endif
600 changes: 340 additions & 260 deletions expected/predicate-rum-2.out

Large diffs are not rendered by default.

501 changes: 0 additions & 501 deletions expected/predicate-rum-2_1.out

This file was deleted.

622 changes: 342 additions & 280 deletions expected/predicate-rum.out

Large diffs are not rendered by default.

521 changes: 0 additions & 521 deletions expected/predicate-rum_1.out

This file was deleted.

16 changes: 14 additions & 2 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ rum_sources = files(
if host_system == 'windows'
rum_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
'--NAME', 'rum',
'--FILEDESC', 'rum - provides access method to work with the RUM indexes.',])
'--FILEDESC', 'RUM index access method',])
endif

rum = shared_module('rum',
Expand Down Expand Up @@ -87,10 +87,22 @@ tests += {
'expr',
'array',
],
'regress_args': [
'--temp-config', files('logical.conf')
],
},
'tap': {
'tests': [
't/001_wal.pl',
],
},
}
'isolation': {
'specs': [
'predicate-rum',
'predicate-rum-2',
],
'regress_args': [
'--temp-config', files('logical.conf'),
],
},
}
24 changes: 14 additions & 10 deletions specs/predicate-rum-2.spec
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,29 @@

setup
{
CREATE EXTENSION rum;

CREATE TABLE rum_tbl (id serial, tsv tsvector);

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

SELECT SETSEED(0.5);

INSERT INTO text_table(t) SELECT array[chr(i) || chr(j)] FROM generate_series(65,90) i,
generate_series(65,90) j ;

INSERT INTO rum_tbl(tsv) SELECT to_tsvector('simple', t[1] ) FROM text_table;

-- We need to use pseudorandom to generate values for test table
-- In this case we use linear congruential generator because random()
-- function may generate different outputs with different systems
DO $$
DECLARE
c integer := 17;
a integer := 261;
m integer := 6760;
Xi integer := 228;
BEGIN
FOR j in 1..10 LOOP
UPDATE rum_tbl SET tsv = tsv || q.t1 FROM (SELECT id1,to_tsvector('simple', t[1] )
as t1 FROM text_table) as q WHERE id = (random()*q.id1)::integer;
FOR i in 1..338 LOOP
INSERT INTO rum_tbl(tsv) VALUES ('');
FOR j in 1..10 LOOP
UPDATE rum_tbl SET tsv = tsv || (SELECT to_tsvector(t[1]) FROM text_table WHERE id1 = Xi % 676 + 1) WHERE id = i;
Xi = (a * Xi + c) % m;
END LOOP;
END LOOP;
END;
$$;
Expand All @@ -35,7 +40,6 @@ teardown
{
DROP TABLE text_table;
DROP TABLE rum_tbl;
DROP EXTENSION rum;
}

session "s1"
Expand Down
24 changes: 14 additions & 10 deletions specs/predicate-rum.spec
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,29 @@

setup
{
CREATE EXTENSION rum;

CREATE TABLE rum_tbl (id serial, tsv tsvector);

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

SELECT SETSEED(0.5);

INSERT INTO text_table(t) SELECT array[chr(i) || chr(j)] FROM generate_series(65,90) i,
generate_series(65,90) j ;

INSERT INTO rum_tbl(tsv) SELECT to_tsvector('simple', t[1] ) FROM text_table;

-- We need to use pseudorandom to generate values for test table
-- In this case we use linear congruential generator because random()
-- function may generate different outputs with different systems
DO $$
DECLARE
c integer := 17;
a integer := 261;
m integer := 6760;
Xi integer := 228;
BEGIN
FOR j in 1..10 LOOP
UPDATE rum_tbl SET tsv = tsv || q.t1 FROM (SELECT id1,to_tsvector('simple', t[1] )
as t1 FROM text_table) as q WHERE id = (random()*q.id1)::integer;
FOR i in 1..338 LOOP
INSERT INTO rum_tbl(tsv) VALUES ('');
FOR j in 1..10 LOOP
UPDATE rum_tbl SET tsv = tsv || (SELECT to_tsvector(t[1]) FROM text_table WHERE id1 = Xi % 676 + 1) WHERE id = i;
Xi = (a * Xi + c) % m;
END LOOP;
END LOOP;
END;
$$;
Expand All @@ -35,7 +40,6 @@ teardown
{
DROP TABLE text_table;
DROP TABLE rum_tbl;
DROP EXTENSION rum;
}

session "s1"
Expand Down

0 comments on commit b8a447f

Please sign in to comment.