diff --git a/src/backend/distributed/metadata/metadata_cache.c b/src/backend/distributed/metadata/metadata_cache.c index 92a672fa976..fe35b981958 100644 --- a/src/backend/distributed/metadata/metadata_cache.c +++ b/src/backend/distributed/metadata/metadata_cache.c @@ -2192,19 +2192,22 @@ CitusHasBeenLoaded(void) */ Assert(!(MetadataCache.extensionLoaded && MetadataCache.extensionNotLoaded)); + + if (creating_extension) + { + Oid citusExtensionOid = get_extension_oid("citus", true); + + if (CurrentExtensionObject == citusExtensionOid) + { + return false; + } + } + /* * MetadataCache.extensionLoaded = false * MetadataCache.extensionNotLoaded = false * means that the cache is invalid. Reevaluate the flags. */ - - Oid citusExtensionOid = get_extension_oid("citus", true); - - if (creating_extension && (CurrentExtensionObject == citusExtensionOid)) - { - return false; - } - if (!MetadataCache.extensionLoaded && !MetadataCache.extensionNotLoaded) { /* @@ -4774,22 +4777,6 @@ InvalidateDistRelationCacheCallback(Datum argument, Oid relationId) InvalidateCitusTableCacheEntrySlot(cacheSlot); } - /* - * If pg_dist_partition is being invalidated drop all state - * This happens pretty rarely, but most importantly happens during - * DROP EXTENSION citus; This isn't the only time when this happens - * though, it can happen for multiple other reasons, such as an - * autovacuum running ANALYZE on pg_dist_partition. Such an ANALYZE - * wouldn't really need a full Metadata cache invalidation, but we - * don't know how to differentiate between DROP EXTENSION and ANALYZE. - * So for now we simply drop it in both cases and take the slight - * temporary performance hit. - */ - if (relationId == MetadataCache.distPartitionRelationId) - { - InvalidateMetadataSystemCache(); - } - if (relationId == MetadataCache.distObjectRelationId) { InvalidateDistObjectCache();