mirror of https://github.com/citusdata/citus.git
Adjust the tests to earlier versions
- Drop PRIMARY KEY for Citus 10 compatibility - Drop columnar for PG 12 - Do not start/stop metadata sync as stop is not implemented in 10.1onder_10_1_comm
parent
0eb5c144ed
commit
3c5ea1b1f2
|
@ -2,12 +2,6 @@ CREATE SCHEMA drop_column_partitioned_table;
|
||||||
SET search_path TO drop_column_partitioned_table;
|
SET search_path TO drop_column_partitioned_table;
|
||||||
SET citus.shard_replication_factor TO 1;
|
SET citus.shard_replication_factor TO 1;
|
||||||
SET citus.next_shard_id TO 2580000;
|
SET citus.next_shard_id TO 2580000;
|
||||||
SELECT start_metadata_sync_to_node('localhost', :worker_1_port);
|
|
||||||
start_metadata_sync_to_node
|
|
||||||
---------------------------------------------------------------------
|
|
||||||
|
|
||||||
(1 row)
|
|
||||||
|
|
||||||
-- create a partitioned table with some columns that
|
-- create a partitioned table with some columns that
|
||||||
-- are going to be dropped within the tests
|
-- are going to be dropped within the tests
|
||||||
CREATE TABLE sensors(
|
CREATE TABLE sensors(
|
||||||
|
@ -18,8 +12,7 @@ col_to_drop_3 inet,
|
||||||
col_to_drop_4 date,
|
col_to_drop_4 date,
|
||||||
measureid integer,
|
measureid integer,
|
||||||
eventdatetime date,
|
eventdatetime date,
|
||||||
measure_data jsonb,
|
measure_data jsonb)
|
||||||
PRIMARY KEY (measureid, eventdatetime, measure_data))
|
|
||||||
PARTITION BY RANGE(eventdatetime);
|
PARTITION BY RANGE(eventdatetime);
|
||||||
-- drop column even before attaching any partitions
|
-- drop column even before attaching any partitions
|
||||||
ALTER TABLE sensors DROP COLUMN col_to_drop_1;
|
ALTER TABLE sensors DROP COLUMN col_to_drop_1;
|
||||||
|
@ -112,16 +105,6 @@ CREATE TABLE sensors_2004(
|
||||||
col_to_drop_4 date, measureid integer NOT NULL, eventdatetime date NOT NULL, measure_data jsonb NOT NULL);
|
col_to_drop_4 date, measureid integer NOT NULL, eventdatetime date NOT NULL, measure_data jsonb NOT NULL);
|
||||||
ALTER TABLE sensors ATTACH PARTITION sensors_2004 FOR VALUES FROM ('2004-01-01') TO ('2005-01-01');
|
ALTER TABLE sensors ATTACH PARTITION sensors_2004 FOR VALUES FROM ('2004-01-01') TO ('2005-01-01');
|
||||||
ALTER TABLE sensors DROP COLUMN col_to_drop_4;
|
ALTER TABLE sensors DROP COLUMN col_to_drop_4;
|
||||||
SELECT alter_table_set_access_method('sensors_2004', 'columnar');
|
|
||||||
NOTICE: creating a new table for drop_column_partitioned_table.sensors_2004
|
|
||||||
NOTICE: moving the data of drop_column_partitioned_table.sensors_2004
|
|
||||||
NOTICE: dropping the old drop_column_partitioned_table.sensors_2004
|
|
||||||
NOTICE: renaming the new table to drop_column_partitioned_table.sensors_2004
|
|
||||||
alter_table_set_access_method
|
|
||||||
---------------------------------------------------------------------
|
|
||||||
|
|
||||||
(1 row)
|
|
||||||
|
|
||||||
-- show that all partitions have the same distribution key
|
-- show that all partitions have the same distribution key
|
||||||
SELECT
|
SELECT
|
||||||
p.logicalrelid::regclass, column_to_column_name(p.logicalrelid, p.partkey)
|
p.logicalrelid::regclass, column_to_column_name(p.logicalrelid, p.partkey)
|
||||||
|
@ -160,7 +143,7 @@ SELECT logicalrelid, shardid, shardminvalue, shardmaxvalue FROM pg_dist_shard WH
|
||||||
sensors_2001 | 2580009 | -1073741824 | -1
|
sensors_2001 | 2580009 | -1073741824 | -1
|
||||||
sensors_2002 | 2580013 | -1073741824 | -1
|
sensors_2002 | 2580013 | -1073741824 | -1
|
||||||
sensors_2003 | 2580017 | -1073741824 | -1
|
sensors_2003 | 2580017 | -1073741824 | -1
|
||||||
sensors_2004 | 2580025 | -1073741824 | -1
|
sensors_2004 | 2580021 | -1073741824 | -1
|
||||||
(6 rows)
|
(6 rows)
|
||||||
|
|
||||||
VACUUM ANALYZE sensors, sensors_2000, sensors_2001, sensors_2002, sensors_2003;
|
VACUUM ANALYZE sensors, sensors_2000, sensors_2001, sensors_2002, sensors_2003;
|
||||||
|
@ -227,7 +210,7 @@ EXPLAIN (COSTS FALSE) INSERT INTO sensors_2003 VALUES (3, '2003-01-01', row_to_j
|
||||||
(7 rows)
|
(7 rows)
|
||||||
|
|
||||||
EXPLAIN (COSTS FALSE) SELECT count(*) FROM sensors WHERE measureid = 3 AND eventdatetime = '2000-02-02';
|
EXPLAIN (COSTS FALSE) SELECT count(*) FROM sensors WHERE measureid = 3 AND eventdatetime = '2000-02-02';
|
||||||
QUERY PLAN
|
QUERY PLAN
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
Custom Scan (Citus Adaptive)
|
Custom Scan (Citus Adaptive)
|
||||||
Task Count: 1
|
Task Count: 1
|
||||||
|
@ -235,12 +218,12 @@ EXPLAIN (COSTS FALSE) SELECT count(*) FROM sensors WHERE measureid = 3 AND event
|
||||||
-> Task
|
-> Task
|
||||||
Node: host=localhost port=xxxxx dbname=regression
|
Node: host=localhost port=xxxxx dbname=regression
|
||||||
-> Aggregate
|
-> Aggregate
|
||||||
-> Index Only Scan using sensors_2000_pkey_2580005 on sensors_2000_2580005 sensors
|
-> Seq Scan on sensors_2000_2580005 sensors
|
||||||
Index Cond: ((measureid = 3) AND (eventdatetime = '2000-02-02'::date))
|
Filter: ((measureid = 3) AND (eventdatetime = '2000-02-02'::date))
|
||||||
(8 rows)
|
(8 rows)
|
||||||
|
|
||||||
EXPLAIN (COSTS FALSE) SELECT count(*) FROM sensors_2000 WHERE measureid = 3;
|
EXPLAIN (COSTS FALSE) SELECT count(*) FROM sensors_2000 WHERE measureid = 3;
|
||||||
QUERY PLAN
|
QUERY PLAN
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
Custom Scan (Citus Adaptive)
|
Custom Scan (Citus Adaptive)
|
||||||
Task Count: 1
|
Task Count: 1
|
||||||
|
@ -248,14 +231,12 @@ EXPLAIN (COSTS FALSE) SELECT count(*) FROM sensors_2000 WHERE measureid = 3;
|
||||||
-> Task
|
-> Task
|
||||||
Node: host=localhost port=xxxxx dbname=regression
|
Node: host=localhost port=xxxxx dbname=regression
|
||||||
-> Aggregate
|
-> Aggregate
|
||||||
-> Bitmap Heap Scan on sensors_2000_2580005 sensors_2000
|
-> Seq Scan on sensors_2000_2580005 sensors_2000
|
||||||
Recheck Cond: (measureid = 3)
|
Filter: (measureid = 3)
|
||||||
-> Bitmap Index Scan on sensors_2000_pkey_2580005
|
(8 rows)
|
||||||
Index Cond: (measureid = 3)
|
|
||||||
(10 rows)
|
|
||||||
|
|
||||||
EXPLAIN (COSTS FALSE) SELECT count(*) FROM sensors_2001 WHERE measureid = 3;
|
EXPLAIN (COSTS FALSE) SELECT count(*) FROM sensors_2001 WHERE measureid = 3;
|
||||||
QUERY PLAN
|
QUERY PLAN
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
Custom Scan (Citus Adaptive)
|
Custom Scan (Citus Adaptive)
|
||||||
Task Count: 1
|
Task Count: 1
|
||||||
|
@ -263,11 +244,9 @@ EXPLAIN (COSTS FALSE) SELECT count(*) FROM sensors_2001 WHERE measureid = 3;
|
||||||
-> Task
|
-> Task
|
||||||
Node: host=localhost port=xxxxx dbname=regression
|
Node: host=localhost port=xxxxx dbname=regression
|
||||||
-> Aggregate
|
-> Aggregate
|
||||||
-> Bitmap Heap Scan on sensors_2001_2580009 sensors_2001
|
-> Seq Scan on sensors_2001_2580009 sensors_2001
|
||||||
Recheck Cond: (measureid = 3)
|
Filter: (measureid = 3)
|
||||||
-> Bitmap Index Scan on sensors_2001_pkey_2580009
|
(8 rows)
|
||||||
Index Cond: (measureid = 3)
|
|
||||||
(10 rows)
|
|
||||||
|
|
||||||
EXPLAIN (COSTS FALSE) SELECT count(*) FROM sensors_2002 WHERE measureid = 3;
|
EXPLAIN (COSTS FALSE) SELECT count(*) FROM sensors_2002 WHERE measureid = 3;
|
||||||
QUERY PLAN
|
QUERY PLAN
|
||||||
|
@ -366,7 +345,6 @@ SELECT * FROM sensors_2003 WHERE measureid = 3
|
||||||
UNION
|
UNION
|
||||||
SELECT * FROM sensors_2004 WHERE measureid = 3
|
SELECT * FROM sensors_2004 WHERE measureid = 3
|
||||||
) as foo;
|
) as foo;
|
||||||
DEBUG: pathlist hook for columnar table am
|
|
||||||
DEBUG: Creating router plan
|
DEBUG: Creating router plan
|
||||||
DEBUG: query has a single distribution column value: 3
|
DEBUG: query has a single distribution column value: 3
|
||||||
count
|
count
|
||||||
|
@ -397,32 +375,5 @@ WHERE
|
||||||
sensors_2004 | measureid
|
sensors_2004 | measureid
|
||||||
(6 rows)
|
(6 rows)
|
||||||
|
|
||||||
\c - - - :worker_1_port
|
|
||||||
SET search_path TO drop_column_partitioned_table;
|
|
||||||
SELECT
|
|
||||||
p.logicalrelid::regclass, column_to_column_name(p.logicalrelid, p.partkey)
|
|
||||||
FROM
|
|
||||||
pg_dist_partition p
|
|
||||||
WHERE
|
|
||||||
logicalrelid IN ('sensors'::regclass, 'sensors_2000'::regclass,
|
|
||||||
'sensors_2001'::regclass, 'sensors_2002'::regclass,
|
|
||||||
'sensors_2003'::regclass, 'sensors_2004'::regclass);
|
|
||||||
logicalrelid | column_to_column_name
|
|
||||||
---------------------------------------------------------------------
|
|
||||||
sensors | measureid
|
|
||||||
sensors_2000 | measureid
|
|
||||||
sensors_2001 | measureid
|
|
||||||
sensors_2002 | measureid
|
|
||||||
sensors_2003 | measureid
|
|
||||||
sensors_2004 | measureid
|
|
||||||
(6 rows)
|
|
||||||
|
|
||||||
\c - - - :master_port
|
|
||||||
SET client_min_messages TO WARNING;
|
SET client_min_messages TO WARNING;
|
||||||
DROP SCHEMA drop_column_partitioned_table CASCADE;
|
DROP SCHEMA drop_column_partitioned_table CASCADE;
|
||||||
SELECT stop_metadata_sync_to_node('localhost', :worker_1_port);
|
|
||||||
stop_metadata_sync_to_node
|
|
||||||
---------------------------------------------------------------------
|
|
||||||
|
|
||||||
(1 row)
|
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,6 @@ SET search_path TO drop_column_partitioned_table;
|
||||||
|
|
||||||
SET citus.shard_replication_factor TO 1;
|
SET citus.shard_replication_factor TO 1;
|
||||||
SET citus.next_shard_id TO 2580000;
|
SET citus.next_shard_id TO 2580000;
|
||||||
SELECT start_metadata_sync_to_node('localhost', :worker_1_port);
|
|
||||||
|
|
||||||
-- create a partitioned table with some columns that
|
-- create a partitioned table with some columns that
|
||||||
-- are going to be dropped within the tests
|
-- are going to be dropped within the tests
|
||||||
|
@ -15,8 +14,7 @@ col_to_drop_3 inet,
|
||||||
col_to_drop_4 date,
|
col_to_drop_4 date,
|
||||||
measureid integer,
|
measureid integer,
|
||||||
eventdatetime date,
|
eventdatetime date,
|
||||||
measure_data jsonb,
|
measure_data jsonb)
|
||||||
PRIMARY KEY (measureid, eventdatetime, measure_data))
|
|
||||||
PARTITION BY RANGE(eventdatetime);
|
PARTITION BY RANGE(eventdatetime);
|
||||||
|
|
||||||
-- drop column even before attaching any partitions
|
-- drop column even before attaching any partitions
|
||||||
|
@ -76,7 +74,6 @@ col_to_drop_4 date, measureid integer NOT NULL, eventdatetime date NOT NULL, mea
|
||||||
|
|
||||||
ALTER TABLE sensors ATTACH PARTITION sensors_2004 FOR VALUES FROM ('2004-01-01') TO ('2005-01-01');
|
ALTER TABLE sensors ATTACH PARTITION sensors_2004 FOR VALUES FROM ('2004-01-01') TO ('2005-01-01');
|
||||||
ALTER TABLE sensors DROP COLUMN col_to_drop_4;
|
ALTER TABLE sensors DROP COLUMN col_to_drop_4;
|
||||||
SELECT alter_table_set_access_method('sensors_2004', 'columnar');
|
|
||||||
|
|
||||||
-- show that all partitions have the same distribution key
|
-- show that all partitions have the same distribution key
|
||||||
SELECT
|
SELECT
|
||||||
|
@ -167,21 +164,5 @@ WHERE
|
||||||
logicalrelid IN ('sensors'::regclass, 'sensors_2000'::regclass,
|
logicalrelid IN ('sensors'::regclass, 'sensors_2000'::regclass,
|
||||||
'sensors_2001'::regclass, 'sensors_2002'::regclass,
|
'sensors_2001'::regclass, 'sensors_2002'::regclass,
|
||||||
'sensors_2003'::regclass, 'sensors_2004'::regclass);
|
'sensors_2003'::regclass, 'sensors_2004'::regclass);
|
||||||
|
|
||||||
\c - - - :worker_1_port
|
|
||||||
SET search_path TO drop_column_partitioned_table;
|
|
||||||
SELECT
|
|
||||||
p.logicalrelid::regclass, column_to_column_name(p.logicalrelid, p.partkey)
|
|
||||||
FROM
|
|
||||||
pg_dist_partition p
|
|
||||||
WHERE
|
|
||||||
logicalrelid IN ('sensors'::regclass, 'sensors_2000'::regclass,
|
|
||||||
'sensors_2001'::regclass, 'sensors_2002'::regclass,
|
|
||||||
'sensors_2003'::regclass, 'sensors_2004'::regclass);
|
|
||||||
|
|
||||||
\c - - - :master_port
|
|
||||||
SET client_min_messages TO WARNING;
|
SET client_min_messages TO WARNING;
|
||||||
DROP SCHEMA drop_column_partitioned_table CASCADE;
|
DROP SCHEMA drop_column_partitioned_table CASCADE;
|
||||||
|
|
||||||
SELECT stop_metadata_sync_to_node('localhost', :worker_1_port);
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue