Исходный код СУБД 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
117
118
119
120
121
122
-- Tests for VACUUM
CREATE EXTENSION injection_points;
SELECT injection_points_set_local();
 injection_points_set_local 
----------------------------
 
(1 row)
 
SELECT injection_points_attach('vacuum-index-cleanup-auto', 'notice');
 injection_points_attach 
-------------------------
 
(1 row)
 
SELECT injection_points_attach('vacuum-index-cleanup-disabled', 'notice');
 injection_points_attach 
-------------------------
 
(1 row)
 
SELECT injection_points_attach('vacuum-index-cleanup-enabled', 'notice');
 injection_points_attach 
-------------------------
 
(1 row)
 
SELECT injection_points_attach('vacuum-truncate-auto', 'notice');
 injection_points_attach 
-------------------------
 
(1 row)
 
SELECT injection_points_attach('vacuum-truncate-disabled', 'notice');
 injection_points_attach 
-------------------------
 
(1 row)
 
SELECT injection_points_attach('vacuum-truncate-enabled', 'notice');
 injection_points_attach 
-------------------------
 
(1 row)
 
-- Check state of index_cleanup and truncate in VACUUM.
CREATE TABLE vac_tab_on_toast_off(i int, j text) WITH
  (autovacuum_enabled=false,
   vacuum_index_cleanup=true, toast.vacuum_index_cleanup=false,
   vacuum_truncate=true, toast.vacuum_truncate=false);
CREATE TABLE vac_tab_off_toast_on(i int, j text) WITH
  (autovacuum_enabled=false,
   vacuum_index_cleanup=false, toast.vacuum_index_cleanup=true,
   vacuum_truncate=false, toast.vacuum_truncate=true);
-- Multiple relations should use their options in isolation.
VACUUM vac_tab_on_toast_off, vac_tab_off_toast_on;
NOTICE:  notice triggered for injection point vacuum-index-cleanup-enabled
NOTICE:  notice triggered for injection point vacuum-truncate-enabled
NOTICE:  notice triggered for injection point vacuum-index-cleanup-disabled
NOTICE:  notice triggered for injection point vacuum-truncate-disabled
NOTICE:  notice triggered for injection point vacuum-index-cleanup-disabled
NOTICE:  notice triggered for injection point vacuum-truncate-disabled
NOTICE:  notice triggered for injection point vacuum-index-cleanup-enabled
NOTICE:  notice triggered for injection point vacuum-truncate-enabled
-- Check "auto" case of index_cleanup and "truncate" controlled by
-- its GUC.
CREATE TABLE vac_tab_auto(i int, j text) WITH
  (autovacuum_enabled=false,
   vacuum_index_cleanup=auto, toast.vacuum_index_cleanup=auto);
SET vacuum_truncate = false;
VACUUM vac_tab_auto;
NOTICE:  notice triggered for injection point vacuum-index-cleanup-auto
NOTICE:  notice triggered for injection point vacuum-truncate-disabled
NOTICE:  notice triggered for injection point vacuum-index-cleanup-auto
NOTICE:  notice triggered for injection point vacuum-truncate-disabled
SET vacuum_truncate = true;
VACUUM vac_tab_auto;
NOTICE:  notice triggered for injection point vacuum-index-cleanup-auto
NOTICE:  notice triggered for injection point vacuum-truncate-enabled
NOTICE:  notice triggered for injection point vacuum-index-cleanup-auto
NOTICE:  notice triggered for injection point vacuum-truncate-enabled
RESET vacuum_truncate;
DROP TABLE vac_tab_auto;
DROP TABLE vac_tab_on_toast_off;
DROP TABLE vac_tab_off_toast_on;
-- Cleanup
SELECT injection_points_detach('vacuum-index-cleanup-auto');
 injection_points_detach 
-------------------------
 
(1 row)
 
SELECT injection_points_detach('vacuum-index-cleanup-disabled');
 injection_points_detach 
-------------------------
 
(1 row)
 
SELECT injection_points_detach('vacuum-index-cleanup-enabled');
 injection_points_detach 
-------------------------
 
(1 row)
 
SELECT injection_points_detach('vacuum-truncate-auto');
 injection_points_detach 
-------------------------
 
(1 row)
 
SELECT injection_points_detach('vacuum-truncate-disabled');
 injection_points_detach 
-------------------------
 
(1 row)
 
SELECT injection_points_detach('vacuum-truncate-enabled');
 injection_points_detach 
-------------------------
 
(1 row)
 
DROP EXTENSION injection_points;