When cache invalidations arrive while ri_LoadConstraintInfo() is busy
filling a new cache entry, InvalidateConstraintCacheCallBack() compares
the - not yet initialized - oidHashValue field with the to-be-invalidated
hash value. To fix, check whether the entry is already marked as invalid.
Andres Freund
hash_seq_init(&status, ri_constraint_cache);
while ((hentry = (RI_ConstraintInfo *) hash_seq_search(&status)) != NULL)
{
- if (hashvalue == 0 || hentry->oidHashValue == hashvalue)
+ if (hentry->valid &&
+ (hashvalue == 0 || hentry->oidHashValue == hashvalue))
hentry->valid = false;
}
}