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 Dec 28, 2024
1 parent 9e78b97 commit 6ba9b0c
Show file tree
Hide file tree
Showing 8 changed files with 712 additions and 1,586 deletions.
2 changes: 0 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,3 @@ env:
- PG_VERSION=13 LEVEL=hardcore
- PG_VERSION=12
- PG_VERSION=12 LEVEL=hardcore
- PG_VERSION=11
- PG_VERSION=11 LEVEL=hardcore
10 changes: 8 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ 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

ifdef USE_PGXS
PG_CONFIG = pg_config
PGXS := $(shell $(PG_CONFIG) --pgxs)
Expand Down Expand Up @@ -69,8 +72,10 @@ rum--$(EXTVERSION).sql: $(DATA_first) $(DATA_updates)
rum--%.sql: gen_rum_sql--%.pl
perl $< > $@

install: installincludes

#
# Make conditional targets to save backward compatibility with PG11, PG10 and PG9.6.
#
ifeq ($(MAJORVERSION), $(filter 9.6% 10% 11%, $(MAJORVERSION)))
installincludes:
$(INSTALL) -d '$(DESTDIR)$(includedir_server)/'
$(INSTALL_DATA) $(addprefix $(srcdir)/, $(RELATIVE_INCLUDES)) '$(DESTDIR)$(includedir_server)/'
Expand All @@ -92,3 +97,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.

21 changes: 11 additions & 10 deletions specs/predicate-rum-2.spec
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,26 @@

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;

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 +37,6 @@ teardown
{
DROP TABLE text_table;
DROP TABLE rum_tbl;
DROP EXTENSION rum;
}

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

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;

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 +37,6 @@ teardown
{
DROP TABLE text_table;
DROP TABLE rum_tbl;
DROP EXTENSION rum;
}

session "s1"
Expand Down

0 comments on commit 6ba9b0c

Please sign in to comment.