aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Korotkov <akorotkov@postgresql.org>2024-10-24 14:34:16 +0300
committerAlexander Korotkov <akorotkov@postgresql.org>2024-10-24 14:34:16 +0300
commitc1500a1ba7e16ac9e98c6baf792f0be64a48e839 (patch)
tree82e95739b1eb530a3ade7b7b8479987418e9fc74
parent499edb09741b8fad2de038361fb342aae6e6007f (diff)
downloadpostgresql-c1500a1ba7e16ac9e98c6baf792f0be64a48e839.tar.gz
postgresql-c1500a1ba7e16ac9e98c6baf792f0be64a48e839.zip
Update header comment for lookup_type_cache()
Describe the way we handle concurrent invalidation messages. Discussion: https://postgr.es/m/CAPpHfdsQhwUrnB3of862j9RgHoJM--eRbifvBMvtQxpC57dxCA%40mail.gmail.com Reviewed-by: Andrei Lepikhov, Artur Zakirov, Pavel Borisov
-rw-r--r--src/backend/utils/cache/typcache.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/backend/utils/cache/typcache.c b/src/backend/utils/cache/typcache.c
index 2ec136b7d30..f142624ad2e 100644
--- a/src/backend/utils/cache/typcache.c
+++ b/src/backend/utils/cache/typcache.c
@@ -351,6 +351,15 @@ type_cache_syshash(const void *key, Size keysize)
* invalid. Note however that we may fail to find one or more of the
* values requested by 'flags'; the caller needs to check whether the fields
* are InvalidOid or not.
+ *
+ * Note that while filling TypeCacheEntry we might process concurrent
+ * invalidation messages, causing our not-yet-filled TypeCacheEntry to be
+ * invalidated. In this case, we typically only clear flags while values are
+ * still available for the caller. It's expected that the caller holds
+ * enough locks on type-depending objects that the values are still relevant.
+ * It's also important that the tupdesc is filled after all other
+ * TypeCacheEntry items for TYPTYPE_COMPOSITE. So, tupdesc can't get
+ * invalidated during the lookup_type_cache() call.
*/
TypeCacheEntry *
lookup_type_cache(Oid type_id, int flags)