Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit d82152b

Browse files
authored
Merge branch 'postgrespro:master' into master
2 parents d5a9010 + 6c954ab commit d82152b

File tree

11 files changed

+760
-1595
lines changed

11 files changed

+760
-1595
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
results
55
__pycache__
66
*.pyc
7+
rum--*.sql
78
tmp_install
89
log
910

.travis.yml

Lines changed: 0 additions & 7 deletions
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

Lines changed: 17 additions & 0 deletions
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

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.

meson.build

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
# Does not support the PGXS infrastructure at this time. Please, compile as part
44
# of the contrib source tree.
55

6+
extension = 'rum'
7+
extversion = '1.3'
8+
69
rum_sources = files(
710
'src/btree_rum.c',
811
'src/rum_arr_utils.c',
@@ -24,7 +27,7 @@ rum_sources = files(
2427
if host_system == 'windows'
2528
rum_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
2629
'--NAME', 'rum',
27-
'--FILEDESC', 'rum - provides access method to work with the RUM indexes.',])
30+
'--FILEDESC', 'RUM index access method',])
2831
endif
2932

3033
rum = shared_module('rum',
@@ -33,15 +36,19 @@ rum = shared_module('rum',
3336
)
3437
contrib_targets += rum
3538

39+
configure_file(
40+
input: 'rum_init.sql',
41+
output: extension + '--' + extversion + '.sql',
42+
copy: true,
43+
install: true,
44+
install_dir: contrib_data_args['install_dir'],
45+
)
46+
3647
install_data(
3748
'rum.control',
3849
'rum--1.0--1.1.sql',
39-
'rum--1.0.sql',
4050
'rum--1.1--1.2.sql',
41-
'rum--1.1.sql',
4251
'rum--1.2--1.3.sql',
43-
'rum--1.2.sql',
44-
'rum--1.3.sql',
4552
kwargs: contrib_data_args,
4653
)
4754

@@ -87,10 +94,25 @@ tests += {
8794
'expr',
8895
'array',
8996
],
97+
'regress_args': [
98+
'--temp-config', files('logical.conf')
99+
],
90100
},
91101
'tap': {
92102
'tests': [
93103
't/001_wal.pl',
104+
't/002_pglist.pl',
105+
],
106+
'test_kwargs': {'timeout': 3000},
107+
},
108+
'isolation': {
109+
'specs': [
110+
'predicate-rum',
111+
'predicate-rum-2',
112+
],
113+
'regress_args': [
114+
'--temp-config', files('logical.conf'),
115+
'--load-extension=rum',
94116
],
95117
},
96118
}

specs/predicate-rum-2.spec

Lines changed: 14 additions & 10 deletions
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('simple', 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

Lines changed: 14 additions & 10 deletions
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('simple', 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"

src/rumget.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1748,7 +1748,11 @@ entryFindItem(RumState * rumstate, RumScanEntry entry, RumItem * item, Snapshot
17481748
{
17491749
if (compareRumItemScanDirection(rumstate, entry->attnumOrig,
17501750
entry->scanDirection,
1751-
&entry->curItem, item) >= 0)
1751+
&entry->curItem, item) >= 0 &&
1752+
entry->offset >= 0 &&
1753+
entry->offset < entry->nlist &&
1754+
rumCompareItemPointers(&entry->curItem.iptr,
1755+
&entry->list[entry->offset].iptr) == 0)
17521756
return;
17531757
while (entry->offset >= 0 && entry->offset < entry->nlist)
17541758
{

0 commit comments

Comments
 (0)