Исходный код СУБД 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
Parsed test spec with 2 sessions
 
starting permutation: wait_before_lock update_target check_after_update wakeup_before_lock check_after_repack
injection_points_attach
-----------------------
                       
(1 row)
 
step wait_before_lock: 
    REPACK (CONCURRENTLY) repack_temporal USING INDEX rt_pkey;
 <waiting ...>
step update_target: 
    UPDATE repack_temporal
    SET label = 'updated'
    WHERE id = '[2,3)' AND valid_at = '[2000-01-10,2000-01-20)';
 
step check_after_update: 
    INSERT INTO relfilenodes(node)
    SELECT relfilenode FROM pg_class WHERE relname = 'repack_temporal';
 
    -- Expect 2 rows
    SELECT id, valid_at, label
    FROM repack_temporal
    ORDER BY id, valid_at, label;
 
id    |valid_at               |label  
------+-----------------------+-------
[1,10)|[01-01-2000,02-01-2000)|other  
[2,3) |[01-10-2000,01-20-2000)|updated
(2 rows)
 
step wakeup_before_lock: 
    SELECT injection_points_wakeup('repack-concurrently-before-lock');
 
injection_points_wakeup
-----------------------
                       
(1 row)
 
step wait_before_lock: <... completed>
step check_after_repack: 
    INSERT INTO relfilenodes(node)
    SELECT relfilenode FROM pg_class WHERE relname = 'repack_temporal';
 
    -- Expect 2, proving that repack has rewritten the table
    SELECT count(DISTINCT node) FROM relfilenodes;
 
    -- Expect 2 rows
    SELECT id, valid_at, label
    FROM repack_temporal
    ORDER BY id, valid_at, label;
 
count
-----
    2
(1 row)
 
id    |valid_at               |label  
------+-----------------------+-------
[1,10)|[01-01-2000,02-01-2000)|other  
[2,3) |[01-10-2000,01-20-2000)|updated
(2 rows)
 
injection_points_detach
-----------------------
                       
(1 row)