mirror of https://github.com/citusdata/citus.git
Move functions
parent
aedd09ffdf
commit
6fd5f8e658
|
@ -721,29 +721,6 @@ MetadataSetupCommandList()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* RecreateDistributedTablesWithDependenciesCommandList return command list to recreate
|
|
||||||
* distributed tables with command list.
|
|
||||||
*/
|
|
||||||
static List *
|
|
||||||
RecreateDistributedTablesWithDependenciesCommandList(WorkerNode *workerNode)
|
|
||||||
{
|
|
||||||
List *commandList = NIL;
|
|
||||||
|
|
||||||
commandList = list_concat(commandList, DetachPartitionCommandList());
|
|
||||||
commandList = list_concat(commandList, ClearShellTablesCommandList());
|
|
||||||
commandList = list_concat(commandList, PropagateNodeWideObjectsCommandList());
|
|
||||||
commandList = list_concat(commandList, list_make1(LocalGroupIdUpdateCommand(
|
|
||||||
workerNode->groupId)));
|
|
||||||
commandList = list_concat(commandList, ReplicateAllDependenciesToNodeCommandList(
|
|
||||||
workerNode->workerName, workerNode->workerPort));
|
|
||||||
commandList = list_concat(commandList,
|
|
||||||
MultipleDistributedTableIntegrationsCommandList());
|
|
||||||
|
|
||||||
return commandList;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* ClearShellTablesCommandList returns the command list to clear (shell) distributed
|
* ClearShellTablesCommandList returns the command list to clear (shell) distributed
|
||||||
* tables from the given node.
|
* tables from the given node.
|
||||||
|
@ -766,23 +743,57 @@ ClearShellTablesCommandList()
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* ResyncMetadataCommandList returns the command list to resync all the
|
* PropagateNodeWideObjectsCommandList is called during node activation to
|
||||||
* distributed table related metadata.
|
* propagate any object that should be propagated for every node. These are
|
||||||
|
* generally not linked to any distributed object but change system wide behaviour.
|
||||||
*/
|
*/
|
||||||
static List *
|
static List *
|
||||||
ResyncMetadataCommandList()
|
PropagateNodeWideObjectsCommandList()
|
||||||
{
|
{
|
||||||
List *resyncMetadataCommandList = NIL;
|
/* collect all commands */
|
||||||
|
List *ddlCommands = NIL;
|
||||||
|
|
||||||
List *clearMetadataCommandList = ClearMetadataCommandList();
|
if (EnableAlterRoleSetPropagation)
|
||||||
resyncMetadataCommandList = list_concat(resyncMetadataCommandList,
|
{
|
||||||
clearMetadataCommandList);
|
/*
|
||||||
|
* Get commands for database and postgres wide settings. Since these settings are not
|
||||||
|
* linked to any role that can be distributed we need to distribute them seperately
|
||||||
|
*/
|
||||||
|
List *alterRoleSetCommands = GenerateAlterRoleSetCommandForRole(InvalidOid);
|
||||||
|
ddlCommands = list_concat(ddlCommands, alterRoleSetCommands);
|
||||||
|
}
|
||||||
|
|
||||||
List *setupMetadataCommandList = MetadataSetupCommandList();
|
if (list_length(ddlCommands) > 0)
|
||||||
resyncMetadataCommandList = list_concat(resyncMetadataCommandList,
|
{
|
||||||
setupMetadataCommandList);
|
/* if there are command wrap them in enable_ddl_propagation off */
|
||||||
|
ddlCommands = lcons(DISABLE_DDL_PROPAGATION, ddlCommands);
|
||||||
|
ddlCommands = lappend(ddlCommands, ENABLE_DDL_PROPAGATION);
|
||||||
|
}
|
||||||
|
|
||||||
return resyncMetadataCommandList;
|
return ddlCommands;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* RecreateDistributedTablesWithDependenciesCommandList return command list to recreate
|
||||||
|
* distributed tables with command list.
|
||||||
|
*/
|
||||||
|
static List *
|
||||||
|
RecreateDistributedTablesWithDependenciesCommandList(WorkerNode *workerNode)
|
||||||
|
{
|
||||||
|
List *commandList = NIL;
|
||||||
|
|
||||||
|
commandList = list_concat(commandList, DetachPartitionCommandList());
|
||||||
|
commandList = list_concat(commandList, ClearShellTablesCommandList());
|
||||||
|
commandList = list_concat(commandList, PropagateNodeWideObjectsCommandList());
|
||||||
|
commandList = list_concat(commandList, list_make1(LocalGroupIdUpdateCommand(
|
||||||
|
workerNode->groupId)));
|
||||||
|
commandList = list_concat(commandList, ReplicateAllDependenciesToNodeCommandList(
|
||||||
|
workerNode->workerName, workerNode->workerPort));
|
||||||
|
commandList = list_concat(commandList,
|
||||||
|
MultipleDistributedTableIntegrationsCommandList());
|
||||||
|
|
||||||
|
return commandList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -816,6 +827,27 @@ ClearMetadataCommandList()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* ResyncMetadataCommandList returns the command list to resync all the
|
||||||
|
* distributed table related metadata.
|
||||||
|
*/
|
||||||
|
static List *
|
||||||
|
ResyncMetadataCommandList()
|
||||||
|
{
|
||||||
|
List *resyncMetadataCommandList = NIL;
|
||||||
|
|
||||||
|
List *clearMetadataCommandList = ClearMetadataCommandList();
|
||||||
|
resyncMetadataCommandList = list_concat(resyncMetadataCommandList,
|
||||||
|
clearMetadataCommandList);
|
||||||
|
|
||||||
|
List *setupMetadataCommandList = MetadataSetupCommandList();
|
||||||
|
resyncMetadataCommandList = list_concat(resyncMetadataCommandList,
|
||||||
|
setupMetadataCommandList);
|
||||||
|
|
||||||
|
return resyncMetadataCommandList;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* SetUpDistributedTableWithDependencies sets up up the following on a node if it's
|
* SetUpDistributedTableWithDependencies sets up up the following on a node if it's
|
||||||
* a primary node that currently stores data:
|
* a primary node that currently stores data:
|
||||||
|
@ -859,38 +891,6 @@ SetUpDistributedTableWithDependencies(WorkerNode *newWorkerNode)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* PropagateNodeWideObjectsCommandList is called during node activation to
|
|
||||||
* propagate any object that should be propagated for every node. These are
|
|
||||||
* generally not linked to any distributed object but change system wide behaviour.
|
|
||||||
*/
|
|
||||||
static List *
|
|
||||||
PropagateNodeWideObjectsCommandList()
|
|
||||||
{
|
|
||||||
/* collect all commands */
|
|
||||||
List *ddlCommands = NIL;
|
|
||||||
|
|
||||||
if (EnableAlterRoleSetPropagation)
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
* Get commands for database and postgres wide settings. Since these settings are not
|
|
||||||
* linked to any role that can be distributed we need to distribute them seperately
|
|
||||||
*/
|
|
||||||
List *alterRoleSetCommands = GenerateAlterRoleSetCommandForRole(InvalidOid);
|
|
||||||
ddlCommands = list_concat(ddlCommands, alterRoleSetCommands);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (list_length(ddlCommands) > 0)
|
|
||||||
{
|
|
||||||
/* if there are command wrap them in enable_ddl_propagation off */
|
|
||||||
ddlCommands = lcons(DISABLE_DDL_PROPAGATION, ddlCommands);
|
|
||||||
ddlCommands = lappend(ddlCommands, ENABLE_DDL_PROPAGATION);
|
|
||||||
}
|
|
||||||
|
|
||||||
return ddlCommands;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* ModifiableWorkerNode gets the requested WorkerNode and also gets locks
|
* ModifiableWorkerNode gets the requested WorkerNode and also gets locks
|
||||||
* required for modifying it. This fails if the node does not exist.
|
* required for modifying it. This fails if the node does not exist.
|
||||||
|
|
Loading…
Reference in New Issue