From 2595b4864b96eb6b187467f73c72b5f3c146eb37 Mon Sep 17 00:00:00 2001 From: Hanefi Onaldi Date: Mon, 9 Mar 2020 13:35:18 +0300 Subject: [PATCH] Remove all GetWorkerNodeCount() references As @onderkalaci suggested removing the definition of GetWorkerNodeCount() that can potentially cause misunderstandings. I can advise using ActiveReadableWorkerNodeCount() that returns the number of active primaries is a safer alternative than GetWorkerNodeCount() that returns the total number of workers containing inactives, primaries, and unavailable nodes. I introduced a bug #3556 and in the bugfix #3564 removed the single usage of said function --- src/backend/distributed/metadata/metadata_cache.c | 14 -------------- src/include/distributed/metadata_cache.h | 1 - 2 files changed, 15 deletions(-) diff --git a/src/backend/distributed/metadata/metadata_cache.c b/src/backend/distributed/metadata/metadata_cache.c index b1c80a1e2..ffbc7a0ab 100644 --- a/src/backend/distributed/metadata/metadata_cache.c +++ b/src/backend/distributed/metadata/metadata_cache.c @@ -2978,20 +2978,6 @@ GetWorkerNodeHash(void) } -/* - * GetWorkerNodeCount returns the number of worker nodes - * - * If the Worker Node cache is not (yet) valid, it is first rebuilt. - */ -int -GetWorkerNodeCount(void) -{ - PrepareWorkerNodeCache(); - - return WorkerNodeCount; -} - - /* * PrepareWorkerNodeCache makes sure the worker node data from pg_dist_node is cached, * if it is not already cached. diff --git a/src/include/distributed/metadata_cache.h b/src/include/distributed/metadata_cache.h index 4aa5e99fd..ec2475c2b 100644 --- a/src/include/distributed/metadata_cache.h +++ b/src/include/distributed/metadata_cache.h @@ -158,7 +158,6 @@ extern char LookupDistributionMethod(Oid distributionMethodOid); /* access WorkerNodeHash */ extern HTAB * GetWorkerNodeHash(void); -extern int GetWorkerNodeCount(void); extern WorkerNode * LookupNodeByNodeId(uint32 nodeId); extern WorkerNode * ForceLookupNodeByNodeId(uint32 nodeId); extern WorkerNode * LookupNodeForGroup(int32 groupId);