From ed7cc8f460e91931d082af7785b8c228457b813e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emel=20=C5=9Eim=C5=9Fek?= Date: Mon, 6 Mar 2023 13:59:45 +0300 Subject: [PATCH] Remove unused lock functions (#6747) Code cleanup. This change removes two unused functions seemingly left over after a previous refactoring of shard move code. --- src/backend/distributed/utils/resource_lock.c | 39 ------------------- src/include/distributed/resource_lock.h | 5 +-- 2 files changed, 1 insertion(+), 43 deletions(-) diff --git a/src/backend/distributed/utils/resource_lock.c b/src/backend/distributed/utils/resource_lock.c index cc4cb0d88..7b8edf758 100644 --- a/src/backend/distributed/utils/resource_lock.c +++ b/src/backend/distributed/utils/resource_lock.c @@ -503,45 +503,6 @@ SetLocktagForShardDistributionMetadata(int64 shardId, LOCKTAG *tag) } -/* - * LockPlacementCleanup takes an exclusive lock to ensure that only one process - * can cleanup placements at the same time. - */ -void -LockPlacementCleanup(void) -{ - LOCKTAG tag; - const bool sessionLock = false; - const bool dontWait = false; - - /* Moves acquire lock with a constant operation id CITUS_SHARD_MOVE. - * This will change as we add support for parallel moves. - */ - SET_LOCKTAG_CITUS_OPERATION(tag, CITUS_SHARD_MOVE); - (void) LockAcquire(&tag, ExclusiveLock, sessionLock, dontWait); -} - - -/* - * TryLockPlacementCleanup takes an exclusive lock to ensure that only one - * process can cleanup placements at the same time. - */ -bool -TryLockPlacementCleanup(void) -{ - LOCKTAG tag; - const bool sessionLock = false; - const bool dontWait = true; - - /* Moves acquire lock with a constant operation id CITUS_SHARD_MOVE. - * This will change as we add support for parallel moves. - */ - SET_LOCKTAG_CITUS_OPERATION(tag, CITUS_SHARD_MOVE); - bool lockAcquired = LockAcquire(&tag, ExclusiveLock, sessionLock, dontWait); - return lockAcquired; -} - - /* * LockReferencedReferenceShardDistributionMetadata acquires shard distribution * metadata locks with the given lock mode on the reference tables which has a diff --git a/src/include/distributed/resource_lock.h b/src/include/distributed/resource_lock.h index 9e143e467..9efa1b767 100644 --- a/src/include/distributed/resource_lock.h +++ b/src/include/distributed/resource_lock.h @@ -53,8 +53,7 @@ typedef enum CitusOperations CITUS_NONBLOCKING_SPLIT = 1, CITUS_CREATE_DISTRIBUTED_TABLE_CONCURRENTLY = 2, CITUS_CREATE_COLOCATION_DEFAULT = 3, - CITUS_SHARD_MOVE = 4, - CITUS_BACKGROUND_TASK_MONITOR = 5 + CITUS_BACKGROUND_TASK_MONITOR = 4 } CitusOperations; /* reuse advisory lock, but with different, unused field 4 (4)*/ @@ -165,8 +164,6 @@ enum DistLockConfigs /* Lock shard/relation metadata for safe modifications */ extern void LockShardDistributionMetadata(int64 shardId, LOCKMODE lockMode); -extern void LockPlacementCleanup(void); -extern bool TryLockPlacementCleanup(void); extern void EnsureShardOwner(uint64 shardId, bool missingOk); extern void LockShardListMetadataOnWorkers(LOCKMODE lockmode, List *shardIntervalList); extern void BlockWritesToShardList(List *shardList);