Исходный код СУБД RuDB — свободной СУБД с открытым исходным кодом на базе PostgreSQL
rudb
2 days ago bd039d1e92813358c5c5a1e346b49074baf513f2
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
Parsed test spec with 2 sessions
 
starting permutation: ioc_nothing1 count2 delete2 insert1 c1 c2
step ioc_nothing1: INSERT INTO ioc_a VALUES (1, 99) ON CONFLICT (key) DO NOTHING;
step count2: SELECT count(*) FROM ioc_b;
count
-----
    0
(1 row)
 
step delete2: DELETE FROM ioc_a WHERE key = 1;
step insert1: INSERT INTO ioc_b VALUES (1, 10);
step c1: COMMIT;
step c2: COMMIT;
ERROR:  could not serialize access due to read/write dependencies among transactions
 
starting permutation: ioc_nothing1 count2 update2 insert1 c1 c2
step ioc_nothing1: INSERT INTO ioc_a VALUES (1, 99) ON CONFLICT (key) DO NOTHING;
step count2: SELECT count(*) FROM ioc_b;
count
-----
    0
(1 row)
 
step update2: UPDATE ioc_a SET val = 1 WHERE key = 1;
step insert1: INSERT INTO ioc_b VALUES (1, 10);
step c1: COMMIT;
step c2: COMMIT;
ERROR:  could not serialize access due to read/write dependencies among transactions
 
starting permutation: ioc_update1_where count2 update2 insert1 c1 c2
step ioc_update1_where: INSERT INTO ioc_a VALUES (1, 99) ON CONFLICT (key) DO UPDATE SET val = 99 WHERE ioc_a.val > 100;
step count2: SELECT count(*) FROM ioc_b;
count
-----
    0
(1 row)
 
step update2: UPDATE ioc_a SET val = 1 WHERE key = 1; <waiting ...>
step insert1: INSERT INTO ioc_b VALUES (1, 10);
step c1: COMMIT;
step update2: <... completed>
ERROR:  could not serialize access due to read/write dependencies among transactions
step c2: COMMIT;
 
starting permutation: ioc_select1 count2 update2 insert1 c1 c2
step ioc_select1: INSERT INTO ioc_a VALUES (1, 99) ON CONFLICT (key) DO SELECT RETURNING val;
val
---
  0
(1 row)
 
step count2: SELECT count(*) FROM ioc_b;
count
-----
    0
(1 row)
 
step update2: UPDATE ioc_a SET val = 1 WHERE key = 1;
step insert1: INSERT INTO ioc_b VALUES (1, 10);
step c1: COMMIT;
step c2: COMMIT;
ERROR:  could not serialize access due to read/write dependencies among transactions
 
starting permutation: ioc_select1_keyshare count2 update2 insert1 c1 c2
step ioc_select1_keyshare: INSERT INTO ioc_a VALUES (1, 99) ON CONFLICT (key) DO SELECT FOR KEY SHARE RETURNING val;
val
---
  0
(1 row)
 
step count2: SELECT count(*) FROM ioc_b;
count
-----
    0
(1 row)
 
step update2: UPDATE ioc_a SET val = 1 WHERE key = 1;
step insert1: INSERT INTO ioc_b VALUES (1, 10);
step c1: COMMIT;
step c2: COMMIT;
ERROR:  could not serialize access due to read/write dependencies among transactions
 
starting permutation: ioc_select1_where count2 update2 insert1 c1 c2
step ioc_select1_where: INSERT INTO ioc_a VALUES (1, 99) ON CONFLICT (key) DO SELECT WHERE ioc_a.val > 100 RETURNING val;
val
---
(0 rows)
 
step count2: SELECT count(*) FROM ioc_b;
count
-----
    0
(1 row)
 
step update2: UPDATE ioc_a SET val = 1 WHERE key = 1;
step insert1: INSERT INTO ioc_b VALUES (1, 10);
step c1: COMMIT;
step c2: COMMIT;
ERROR:  could not serialize access due to read/write dependencies among transactions
 
starting permutation: count2 update2 ioc_select1 c2 insert1 c1
step count2: SELECT count(*) FROM ioc_b;
count
-----
    0
(1 row)
 
step update2: UPDATE ioc_a SET val = 1 WHERE key = 1;
step ioc_select1: INSERT INTO ioc_a VALUES (1, 99) ON CONFLICT (key) DO SELECT RETURNING val; <waiting ...>
step c2: COMMIT;
step ioc_select1: <... completed>
ERROR:  could not serialize access due to concurrent update
step insert1: INSERT INTO ioc_b VALUES (1, 10);
ERROR:  current transaction is aborted, commands ignored until end of transaction block
step c1: COMMIT;