Fix logic for when entire cache is invalidated

Sometimes postgres wants to invalidate the entire cache. In this case it
send a cache invalidation message with relid == InvalidOid. This should
invalidate all the caches. Previously, it did not effect the cache of
the extension state. This fixes that problem and creates one cache reset
code path for both extension dropping and whole-cache reset, cleaning
up some of the logic in the process.
This commit is contained in:
Matvey Arye 2017-03-31 07:41:34 -04:00
parent d1dd911a62
commit e87bc774d7

View File

@ -49,21 +49,21 @@ inval_cache_callback(Datum arg, Oid relid)
if (!extension_is_loaded())
return;
if (extension_is_being_dropped(relid))
if (!OidIsValid(relid) || extension_is_being_dropped(relid))
{
/* Extension was dropped. Reset state. */
/* Extension was dropped or entire cache invalidated. Reset state. */
hypertable_cache_invalidate_callback();
chunk_cache_invalidate_callback();
extension_reset();
return;
}
if (!OidIsValid(relid) || relid == catalog_get_cache_proxy_id(catalog, CACHE_TYPE_HYPERTABLE))
if (relid == catalog_get_cache_proxy_id(catalog, CACHE_TYPE_HYPERTABLE))
{
hypertable_cache_invalidate_callback();
}
if (!OidIsValid(relid) || relid == catalog_get_cache_proxy_id(catalog, CACHE_TYPE_CHUNK))
if (relid == catalog_get_cache_proxy_id(catalog, CACHE_TYPE_CHUNK))
chunk_cache_invalidate_callback();
}