summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2006-01-07 22:45:53 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2006-01-07 22:45:53 +0000
commite1926aa91e316594926218187386da3077b8da88 (patch)
treefab49745ecab0a03ce4bc68099227515e068df1b /src
parentc66f4ec56982d530274df1671806ab0432fa53b3 (diff)
Add RelationOpenSmgr() calls to ensure rd_smgr is valid when we try to
use it. While it normally has been opened earlier during btree index build, testing shows that it's possible for the link to be closed again if an sinval reset occurs while the index is being built.
Diffstat (limited to 'src')
-rw-r--r--src/backend/access/nbtree/nbtsort.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/backend/access/nbtree/nbtsort.c b/src/backend/access/nbtree/nbtsort.c
index 8bfa8130a23..d18ecbce578 100644
--- a/src/backend/access/nbtree/nbtsort.c
+++ b/src/backend/access/nbtree/nbtsort.c
@@ -56,7 +56,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/access/nbtree/nbtsort.c,v 1.95.2.1 2005/11/22 18:23:04 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/access/nbtree/nbtsort.c,v 1.95.2.2 2006/01/07 22:45:53 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -271,6 +271,9 @@ _bt_blnewpage(uint32 level)
static void
_bt_blwritepage(BTWriteState *wstate, Page page, BlockNumber blkno)
{
+ /* Ensure rd_smgr is open (could have been closed by relcache flush!) */
+ RelationOpenSmgr(wstate->index);
+
/* XLOG stuff */
if (wstate->btws_use_wal)
{
@@ -818,5 +821,8 @@ _bt_load(BTWriteState *wstate, BTSpool *btspool, BTSpool *btspool2)
* occurs.
*/
if (!wstate->index->rd_istemp)
+ {
+ RelationOpenSmgr(wstate->index);
smgrimmedsync(wstate->index->rd_smgr);
+ }
}