From 52b056c30171f7a4d74ef2ee14c7aee58097b046 Mon Sep 17 00:00:00 2001 From: Burak Yucesoy Date: Tue, 23 May 2017 19:03:48 +0300 Subject: [PATCH] Register cache invalidation callback before version checks With this commit we start to register InvalidateDistRelationCacheCallback function as cache invalidation callback function before version checks because during version checks we use cache to look up relation ids of some relations like pg_dist_relation or pg_dist_partition_logical_relid_index and we want to know about cache invalidation before accessing them. --- src/backend/distributed/utils/metadata_cache.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/backend/distributed/utils/metadata_cache.c b/src/backend/distributed/utils/metadata_cache.c index 12dad443c..5f4f14f97 100644 --- a/src/backend/distributed/utils/metadata_cache.c +++ b/src/backend/distributed/utils/metadata_cache.c @@ -511,6 +511,11 @@ LookupDistTableCacheEntry(Oid relationId) return NULL; } + if (DistTableCacheHash == NULL) + { + InitializeDistTableCache(); + } + /* * If the version is not known to be compatible, perform thorough check, * unless such checks are disabled. @@ -538,11 +543,6 @@ LookupDistTableCacheEntry(Oid relationId) } } - if (DistTableCacheHash == NULL) - { - InitializeDistTableCache(); - } - cacheEntry = hash_search(DistTableCacheHash, hashKey, HASH_ENTER, &foundInCache); /* return valid matches */