Move functions

velioglu/wo_seq_test_1
Burak Velioglu 2022-01-16 23:54:04 +03:00
parent aedd09ffdf
commit 6fd5f8e658
No known key found for this signature in database
GPG Key ID: F6827E620F6549C6
1 changed files with 66 additions and 66 deletions

View File

@ -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
* tables from the given node.
@ -766,23 +743,57 @@ ClearShellTablesCommandList()
/*
* ResyncMetadataCommandList returns the command list to resync all the
* distributed table related metadata.
* 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 *
ResyncMetadataCommandList()
PropagateNodeWideObjectsCommandList()
{
List *resyncMetadataCommandList = NIL;
/* collect all commands */
List *ddlCommands = NIL;
List *clearMetadataCommandList = ClearMetadataCommandList();
resyncMetadataCommandList = list_concat(resyncMetadataCommandList,
clearMetadataCommandList);
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);
}
List *setupMetadataCommandList = MetadataSetupCommandList();
resyncMetadataCommandList = list_concat(resyncMetadataCommandList,
setupMetadataCommandList);
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 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
* 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
* required for modifying it. This fails if the node does not exist.