mirror of https://github.com/citusdata/citus.git
Allow distributed INSERT...SELECT via worker nodes in MX
parent
7280774cf4
commit
6219186683
|
@ -321,14 +321,6 @@ DistributedInsertSelectSupported(Query *queryTree, RangeTblEntry *insertRte,
|
||||||
NULL, NULL);
|
NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GetLocalGroupId() != 0)
|
|
||||||
{
|
|
||||||
return DeferredError(ERRCODE_FEATURE_NOT_SUPPORTED,
|
|
||||||
"distributed INSERT ... SELECT can only be performed from "
|
|
||||||
"the coordinator",
|
|
||||||
NULL, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* we do not expect to see a view in modify target */
|
/* we do not expect to see a view in modify target */
|
||||||
foreach(rangeTableCell, queryTree->rtable)
|
foreach(rangeTableCell, queryTree->rtable)
|
||||||
{
|
{
|
||||||
|
|
|
@ -428,14 +428,12 @@ SELECT * FROM multiple_hash_mx WHERE category = '2' ORDER BY category, data;
|
||||||
INSERT INTO multiple_hash_mx
|
INSERT INTO multiple_hash_mx
|
||||||
SELECT s, s*2 FROM generate_series(1,10) s;
|
SELECT s, s*2 FROM generate_series(1,10) s;
|
||||||
INSERT 0 10
|
INSERT 0 10
|
||||||
-- but are never distributed
|
-- including distributed INSERT ... SELECT
|
||||||
BEGIN;
|
BEGIN;
|
||||||
BEGIN
|
BEGIN
|
||||||
SET LOCAL client_min_messages TO DEBUG1;
|
SET LOCAL client_min_messages TO DEBUG1;
|
||||||
SET
|
SET
|
||||||
INSERT INTO multiple_hash_mx SELECT * FROM multiple_hash_mx;
|
INSERT INTO multiple_hash_mx SELECT * FROM multiple_hash_mx;
|
||||||
DEBUG: distributed INSERT ... SELECT can only be performed from the coordinator
|
|
||||||
DEBUG: Collecting INSERT ... SELECT results on coordinator
|
|
||||||
INSERT 0 10
|
INSERT 0 10
|
||||||
END;
|
END;
|
||||||
COMMIT
|
COMMIT
|
||||||
|
|
|
@ -264,19 +264,6 @@ SELECT count(*) FROM mx_table;
|
||||||
5
|
5
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
-- INSERT / SELECT pulls results to worker
|
|
||||||
BEGIN;
|
|
||||||
SET LOCAL client_min_messages TO DEBUG;
|
|
||||||
INSERT INTO mx_table_2 SELECT * FROM mx_table;
|
|
||||||
DEBUG: distributed INSERT ... SELECT can only be performed from the coordinator
|
|
||||||
DEBUG: Collecting INSERT ... SELECT results on coordinator
|
|
||||||
END;
|
|
||||||
SELECT count(*) FROM mx_table_2;
|
|
||||||
count
|
|
||||||
-------
|
|
||||||
5
|
|
||||||
(1 row)
|
|
||||||
|
|
||||||
-- mark_tables_colocated
|
-- mark_tables_colocated
|
||||||
UPDATE pg_dist_partition SET colocationid = 0 WHERE logicalrelid='mx_table_2'::regclass;
|
UPDATE pg_dist_partition SET colocationid = 0 WHERE logicalrelid='mx_table_2'::regclass;
|
||||||
SELECT mark_tables_colocated('mx_table', ARRAY['mx_table_2']);
|
SELECT mark_tables_colocated('mx_table', ARRAY['mx_table_2']);
|
||||||
|
|
|
@ -276,7 +276,7 @@ SELECT * FROM multiple_hash_mx WHERE category = '2' ORDER BY category, data;
|
||||||
INSERT INTO multiple_hash_mx
|
INSERT INTO multiple_hash_mx
|
||||||
SELECT s, s*2 FROM generate_series(1,10) s;
|
SELECT s, s*2 FROM generate_series(1,10) s;
|
||||||
|
|
||||||
-- but are never distributed
|
-- including distributed INSERT ... SELECT
|
||||||
BEGIN;
|
BEGIN;
|
||||||
SET LOCAL client_min_messages TO DEBUG1;
|
SET LOCAL client_min_messages TO DEBUG1;
|
||||||
INSERT INTO multiple_hash_mx SELECT * FROM multiple_hash_mx;
|
INSERT INTO multiple_hash_mx SELECT * FROM multiple_hash_mx;
|
||||||
|
|
|
@ -138,14 +138,6 @@ SELECT master_remove_node('localhost', 5432);
|
||||||
TRUNCATE mx_table;
|
TRUNCATE mx_table;
|
||||||
SELECT count(*) FROM mx_table;
|
SELECT count(*) FROM mx_table;
|
||||||
|
|
||||||
-- INSERT / SELECT pulls results to worker
|
|
||||||
BEGIN;
|
|
||||||
SET LOCAL client_min_messages TO DEBUG;
|
|
||||||
INSERT INTO mx_table_2 SELECT * FROM mx_table;
|
|
||||||
END;
|
|
||||||
|
|
||||||
SELECT count(*) FROM mx_table_2;
|
|
||||||
|
|
||||||
-- mark_tables_colocated
|
-- mark_tables_colocated
|
||||||
UPDATE pg_dist_partition SET colocationid = 0 WHERE logicalrelid='mx_table_2'::regclass;
|
UPDATE pg_dist_partition SET colocationid = 0 WHERE logicalrelid='mx_table_2'::regclass;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue