1 CREATE EXTENSION test_slru;
2 SELECT test_slru_page_exists(12345);
4 -----------------------
8 SELECT test_slru_page_write(12345, 'Test SLRU');
10 ----------------------
14 SELECT test_slru_page_read(12345);
20 SELECT test_slru_page_exists(12345);
22 -----------------------
27 SELECT count(test_slru_page_write(a, 'Test SLRU'))
28 FROM generate_series(12346, 12393, 1) as a;
34 -- Reading page in buffer for read and write
35 SELECT test_slru_page_read(12377, true);
41 -- Reading page in buffer for read-only
42 SELECT test_slru_page_readonly(12377);
43 test_slru_page_readonly
44 -------------------------
48 -- Reading page not in buffer with read-only
49 SELECT test_slru_page_readonly(12346);
50 test_slru_page_readonly
51 -------------------------
55 -- Write all the pages in buffers
56 SELECT test_slru_page_writeall();
57 test_slru_page_writeall
58 -------------------------
62 -- Flush the last page written out.
63 SELECT test_slru_page_sync(12393);
64 NOTICE: Called SlruSyncFileTag() for segment 387 on path pg_test_slru/000000000000183
70 SELECT test_slru_page_exists(12393);
72 -----------------------
77 SELECT test_slru_page_delete(12393);
78 NOTICE: Called SlruDeleteSegment() for segment 387
80 -----------------------
84 SELECT test_slru_page_exists(12393);
86 -----------------------
91 SELECT test_slru_page_exists(12377);
93 -----------------------
97 SELECT test_slru_page_truncate(12377);
98 test_slru_page_truncate
99 -------------------------
103 SELECT test_slru_page_exists(12377);
104 test_slru_page_exists
105 -----------------------
110 SELECT test_slru_delete_all();
111 NOTICE: Calling test_slru_scan_cb()
113 ----------------------
117 SELECT test_slru_page_exists(12345);
118 test_slru_page_exists
119 -----------------------
123 SELECT test_slru_page_exists(12377);
124 test_slru_page_exists
125 -----------------------
129 SELECT test_slru_page_exists(12393);
130 test_slru_page_exists
131 -----------------------
138 SELECT test_slru_page_exists(0x1234500000000);
139 test_slru_page_exists
140 -----------------------
144 SELECT test_slru_page_write(0x1234500000000, 'Test SLRU 64-bit');
146 ----------------------
150 SELECT test_slru_page_read(0x1234500000000);
152 ---------------------
156 SELECT test_slru_page_exists(0x1234500000000);
157 test_slru_page_exists
158 -----------------------
163 SELECT count(test_slru_page_write(a, 'Test SLRU 64-bit'))
164 FROM generate_series(0x1234500000001, 0x1234500000030, 1) as a;
170 -- Reading page in buffer for read and write
171 SELECT test_slru_page_read(0x1234500000020, true);
173 ---------------------
177 -- Reading page in buffer for read-only
178 SELECT test_slru_page_readonly(0x1234500000020);
179 test_slru_page_readonly
180 -------------------------
184 -- Reading page not in buffer with read-only
185 SELECT test_slru_page_readonly(0x1234500000001);
186 test_slru_page_readonly
187 -------------------------
191 -- Write all the pages in buffers
192 SELECT test_slru_page_writeall();
193 test_slru_page_writeall
194 -------------------------
198 -- Flush the last page written out.
199 SELECT test_slru_page_sync(0x1234500000030);
200 NOTICE: Called SlruSyncFileTag() for segment 10007944888321 on path pg_test_slru/000091A28000001
202 ---------------------
206 SELECT test_slru_page_exists(0x1234500000030);
207 test_slru_page_exists
208 -----------------------
213 SELECT test_slru_page_delete(0x1234500000030);
214 NOTICE: Called SlruDeleteSegment() for segment 10007944888321
215 test_slru_page_delete
216 -----------------------
220 SELECT test_slru_page_exists(0x1234500000030);
221 test_slru_page_exists
222 -----------------------
227 SELECT test_slru_page_exists(0x1234500000020);
228 test_slru_page_exists
229 -----------------------
233 SELECT test_slru_page_truncate(0x1234500000020);
234 test_slru_page_truncate
235 -------------------------
239 SELECT test_slru_page_exists(0x1234500000020);
240 test_slru_page_exists
241 -----------------------
246 SELECT test_slru_delete_all();
248 ----------------------
252 SELECT test_slru_page_exists(0x1234500000000);
253 test_slru_page_exists
254 -----------------------
258 SELECT test_slru_page_exists(0x1234500000020);
259 test_slru_page_exists
260 -----------------------
264 SELECT test_slru_page_exists(0x1234500000030);
265 test_slru_page_exists
266 -----------------------
270 DROP EXTENSION test_slru;