Исходный код СУБД 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
CREATE EXTENSION test_slru;
 
SELECT test_slru_page_exists(12345);
SELECT test_slru_page_write(12345, 'Test SLRU');
SELECT test_slru_page_read(12345);
SELECT test_slru_page_exists(12345);
 
-- Test read failure
SELECT test_slru_page_read(54321, false, '123'::xid);
 
-- 48 extra pages
SELECT count(test_slru_page_write(a, 'Test SLRU'))
  FROM generate_series(12346, 12393, 1) as a;
 
-- Reading page in buffer for read and write
SELECT test_slru_page_read(12377, true);
-- Reading page in buffer for read-only
SELECT test_slru_page_readonly(12377);
-- Reading page not in buffer with read-only
SELECT test_slru_page_readonly(12346);
 
-- Write all the pages in buffers
SELECT test_slru_page_writeall();
-- Flush the last page written out.
SELECT test_slru_page_sync(12393);
SELECT test_slru_page_exists(12393);
-- Segment deletion
SELECT test_slru_page_delete(12393);
SELECT test_slru_page_exists(12393);
-- Page truncation
SELECT test_slru_page_exists(12377);
SELECT test_slru_page_truncate(12377);
SELECT test_slru_page_exists(12377);
 
-- Full deletion
SELECT test_slru_delete_all();
SELECT test_slru_page_exists(12345);
SELECT test_slru_page_exists(12377);
SELECT test_slru_page_exists(12393);
 
--
-- Test 64-bit pages
--
SELECT test_slru_page_exists(0x1234500000000);
SELECT test_slru_page_write(0x1234500000000, 'Test SLRU 64-bit');
SELECT test_slru_page_read(0x1234500000000);
SELECT test_slru_page_exists(0x1234500000000);
 
-- 48 extra pages
SELECT count(test_slru_page_write(a, 'Test SLRU 64-bit'))
  FROM generate_series(0x1234500000001, 0x1234500000030, 1) as a;
 
-- Reading page in buffer for read and write
SELECT test_slru_page_read(0x1234500000020, true);
-- Reading page in buffer for read-only
SELECT test_slru_page_readonly(0x1234500000020);
-- Reading page not in buffer with read-only
SELECT test_slru_page_readonly(0x1234500000001);
 
-- Write all the pages in buffers
SELECT test_slru_page_writeall();
-- Flush the last page written out.
SELECT test_slru_page_sync(0x1234500000030);
SELECT test_slru_page_exists(0x1234500000030);
-- Segment deletion
SELECT test_slru_page_delete(0x1234500000030);
SELECT test_slru_page_exists(0x1234500000030);
-- Page truncation
SELECT test_slru_page_exists(0x1234500000020);
SELECT test_slru_page_truncate(0x1234500000020);
SELECT test_slru_page_exists(0x1234500000020);
 
-- Full deletion
SELECT test_slru_delete_all();
SELECT test_slru_page_exists(0x1234500000000);
SELECT test_slru_page_exists(0x1234500000020);
SELECT test_slru_page_exists(0x1234500000030);
 
DROP EXTENSION test_slru;