forked from timescale/timescaledb
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcache_invalidate_uaf.out
More file actions
42 lines (38 loc) · 1.36 KB
/
Copy pathcache_invalidate_uaf.out
File metadata and controls
42 lines (38 loc) · 1.36 KB
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
-- This file and its contents are licensed under the Apache License 2.0.
-- Please see the included NOTICE for copyright information and
-- LICENSE-APACHE for a copy of the license.
-- Test for cache pointer use-after-free on invalidation with active pins. We
-- reproduce this by triggering the cache invalidation from a trigger.
\c :TEST_DBNAME :ROLE_SUPERUSER
CREATE TABLE cache_inval_test(time timestamptz NOT NULL, val int);
SELECT create_hypertable('cache_inval_test', 'time');
create_hypertable
-------------------------------
(1,public,cache_inval_test,t)
INSERT INTO cache_inval_test VALUES ('2024-01-01', 1);
CREATE FUNCTION trg_inval_cache() RETURNS trigger AS $$
BEGIN
PERFORM set_chunk_time_interval('cache_inval_test', INTERVAL '2 days');
RETURN NEW;
END;
$$ LANGUAGE plpgsql;
CREATE TRIGGER trg_inval BEFORE INSERT ON cache_inval_test
FOR EACH ROW EXECUTE FUNCTION trg_inval_cache();
SELECT debug_waitpoint_enable('hypertable-cache-create');
debug_waitpoint_enable
------------------------
BEGIN;
SAVEPOINT sp;
\set ON_ERROR_STOP 0
INSERT INTO cache_inval_test VALUES ('2024-01-02', 2);
ERROR: error injected at debug point 'hypertable-cache-create'
\set ON_ERROR_STOP 1
ROLLBACK TO sp;
INSERT INTO cache_inval_test VALUES ('2024-01-03', 3);
COMMIT;
SELECT val FROM cache_inval_test ORDER BY time;
val
-----
1
3
DROP TABLE cache_inval_test;