diff options
Diffstat (limited to 'src/backend/access/transam/xlogutils.c')
-rw-r--r-- | src/backend/access/transam/xlogutils.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/backend/access/transam/xlogutils.c b/src/backend/access/transam/xlogutils.c index aa8667abd10..945f1f790d5 100644 --- a/src/backend/access/transam/xlogutils.c +++ b/src/backend/access/transam/xlogutils.c @@ -616,7 +616,11 @@ CreateFakeRelcacheEntry(RelFileLocator rlocator) rel->rd_lockInfo.lockRelId.dbId = rlocator.dbOid; rel->rd_lockInfo.lockRelId.relId = rlocator.relNumber; - rel->rd_smgr = NULL; + /* + * Set up a non-pinned SMgrRelation reference, so that we don't need to + * worry about unpinning it on error. + */ + rel->rd_smgr = smgropen(rlocator, InvalidBackendId); return rel; } @@ -627,9 +631,6 @@ CreateFakeRelcacheEntry(RelFileLocator rlocator) void FreeFakeRelcacheEntry(Relation fakerel) { - /* make sure the fakerel is not referenced by the SmgrRelation anymore */ - if (fakerel->rd_smgr != NULL) - smgrclearowner(&fakerel->rd_smgr, fakerel->rd_smgr); pfree(fakerel); } @@ -656,10 +657,10 @@ XLogDropDatabase(Oid dbid) /* * This is unnecessarily heavy-handed, as it will close SMgrRelation * objects for other databases as well. DROP DATABASE occurs seldom enough - * that it's not worth introducing a variant of smgrclose for just this - * purpose. XXX: Or should we rather leave the smgr entries dangling? + * that it's not worth introducing a variant of smgrdestroy for just this + * purpose. */ - smgrcloseall(); + smgrdestroyall(); forget_invalid_pages_db(dbid); } |