mirror of https://github.com/citusdata/citus.git
Merge pull request #911 from citusdata/bugfix/take_metadata_lock
Take shard metadata lock in several UDFspull/995/head
commit
ab982c3ecb
|
@ -226,12 +226,11 @@ master_append_table_to_shard(PG_FUNCTION_ARGS)
|
||||||
"in hash-partitioned tables")));
|
"in hash-partitioned tables")));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/* ensure that the shard placement metadata does not change during the append */
|
||||||
* We lock on the shardId, but do not unlock. When the function returns, and
|
LockShardDistributionMetadata(shardId, ShareLock);
|
||||||
* the transaction for this function commits, this lock will automatically
|
|
||||||
* be released. This ensures appends to a shard happen in a serial manner.
|
/* serialize appends to the same shard */
|
||||||
*/
|
LockShardResource(shardId, ExclusiveLock);
|
||||||
LockShardResource(shardId, AccessExclusiveLock);
|
|
||||||
|
|
||||||
/* get schame name of the target shard */
|
/* get schame name of the target shard */
|
||||||
shardSchemaOid = get_rel_namespace(relationId);
|
shardSchemaOid = get_rel_namespace(relationId);
|
||||||
|
|
Loading…
Reference in New Issue