Commit 96675bff authored by Heikki Linnakangas's avatar Heikki Linnakangas

Fix bug in the WAL recovery code to finish an incomplete split.

CacheInvalidateRelcache() crashes if called in WAL recovery, because the
invalidation infrastructure hasn't been initialized yet.

Back-patch to 8.2, where the bug was introduced.
parent 109940c6
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/access/nbtree/nbtinsert.c,v 1.166 2008/05/12 00:00:45 alvherre Exp $ * $PostgreSQL: pgsql/src/backend/access/nbtree/nbtinsert.c,v 1.167 2008/06/11 08:38:56 heikki Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -747,7 +747,8 @@ _bt_insertonpg(Relation rel, ...@@ -747,7 +747,8 @@ _bt_insertonpg(Relation rel,
/* release buffers; send out relcache inval if metapage changed */ /* release buffers; send out relcache inval if metapage changed */
if (BufferIsValid(metabuf)) if (BufferIsValid(metabuf))
{ {
CacheInvalidateRelcache(rel); if (!InRecovery)
CacheInvalidateRelcache(rel);
_bt_relbuf(rel, metabuf); _bt_relbuf(rel, metabuf);
} }
...@@ -1792,7 +1793,8 @@ _bt_newroot(Relation rel, Buffer lbuf, Buffer rbuf) ...@@ -1792,7 +1793,8 @@ _bt_newroot(Relation rel, Buffer lbuf, Buffer rbuf)
END_CRIT_SECTION(); END_CRIT_SECTION();
/* send out relcache inval for metapage change */ /* send out relcache inval for metapage change */
CacheInvalidateRelcache(rel); if (!InRecovery)
CacheInvalidateRelcache(rel);
/* done with metapage */ /* done with metapage */
_bt_relbuf(rel, metabuf); _bt_relbuf(rel, metabuf);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment