mirror of https://github.com/citusdata/citus.git
Clear metadata OID cache prior to deadlock detection
parent
b936bde936
commit
7523753a73
|
@ -266,6 +266,15 @@ CitusMaintenanceDaemonMain(Datum main_arg)
|
|||
|
||||
CHECK_FOR_INTERRUPTS();
|
||||
|
||||
/*
|
||||
* XXX: We clear the metadata cache before every iteration because otherwise
|
||||
* it might contain stale OIDs. It appears that in some cases invalidation
|
||||
* messages for a DROP EXTENSION may arrive during deadlock detection and
|
||||
* 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.
|
||||
*/
|
||||
ClearMetadataOIDCache();
|
||||
|
||||
/*
|
||||
* Perform Work. If a specific task needs to be called sooner than
|
||||
* timeout indicates, it's ok to lower it to that value. Expensive
|
||||
|
|
|
@ -2694,11 +2694,21 @@ InvalidateDistRelationCacheCallback(Datum argument, Oid relationId)
|
|||
*/
|
||||
if (relationId != InvalidOid && relationId == MetadataCache.distPartitionRelationId)
|
||||
{
|
||||
memset(&MetadataCache, 0, sizeof(MetadataCache));
|
||||
ClearMetadataOIDCache();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* ClearMetadataOIDCache resets all the cached OIDs and the extensionLoaded flag.
|
||||
*/
|
||||
void
|
||||
ClearMetadataOIDCache(void)
|
||||
{
|
||||
memset(&MetadataCache, 0, sizeof(MetadataCache));
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* DistTableOidList iterates over the pg_dist_partition table and returns
|
||||
* a list that consists of the logicalrelids.
|
||||
|
|
|
@ -86,6 +86,7 @@ extern List * DistTableOidList(void);
|
|||
extern List * ShardPlacementList(uint64 shardId);
|
||||
extern void CitusInvalidateRelcacheByRelid(Oid relationId);
|
||||
extern void CitusInvalidateRelcacheByShardId(int64 shardId);
|
||||
extern void ClearMetadataOIDCache(void);
|
||||
|
||||
extern bool CitusHasBeenLoaded(void);
|
||||
extern bool CheckCitusVersion(int elevel);
|
||||
|
|
Loading…
Reference in New Issue