I wrote: > Ahh ... you know what, never mind about stack traces, let's just see if > the attached patch doesn't fix it.
On reflection, that patch would only fix the issue for pg_class, and that's not the only catalog that gets consulted during relcache reloads. I think we'd better do it as attached, instead. regards, tom lane
diff --git a/src/backend/utils/cache/relcache.c b/src/backend/utils/cache/relcache.c index 81cea8b..337300f 100644 *** a/src/backend/utils/cache/relcache.c --- b/src/backend/utils/cache/relcache.c *************** RelationCacheInvalidate(void) *** 2159,2164 **** --- 2159,2169 ---- List *rebuildList = NIL; ListCell *l; + /* + * Reload relation mapping data before starting to reconstruct cache. + */ + RelationMapInvalidateAll(); + /* Phase 1 */ hash_seq_init(&status, RelationIdCache); *************** RelationCacheInvalidate(void) *** 2184,2189 **** --- 2189,2204 ---- else { /* + * If it's a mapped relation, immediately update its rd_node in + * case its relfilenode changed. We must do this during phase 1 + * in case the relation is consulted during rebuild of other + * relcache entries in phase 2. It's safe since consulting the + * map doesn't involve any access to relcache entries. + */ + if (RelationIsMapped(relation)) + RelationInitPhysicalAddr(relation); + + /* * Add this entry to list of stuff to rebuild in second pass. * pg_class_oid_index goes on the front of rebuildFirstList, other * nailed indexes on the back, and everything else into *************** RelationCacheInvalidate(void) *** 2209,2219 **** */ smgrcloseall(); - /* - * Reload relation mapping data before starting to reconstruct cache. - */ - RelationMapInvalidateAll(); - /* Phase 2: rebuild the items found to need rebuild in phase 1 */ foreach(l, rebuildFirstList) { --- 2224,2229 ----
-- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers