enable local execution for DDL commands on distributed & reference tables

improve-drop-trigger2
Onur Tirtir 2020-02-28 19:01:20 +03:00
parent c162755cc5
commit 26cec16b16
1 changed files with 16 additions and 11 deletions

View File

@ -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);