mirror of https://github.com/citusdata/citus.git
enable local execution for DDL commands on distributed & reference tables
parent
c162755cc5
commit
26cec16b16
|
@ -684,16 +684,27 @@ ExecuteDistributedDDLJob(DDLJob *ddlJob)
|
|||
|
||||
EnsureCoordinator();
|
||||
|
||||
if (ddlJob->targetRelationId != InvalidOid)
|
||||
Oid targetRelationId = ddlJob->targetRelationId;
|
||||
|
||||
if (OidIsValid(targetRelationId))
|
||||
{
|
||||
/*
|
||||
* Only for ddlJobs that are targetting a relation (table) we want to sync its
|
||||
* metadata and verify some properties around the table.
|
||||
* Only for ddlJobs that are targetting a relation (table) we want to sync
|
||||
* its metadata and verify some properties around the table.
|
||||
*/
|
||||
shouldSyncMetadata = ShouldSyncTableMetadata(ddlJob->targetRelationId);
|
||||
EnsurePartitionTableNotReplicated(ddlJob->targetRelationId);
|
||||
shouldSyncMetadata = ShouldSyncTableMetadata(targetRelationId);
|
||||
EnsurePartitionTableNotReplicated(targetRelationId);
|
||||
}
|
||||
|
||||
/*
|
||||
* If it is a local placement of a distributed table or a reference table,
|
||||
* then execute the DDL command locally.
|
||||
* Here we set localExecutionSupported to true regardless of whether the
|
||||
* DDL command is run for/on a distributed table as
|
||||
* ExecuteUtilityTaskListWithoutResults would already identify those
|
||||
* DDL tasks not accessing any of the local placements.
|
||||
*/
|
||||
bool localExecutionSupported = true;
|
||||
|
||||
if (!ddlJob->concurrentIndexCmd)
|
||||
{
|
||||
|
@ -715,9 +726,6 @@ ExecuteDistributedDDLJob(DDLJob *ddlJob)
|
|||
SendCommandToWorkersWithMetadata((char *) ddlJob->commandString);
|
||||
}
|
||||
|
||||
/* local execution is not implemented for this code path */
|
||||
bool tryLocalExecution = false;
|
||||
|
||||
ExecuteUtilityTaskListWithoutResults(ddlJob->taskList, localExecutionSupported);
|
||||
}
|
||||
else
|
||||
|
@ -729,9 +737,6 @@ ExecuteDistributedDDLJob(DDLJob *ddlJob)
|
|||
|
||||
PG_TRY();
|
||||
{
|
||||
/* local execution is not implemented for this code path */
|
||||
bool tryLocalExecution = false;
|
||||
|
||||
ExecuteUtilityTaskListWithoutResults(ddlJob->taskList,
|
||||
localExecutionSupported);
|
||||
|
||||
|
|
Loading…
Reference in New Issue