Skip dependency setup on coordinator node

pull/3786/head
Hanefi Önaldı 2020-04-20 13:03:06 +03:00
parent 2e5b1bfa41
commit e85b835065
No known key found for this signature in database
GPG Key ID: 45A2ACB84E394FBA
4 changed files with 23 additions and 14 deletions

View File

@ -380,6 +380,9 @@ master_set_node_property(PG_FUNCTION_ARGS)
* - All dependencies (e.g., types, schemas)
* - Reference tables, because they are needed to handle queries efficiently.
* - Distributed functions
*
* Note that we do not create the distributed dependencies on the coordinator
* since all the dependencies should be present in the coordinator already.
*/
static void
SetUpDistributedTableDependencies(WorkerNode *newWorkerNode)
@ -388,13 +391,13 @@ SetUpDistributedTableDependencies(WorkerNode *newWorkerNode)
{
EnsureNoModificationsHaveBeenDone();
if (ShouldPropagate())
if (ShouldPropagate() && !NodeIsCoordinator(newWorkerNode))
{
PropagateNodeWideObjects(newWorkerNode);
ReplicateAllDependenciesToNode(newWorkerNode->workerName,
newWorkerNode->workerPort);
}
else
else if (!NodeIsCoordinator(newWorkerNode))
{
ereport(WARNING, (errmsg("citus.enable_object_propagation is off, not "
"creating distributed objects on worker"),

View File

@ -4,18 +4,6 @@ SET client_min_messages TO DEBUG;
SET citus.next_shard_id TO 1570000;
SET citus.replicate_reference_tables_on_activate TO off;
SELECT * FROM master_add_node('localhost', :master_port, groupid := 0);
DEBUG: schema "public" already exists, skipping
DETAIL: from localhost:xxxxx
DEBUG: extension "plpgsql" already exists, skipping
DETAIL: from localhost:xxxxx
DEBUG: schema "citus_mx_test_schema" already exists, skipping
DETAIL: from localhost:xxxxx
DEBUG: schema "citus_mx_test_schema_join_1" already exists, skipping
DETAIL: from localhost:xxxxx
DEBUG: schema "citus_mx_test_schema_join_2" already exists, skipping
DETAIL: from localhost:xxxxx
DEBUG: schema "citus_mx_schema_for_xacts" already exists, skipping
DETAIL: from localhost:xxxxx
master_add_node
---------------------------------------------------------------------
32

View File

@ -427,6 +427,18 @@ ROLLBACK;
-- see https://github.com/citusdata/citus/issues/3279
ALTER TABLE squares DROP COLUMN b;
NOTICE: executing the command locally: SELECT worker_apply_shard_ddl_command (8000000, 'replicate_ref_to_coordinator', 'ALTER TABLE squares DROP COLUMN b;')
-- verify that we replicate the reference tables that are distributed before
-- adding the coordinator as a worker.
SELECT master_remove_node('localhost', :master_port);
master_remove_node
---------------------------------------------------------------------
(1 row)
-- add the coordinator as a worker node and verify that the reference tables are replicated
SELECT master_add_node('localhost', :master_port, groupid => 0) AS master_nodeid \gset
NOTICE: Replicating reference table "squares" to the node localhost:xxxxx
NOTICE: Replicating reference table "numbers" to the node localhost:xxxxx
-- clean-up
SET client_min_messages TO ERROR;
DROP SCHEMA replicate_ref_to_coordinator CASCADE;

View File

@ -250,6 +250,12 @@ ROLLBACK;
-- see https://github.com/citusdata/citus/issues/3279
ALTER TABLE squares DROP COLUMN b;
-- verify that we replicate the reference tables that are distributed before
-- adding the coordinator as a worker.
SELECT master_remove_node('localhost', :master_port);
-- add the coordinator as a worker node and verify that the reference tables are replicated
SELECT master_add_node('localhost', :master_port, groupid => 0) AS master_nodeid \gset
-- clean-up
SET client_min_messages TO ERROR;