blob: 16b8e3b9857a4f2e64bf7d42deb03c8b64af0a21 [file] [log] [blame]
CREATE EXTENSION IF NOT EXISTS gp_inject_fault;
CREATE
0:CREATE TABLE a_partition_table_for_analyze_cancellation ( a_date date NOT NULL, a_bigint bigint NOT NULL, b_bigint bigint NOT NULL ) WITH (appendonly='true', orientation='column') PARTITION BY RANGE(a_date) ( PARTITION p1 START ('2018-01-01'::date) END ('2018-12-31'::date) WITH (appendonly='true', orientation='column') COLUMN a_date ENCODING (compresstype=zlib) COLUMN a_bigint ENCODING (compresstype=zlib) COLUMN b_bigint ENCODING (compresstype=zlib), PARTITION p2 START ('2019-01-01'::date) END ('2019-12-31'::date) WITH (appendonly='true', orientation='column') COLUMN a_date ENCODING (compresstype=zlib) COLUMN a_bigint ENCODING (compresstype=zlib) COLUMN b_bigint ENCODING (compresstype=zlib), PARTITION p3 START ('2020-01-01'::date) END ('2020-12-31'::date) WITH (appendonly='true', orientation='column') COLUMN a_date ENCODING (compresstype=zlib) COLUMN a_bigint ENCODING (compresstype=zlib) COLUMN b_bigint ENCODING (compresstype=zlib) );
CREATE
0:INSERT INTO a_partition_table_for_analyze_cancellation VALUES(timestamp '2018-01-01 10:00:00', 1, 3);
INSERT 1
0:INSERT INTO a_partition_table_for_analyze_cancellation VALUES(timestamp '2019-01-01 12:00:00', 2, 4);
INSERT 1
0:INSERT INTO a_partition_table_for_analyze_cancellation VALUES(timestamp '2020-01-01 13:00:00', 3, 5);
INSERT 1
0: SELECT gp_inject_fault('zlib_decompress_after_decompress_fn', 'sleep', '', '', '', 1, -1, 3600, dbid) FROM gp_segment_configuration WHERE content=-1 AND role='p';
gp_inject_fault
-----------------
Success:
(1 row)
0&: SELECT gp_wait_until_triggered_fault('zlib_decompress_after_decompress_fn', 1, dbid) FROM gp_segment_configuration WHERE content=-1 AND role='p'; <waiting ...>
-- ANALYZE on AO/CO table with zlib compression will hit and fault injection
-- 'zlib_decompress_after_decompress_fn'
1&: ANALYZE a_partition_table_for_analyze_cancellation_1_prt_p3; <waiting ...>
-- It should still be possible to cancel the ANALYZE backend
2: SELECT pg_cancel_backend(pid) FROM pg_stat_activity WHERE pid <> pg_backend_pid() AND application_name='pg_regress';
pg_cancel_backend
-------------------
t
t
t
(3 rows)
0<: <... completed>
gp_wait_until_triggered_fault
-------------------------------
Success:
(1 row)
1<: <... completed>
ERROR: canceling statement due to user request
SELECT gp_inject_fault('zlib_decompress_after_decompress_fn', 'reset', dbid) FROM gp_segment_configuration;
gp_inject_fault
-----------------
Success:
Success:
(2 rows)