diff --git a/src/backend/storage/smgr/smgr.c b/src/backend/storage/smgr/smgr.c index a5b18328b89..62226d5dca7 100644 --- a/src/backend/storage/smgr/smgr.c +++ b/src/backend/storage/smgr/smgr.c @@ -348,8 +348,6 @@ smgrdestroyall(void) /* * smgrreleaseall() -- Release resources used by all objects. - * - * This is called for PROCSIGNAL_BARRIER_SMGRRELEASE. */ void smgrreleaseall(void) diff --git a/src/backend/utils/cache/relcache.c b/src/backend/utils/cache/relcache.c index 7ad6a35a50e..2cd19d603fb 100644 --- a/src/backend/utils/cache/relcache.c +++ b/src/backend/utils/cache/relcache.c @@ -2985,9 +2985,6 @@ RelationCacheInvalidate(bool debug_discard) { relation = idhentry->reldesc; - /* Must close all smgr references to avoid leaving dangling ptrs */ - RelationCloseSmgr(relation); - /* * Ignore new relations; no other backend will manipulate them before * we commit. Likewise, before replacing a relation's relfilelocator, @@ -3039,11 +3036,10 @@ RelationCacheInvalidate(bool debug_discard) } /* - * Now zap any remaining smgr cache entries. This must happen before we - * start to rebuild entries, since that may involve catalog fetches which - * will re-open catalog files. + * We cannot destroy the SMgrRelations as there might still be references + * to them, but close the underlying file descriptors. */ - smgrdestroyall(); + smgrreleaseall(); /* Phase 2: rebuild the items found to need rebuild in phase 1 */ foreach(l, rebuildFirstList)