blob: 38bda39fe4e5f514175e5a351d9387122844383b [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') DISTRIBUTED BY (a_bigint, b_bigint) 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:
Success:
Success:
Success:
Success:
Success:
Success:
(8 rows)
CREATE TABLE a_suspend_blocking(a int, b int, c int);
CREATE
INSERT INTO a_suspend_blocking select i,i,i from generate_series(1, 100) i;
INSERT 100
0: SELECT gp_inject_fault_infinite('exec_mpp_query_start', 'suspend', dbid) FROM gp_segment_configuration WHERE role = 'p' AND content >= 0;
gp_inject_fault_infinite
--------------------------
Success:
Success:
Success:
(3 rows)
0&: SELECT * FROM a_suspend_blocking; <waiting ...>
1: SELECT pg_cancel_backend(pid) FROM pg_stat_activity WHERE query LIKE 'SELECT * FROM a_suspend_blocking%';
pg_cancel_backend
-------------------
t
(1 row)
0<: <... completed>
ERROR: canceling statement due to user request
SELECT gp_inject_fault_infinite('exec_mpp_query_start', 'reset', dbid) FROM gp_segment_configuration WHERE role = 'p' AND content >= 0;
gp_inject_fault_infinite
--------------------------
Success:
Success:
Success:
(3 rows)
DROP TABLE a_suspend_blocking;
DROP