mirror of https://github.com/citusdata/citus.git
Check ownership before taking locks in distributed table creation
parent
88717f31b3
commit
5b9376a7f8
|
@ -132,6 +132,7 @@ master_create_distributed_table(PG_FUNCTION_ARGS)
|
||||||
|
|
||||||
CheckCitusVersion(ERROR);
|
CheckCitusVersion(ERROR);
|
||||||
EnsureCoordinator();
|
EnsureCoordinator();
|
||||||
|
EnsureTableOwner(relationId);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Lock target relation with an exclusive lock - there's no way to make
|
* Lock target relation with an exclusive lock - there's no way to make
|
||||||
|
@ -197,6 +198,8 @@ create_distributed_table(PG_FUNCTION_ARGS)
|
||||||
distributionMethodOid = PG_GETARG_OID(2);
|
distributionMethodOid = PG_GETARG_OID(2);
|
||||||
colocateWithTableNameText = PG_GETARG_TEXT_P(3);
|
colocateWithTableNameText = PG_GETARG_TEXT_P(3);
|
||||||
|
|
||||||
|
EnsureTableOwner(relationId);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Lock target relation with an exclusive lock - there's no way to make
|
* Lock target relation with an exclusive lock - there's no way to make
|
||||||
* sense of this table until we've committed, and we don't want multiple
|
* sense of this table until we've committed, and we don't want multiple
|
||||||
|
@ -253,6 +256,7 @@ create_reference_table(PG_FUNCTION_ARGS)
|
||||||
|
|
||||||
EnsureCoordinator();
|
EnsureCoordinator();
|
||||||
CheckCitusVersion(ERROR);
|
CheckCitusVersion(ERROR);
|
||||||
|
EnsureTableOwner(relationId);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Ensure schema exists on each worker node. We can not run this function
|
* Ensure schema exists on each worker node. We can not run this function
|
||||||
|
@ -638,7 +642,6 @@ EnsureRelationCanBeDistributed(Oid relationId, Var *distributionColumn,
|
||||||
char *relationName = NULL;
|
char *relationName = NULL;
|
||||||
Oid parentRelationId = InvalidOid;
|
Oid parentRelationId = InvalidOid;
|
||||||
|
|
||||||
EnsureTableOwner(relationId);
|
|
||||||
EnsureTableNotDistributed(relationId);
|
EnsureTableNotDistributed(relationId);
|
||||||
EnsureLocalTableEmptyIfNecessary(relationId, distributionMethod, viaDeprecatedAPI);
|
EnsureLocalTableEmptyIfNecessary(relationId, distributionMethod, viaDeprecatedAPI);
|
||||||
EnsureReplicationSettings(InvalidOid, replicationModel);
|
EnsureReplicationSettings(InvalidOid, replicationModel);
|
||||||
|
|
Loading…
Reference in New Issue