- Notifications
You must be signed in to change notification settings - Fork 59
/
Copy pathpredicate-rum-2.spec
63 lines (53 loc) · 1.63 KB
/
predicate-rum-2.spec
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# Test for page level predicate locking in rum
#
# Test to check reduced false positives
#
# 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.
setup
{
CREATETABLErum_tbl (idserial, tsvtsvector);
CREATETABLEtext_table (id1serial, ttext[]);
INSERTINTOtext_table(t) SELECTarray[chr(i) ||chr(j)] FROMgenerate_series(65,90) i,
generate_series(65,90) j ;
--Weneedtousepseudorandomtogeneratevaluesfortesttable
--Inthiscaseweuselinearcongruentialgeneratorbecauserandom()
--functionmaygeneratedifferentoutputswithdifferentsystems
DO $$
DECLARE
cinteger:=17;
ainteger:=261;
minteger:=6760;
Xiinteger:=228;
BEGIN
FORiin1..338LOOP
INSERTINTOrum_tbl(tsv) VALUES ('');
FORjin1..10LOOP
UPDATErum_tblSETtsv=tsv|| (SELECTto_tsvector(t[1]) FROMtext_tableWHEREid1=Xi%676+1) WHEREid=i;
Xi= (a*Xi+c) %m;
ENDLOOP;
ENDLOOP;
END;
$$;
CREATEINDEXrum_tbl_idxONrum_tblUSINGrum (tsvrum_tsvector_ops);
}
teardown
{
DROPTABLEtext_table;
DROPTABLErum_tbl;
}
session"s1"
setup {
BEGINISOLATIONLEVELSERIALIZABLE;
setenable_seqscan=off;
}
step"rxy1" { SELECTid, tsvFROMrum_tblWHEREtsv @@ 'hx'; }
step"wx1" { INSERTINTOrum_tbl(tsv) values('ab'); }
step"c1" { COMMIT; }
session"s2"
setup {
BEGINISOLATIONLEVELSERIALIZABLE;
setenable_seqscan=off;
}
step"rxy2" { SELECTid, tsvFROMrum_tblWHEREtsv @@ 'qh'; }
step"wy2" { INSERTINTOrum_tbl(tsv) values('xz'); }
step"c2" { COMMIT; }