Remove LockRelationDistributionMetadata function

pull/1488/head
Burak Yucesoy 2017-07-10 15:46:37 +03:00
parent cb6070c720
commit c8b9e4011b
3 changed files with 6 additions and 22 deletions

View File

@ -113,8 +113,8 @@ CreateShardsWithRoundRobinPolicy(Oid distributedTableId, int32 shardCount,
*/ */
EnsureTableOwner(distributedTableId); EnsureTableOwner(distributedTableId);
/* we plan to add shards: get an exclusive metadata lock */ /* we plan to add shards: get an exclusive lock on relation oid */
LockRelationDistributionMetadata(distributedTableId, ExclusiveLock); LockRelationOid(distributedTableId, ExclusiveLock);
relationOwner = TableOwner(distributedTableId); relationOwner = TableOwner(distributedTableId);
@ -264,8 +264,8 @@ CreateColocatedShards(Oid targetRelationId, Oid sourceRelationId)
*/ */
EnsureTableOwner(targetRelationId); EnsureTableOwner(targetRelationId);
/* we plan to add shards: get an exclusive metadata lock on the target relation */ /* we plan to add shards: get an exclusive lock on target relation oid */
LockRelationDistributionMetadata(targetRelationId, ExclusiveLock); LockRelationOid(targetRelationId, ExclusiveLock);
/* we don't want source table to get dropped before we colocate with it */ /* we don't want source table to get dropped before we colocate with it */
LockRelationOid(sourceRelationId, AccessShareLock); LockRelationOid(sourceRelationId, AccessShareLock);
@ -369,8 +369,8 @@ CreateReferenceTableShard(Oid distributedTableId)
*/ */
EnsureTableOwner(distributedTableId); EnsureTableOwner(distributedTableId);
/* we plan to add shards: get an exclusive metadata lock */ /* we plan to add shards: get an exclusive lock on relation oid */
LockRelationDistributionMetadata(distributedTableId, ExclusiveLock); LockRelationOid(distributedTableId, ExclusiveLock);
relationOwner = TableOwner(distributedTableId); relationOwner = TableOwner(distributedTableId);

View File

@ -184,21 +184,6 @@ TryLockShardDistributionMetadata(int64 shardId, LOCKMODE lockMode)
} }
/*
* LockRelationDistributionMetadata returns after getting a the lock used for a
* relation's distribution metadata, blocking if required. Only ExclusiveLock
* and ShareLock modes are supported. Any locks acquired using this method are
* released at transaction end.
*/
void
LockRelationDistributionMetadata(Oid relationId, LOCKMODE lockMode)
{
Assert(lockMode == ExclusiveLock || lockMode == ShareLock);
(void) LockRelationOid(relationId, lockMode);
}
/* /*
* LockShardResource acquires a lock needed to modify data on a remote shard. * LockShardResource acquires a lock needed to modify data on a remote shard.
* This task may be assigned to multiple backends at the same time, so the lock * This task may be assigned to multiple backends at the same time, so the lock

View File

@ -66,7 +66,6 @@ typedef enum AdvisoryLocktagClass
/* Lock shard/relation metadata for safe modifications */ /* Lock shard/relation metadata for safe modifications */
extern void LockShardDistributionMetadata(int64 shardId, LOCKMODE lockMode); extern void LockShardDistributionMetadata(int64 shardId, LOCKMODE lockMode);
extern bool TryLockShardDistributionMetadata(int64 shardId, LOCKMODE lockMode); extern bool TryLockShardDistributionMetadata(int64 shardId, LOCKMODE lockMode);
extern void LockRelationDistributionMetadata(Oid relationId, LOCKMODE lockMode);
/* Lock shard data, for DML commands or remote fetches */ /* Lock shard data, for DML commands or remote fetches */
extern void LockShardResource(uint64 shardId, LOCKMODE lockmode); extern void LockShardResource(uint64 shardId, LOCKMODE lockmode);