Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit0428d56

Browse files
committed
Merge branch 'master' into rum_arrays_v1.2
2 parents9cc6606 +c5be71b commit0428d56

13 files changed

+1116
-961
lines changed

‎Makefile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,3 +51,16 @@ install: installincludes
5151

5252
installincludes:
5353
$(INSTALL_DATA)$(addprefix$(srcdir)/,$(INCLUDES))'$(DESTDIR)$(includedir_server)/'
54+
55+
ISOLATIONCHECKS= predicate-rum predicate-rum-2
56+
57+
submake-isolation:
58+
$(MAKE) -C$(top_builddir)/src/test/isolation all
59+
60+
submake-rum:
61+
$(MAKE) -C$(top_builddir)/contrib/rum
62+
63+
isolationcheck: | submake-isolation submake-rum temp-install
64+
$(pg_isolation_regress_check)\
65+
--temp-config$(top_srcdir)/contrib/rum/logical.conf\
66+
$(ISOLATIONCHECKS)

‎README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -106,21 +106,21 @@ SELECT t, a <=> to_tsquery('english', 'beautiful | place') AS rank
106106
FROM test_rum
107107
WHERE a @@ to_tsquery('english','beautiful | place')
108108
ORDER BY a<=> to_tsquery('english','beautiful | place');
109-
t |rank
110-
---------------------------------+-----------
111-
The situation is most beautiful|0.0303964
112-
Itisa beautiful |0.0303964
113-
Itlookslikea beautifulplace |0.0607927
109+
t | rank
110+
---------------------------------+---------
111+
It lookslike a beautifulplace |8.22467
112+
The situationismost beautiful|16.4493
113+
Itisa beautiful |16.4493
114114
(3 rows)
115115

116116
SELECT t, a<=> to_tsquery('english','place | situation')AS rank
117117
FROM test_rum
118118
WHERE a @@ to_tsquery('english','place | situation')
119119
ORDER BY a<=> to_tsquery('english','place | situation');
120-
t |rank
121-
---------------------------------+-----------
122-
The situation is most beautiful |0.0303964
123-
It lookslike a beautiful place |0.0303964
120+
t | rank
121+
---------------------------------+---------
122+
The situation is most beautiful |16.4493
123+
It lookslike a beautiful place |16.4493
124124
(2 rows)
125125
```
126126

‎expected/predicate-rum-2.out

Lines changed: 441 additions & 0 deletions
Large diffs are not rendered by default.

‎expected/predicate-rum.out

Lines changed: 461 additions & 0 deletions
Large diffs are not rendered by default.

‎logical.conf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
wal_level = logical
2+
max_replication_slots = 4

‎specs/predicate-rum-2.spec

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# Test for page level predicate locking in rum
2+
#
3+
# Test to check reduced false positives
4+
#
5+
# Queries are written in such a way that an index scan(from one transaction) and an index insert(from another transaction) will try to access different parts(sub-tree) of the index.
6+
7+
setup
8+
{
9+
CREATEEXTENSIONrum;
10+
11+
CREATETABLErum_tbl (idserial,tsvtsvector);
12+
13+
CREATETABLEtext_table (id1serial,ttext[]);
14+
15+
SELECTSETSEED(0.5);
16+
17+
INSERTINTOtext_table(t)SELECTarray[chr(i)||chr(j)]FROMgenerate_series(65,90)i,
18+
generate_series(65,90)j ;
19+
20+
INSERTINTOrum_tbl(tsv)SELECTto_tsvector('simple',t[1] )FROMtext_table;
21+
22+
DO $$
23+
BEGIN
24+
FORjin1..10LOOP
25+
UPDATErum_tblSETtsv=tsv||q.t1FROM (SELECTid1,to_tsvector('simple',t[1] )
26+
ast1FROMtext_table)asqWHEREid= (random()*q.id1)::integer;
27+
ENDLOOP;
28+
END;
29+
$$;
30+
31+
CREATEINDEXrum_tbl_idxONrum_tblUSINGrum (tsvrum_tsvector_ops);
32+
}
33+
34+
teardown
35+
{
36+
DROPTABLEtext_table;
37+
DROPTABLErum_tbl;
38+
DROPEXTENSIONrum;
39+
}
40+
41+
session"s1"
42+
setup{
43+
BEGINISOLATIONLEVELSERIALIZABLE;
44+
setenable_seqscan=off;
45+
}
46+
step"rxy1"{SELECTid,tsvFROMrum_tblWHEREtsv @@'hx'; }
47+
step"wx1"{INSERTINTOrum_tbl(tsv)values('ab'); }
48+
step"c1"{COMMIT; }
49+
50+
session"s2"
51+
setup{
52+
BEGINISOLATIONLEVELSERIALIZABLE;
53+
setenable_seqscan=off;
54+
}
55+
56+
step"rxy2"{SELECTid,tsvFROMrum_tblWHEREtsv @@'qh'; }
57+
step"wy2"{INSERTINTOrum_tbl(tsv)values('xz'); }
58+
step"c2"{COMMIT; }
59+

‎specs/predicate-rum.spec

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# Test for page level predicate locking in rum
2+
#
3+
# Test to verify serialization failures
4+
#
5+
# Queries are written in such a way that an index scan(from one transaction) and an index insert(from another transaction) will try to access the same part(sub-tree) of the index.
6+
7+
setup
8+
{
9+
CREATEEXTENSIONrum;
10+
11+
CREATETABLErum_tbl (idserial,tsvtsvector);
12+
13+
CREATETABLEtext_table (id1serial,ttext[]);
14+
15+
SELECTSETSEED(0.5);
16+
17+
INSERTINTOtext_table(t)SELECTarray[chr(i)||chr(j)]FROMgenerate_series(65,90)i,
18+
generate_series(65,90)j ;
19+
20+
INSERTINTOrum_tbl(tsv)SELECTto_tsvector('simple',t[1] )FROMtext_table;
21+
22+
DO $$
23+
BEGIN
24+
FORjin1..10LOOP
25+
UPDATErum_tblSETtsv=tsv||q.t1FROM (SELECTid1,to_tsvector('simple',t[1] )
26+
ast1FROMtext_table)asqWHEREid= (random()*q.id1)::integer;
27+
ENDLOOP;
28+
END;
29+
$$;
30+
31+
CREATEINDEXrum_tbl_idxONrum_tblUSINGrum (tsvrum_tsvector_ops);
32+
}
33+
34+
teardown
35+
{
36+
DROPTABLEtext_table;
37+
DROPTABLErum_tbl;
38+
DROPEXTENSIONrum;
39+
}
40+
41+
session"s1"
42+
setup{
43+
BEGINISOLATIONLEVELSERIALIZABLE;
44+
setenable_seqscan=off;
45+
}
46+
step"rxy1"{SELECTid,tsvFROMrum_tblWHEREtsv @@'hx'; }
47+
step"wx1"{INSERTINTOrum_tbl(tsv)values('qh'); }
48+
step"c1"{COMMIT; }
49+
50+
session"s2"
51+
setup{
52+
BEGINISOLATIONLEVELSERIALIZABLE;
53+
setenable_seqscan=off;
54+
}
55+
56+
step"rxy2"{SELECTid,tsvFROMrum_tblWHEREtsv @@'qh'; }
57+
step"wy2"{INSERTINTOrum_tbl(tsv)values('hx'); }
58+
step"c2"{COMMIT; }

‎src/rumbtree.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
#include"access/generic_xlog.h"
1717
#include"miscadmin.h"
18+
#include"storage/predicate.h"
1819

1920
#include"rum.h"
2021

@@ -485,6 +486,14 @@ rumInsertValue(Relation index, RumBtree btree, RumBtreeStack * stack,
485486
btree->fillRoot(btree,stack->buffer,lbuffer,rbuffer,
486487
page,lpage,rpage);
487488

489+
PredicateLockPageSplit(btree->index,
490+
BufferGetBlockNumber(stack->buffer),
491+
BufferGetBlockNumber(lbuffer));
492+
493+
PredicateLockPageSplit(btree->index,
494+
BufferGetBlockNumber(stack->buffer),
495+
BufferGetBlockNumber(rbuffer));
496+
488497
if (btree->rumstate->isBuild)
489498
{
490499
START_CRIT_SECTION();
@@ -548,6 +557,10 @@ rumInsertValue(Relation index, RumBtree btree, RumBtreeStack * stack,
548557
RumPageGetOpaque(rpage)->leftlink=BufferGetBlockNumber(stack->buffer);
549558
RumPageGetOpaque(newlpage)->rightlink=BufferGetBlockNumber(rbuffer);
550559

560+
PredicateLockPageSplit(btree->index,
561+
BufferGetBlockNumber(stack->buffer),
562+
BufferGetBlockNumber(rbuffer));
563+
551564
/*
552565
* it's safe because we don't have right-to-left walking
553566
* with locking bth pages except vacuum. But vacuum will

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp