Merge pull request #1681 from citusdata/fix_metadata_cache

Invalidate worker and group ID cache in maintenance daemon
pull/1641/head^2
Marco Slot 2017-10-02 18:29:30 +02:00 committed by GitHub
commit 03bddcbfab
3 changed files with 8 additions and 5 deletions

View File

@ -281,7 +281,7 @@ CitusMaintenanceDaemonMain(Datum main_arg)
* this causes us to cache a stale pg_dist_node OID. We'd actually expect * this causes us to cache a stale pg_dist_node OID. We'd actually expect
* all invalidations to arrive after obtaining a lock in LockCitusExtension. * all invalidations to arrive after obtaining a lock in LockCitusExtension.
*/ */
ClearMetadataOIDCache(); InvalidateMetadataSystemCache();
/* /*
* Perform Work. If a specific task needs to be called sooner than * Perform Work. If a specific task needs to be called sooner than

View File

@ -2713,18 +2713,21 @@ InvalidateDistRelationCacheCallback(Datum argument, Oid relationId)
*/ */
if (relationId != InvalidOid && relationId == MetadataCache.distPartitionRelationId) if (relationId != InvalidOid && relationId == MetadataCache.distPartitionRelationId)
{ {
ClearMetadataOIDCache(); InvalidateMetadataSystemCache();
} }
} }
/* /*
* ClearMetadataOIDCache resets all the cached OIDs and the extensionLoaded flag. * InvalidateMetadataSystemCache resets all the cached OIDs and the extensionLoaded flag,
* and invalidates the worker node and local group ID caches.
*/ */
void void
ClearMetadataOIDCache(void) InvalidateMetadataSystemCache(void)
{ {
memset(&MetadataCache, 0, sizeof(MetadataCache)); memset(&MetadataCache, 0, sizeof(MetadataCache));
workerNodeHashValid = false;
LocalGroupId = -1;
} }

View File

@ -86,7 +86,7 @@ extern List * DistTableOidList(void);
extern List * ShardPlacementList(uint64 shardId); extern List * ShardPlacementList(uint64 shardId);
extern void CitusInvalidateRelcacheByRelid(Oid relationId); extern void CitusInvalidateRelcacheByRelid(Oid relationId);
extern void CitusInvalidateRelcacheByShardId(int64 shardId); extern void CitusInvalidateRelcacheByShardId(int64 shardId);
extern void ClearMetadataOIDCache(void); extern void InvalidateMetadataSystemCache(void);
extern bool CitusHasBeenLoaded(void); extern bool CitusHasBeenLoaded(void);
extern bool CheckCitusVersion(int elevel); extern bool CheckCitusVersion(int elevel);