Add use_citus_managed_tables to arbitrary configs

(cherry picked from commit 4e93afd1f78854e1aaab63690c441b0b0598a82c)
arbitrary-test-guc
Ahmet Gedemenli 2021-12-24 16:17:34 +03:00
parent 8d40cba471
commit 0295fe2f5b
3 changed files with 9 additions and 0 deletions

View File

@ -161,6 +161,7 @@ class CitusDefaultClusterConfig(CitusBaseClusterConfig):
new_settings = { new_settings = {
"client_min_messages": "WARNING", "client_min_messages": "WARNING",
"citus.sort_returning": True, "citus.sort_returning": True,
"citus.use_citus_managed_tables": True,
} }
self.settings.update(new_settings) self.settings.update(new_settings)
self.add_coordinator_to_metadata = True self.add_coordinator_to_metadata = True

View File

@ -25,6 +25,7 @@ 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;
SET citus.enable_local_execution TO ON;
-- now attach the first partition and create the distributed table -- now attach the first partition and create the distributed table
CREATE TABLE sensors_2000 PARTITION OF sensors FOR VALUES FROM ('2000-01-01') TO ('2001-01-01'); CREATE TABLE sensors_2000 PARTITION OF sensors FOR VALUES FROM ('2000-01-01') TO ('2001-01-01');
SELECT create_distributed_table('sensors', 'measureid'); SELECT create_distributed_table('sensors', 'measureid');
@ -37,6 +38,7 @@ SELECT create_distributed_table('sensors', 'measureid');
-- with .. PARTITION OF .. syntax -- with .. PARTITION OF .. syntax
ALTER TABLE sensors DROP COLUMN col_to_drop_0; ALTER TABLE sensors DROP COLUMN col_to_drop_0;
CREATE TABLE sensors_2001 PARTITION OF sensors FOR VALUES FROM ('2001-01-01') TO ('2002-01-01'); CREATE TABLE sensors_2001 PARTITION OF sensors FOR VALUES FROM ('2001-01-01') TO ('2002-01-01');
SET citus.enable_local_execution TO OFF;
-- drop another column before attaching another partition -- drop another column before attaching another partition
-- with ALTER TABLE .. ATTACH PARTITION -- with ALTER TABLE .. ATTACH PARTITION
ALTER TABLE sensors DROP COLUMN col_to_drop_2; ALTER TABLE sensors DROP COLUMN col_to_drop_2;
@ -61,9 +63,11 @@ 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;
SET citus.enable_local_execution TO ON;
SELECT alter_table_set_access_method('sensors_2004', 'columnar'); SELECT alter_table_set_access_method('sensors_2004', 'columnar');
alter_table_set_access_method alter_table_set_access_method
--------------------------------------------------------------------- ---------------------------------------------------------------------
(1 row) (1 row)
SET citus.enable_local_execution TO OFF;

View File

@ -25,6 +25,7 @@ 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;
SET citus.enable_local_execution TO ON;
-- now attach the first partition and create the distributed table -- now attach the first partition and create the distributed table
CREATE TABLE sensors_2000 PARTITION OF sensors FOR VALUES FROM ('2000-01-01') TO ('2001-01-01'); CREATE TABLE sensors_2000 PARTITION OF sensors FOR VALUES FROM ('2000-01-01') TO ('2001-01-01');
SELECT create_distributed_table('sensors', 'measureid'); SELECT create_distributed_table('sensors', 'measureid');
@ -33,6 +34,7 @@ SELECT create_distributed_table('sensors', 'measureid');
-- with .. PARTITION OF .. syntax -- with .. PARTITION OF .. syntax
ALTER TABLE sensors DROP COLUMN col_to_drop_0; ALTER TABLE sensors DROP COLUMN col_to_drop_0;
CREATE TABLE sensors_2001 PARTITION OF sensors FOR VALUES FROM ('2001-01-01') TO ('2002-01-01'); CREATE TABLE sensors_2001 PARTITION OF sensors FOR VALUES FROM ('2001-01-01') TO ('2002-01-01');
SET citus.enable_local_execution TO OFF;
-- drop another column before attaching another partition -- drop another column before attaching another partition
-- with ALTER TABLE .. ATTACH PARTITION -- with ALTER TABLE .. ATTACH PARTITION
@ -59,4 +61,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;
SET citus.enable_local_execution TO ON;
SELECT alter_table_set_access_method('sensors_2004', 'columnar'); SELECT alter_table_set_access_method('sensors_2004', 'columnar');
SET citus.enable_local_execution TO OFF;