From 0ce4d56924982c04da226bc890033e377d1ef375 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Mon, 10 Jan 2005 20:02:24 +0000 Subject: Phase 1 of fix for 'SMgrRelation hashtable corrupted' problem. This is the minimum required fix. I want to look next at taking advantage of it by simplifying the message semantics in the shared inval message queue, but that part can be held over for 8.1 if it turns out too ugly. --- src/backend/access/transam/xlogutils.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'src/backend/access/transam/xlogutils.c') diff --git a/src/backend/access/transam/xlogutils.c b/src/backend/access/transam/xlogutils.c index 08583d3d6e0..251098d4083 100644 --- a/src/backend/access/transam/xlogutils.c +++ b/src/backend/access/transam/xlogutils.c @@ -11,7 +11,7 @@ * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/backend/access/transam/xlogutils.c,v 1.35 2004/12/31 21:59:30 pgsql Exp $ + * $PostgreSQL: pgsql/src/backend/access/transam/xlogutils.c,v 1.36 2005/01/10 20:02:19 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -125,8 +125,7 @@ _xl_remove_hash_entry(XLogRelDesc *rdesc) if (hentry == NULL) elog(PANIC, "_xl_remove_hash_entry: file was not found in cache"); - if (rdesc->reldata.rd_smgr != NULL) - smgrclose(rdesc->reldata.rd_smgr); + RelationCloseSmgr(&(rdesc->reldata)); memset(rdesc, 0, sizeof(XLogRelDesc)); memset(tpgc, 0, sizeof(FormData_pg_class)); @@ -233,7 +232,8 @@ XLogOpenRelation(bool redo, RmgrId rmid, RelFileNode rnode) hentry->rdesc = res; res->reldata.rd_targblock = InvalidBlockNumber; - res->reldata.rd_smgr = smgropen(res->reldata.rd_node); + res->reldata.rd_smgr = NULL; + RelationOpenSmgr(&(res->reldata)); /* * Create the target file if it doesn't already exist. This lets @@ -278,7 +278,5 @@ XLogCloseRelation(RelFileNode rnode) rdesc = hentry->rdesc; - if (rdesc->reldata.rd_smgr != NULL) - smgrclose(rdesc->reldata.rd_smgr); - rdesc->reldata.rd_smgr = NULL; + RelationCloseSmgr(&(rdesc->reldata)); } -- cgit v1.2.3