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.
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)
{
* occurs.
*/
if (!wstate->index->rd_istemp)
+ {
+ RelationOpenSmgr(wstate->index);
smgrimmedsync(wstate->index->rd_smgr);
+ }
}