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.
This commit is contained in:
Heikki Linnakangas 2008-06-11 08:40:32 +00:00
parent f35ed40410
commit b9d591d6b9

View File

@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/access/nbtree/nbtinsert.c,v 1.164 2008/01/01 19:45:46 momjian Exp $
* $PostgreSQL: pgsql/src/backend/access/nbtree/nbtinsert.c,v 1.164.2.1 2008/06/11 08:40:32 heikki Exp $
*
*-------------------------------------------------------------------------
*/
@ -744,7 +744,8 @@ _bt_insertonpg(Relation rel,
/* release buffers; send out relcache inval if metapage changed */
if (BufferIsValid(metabuf))
{
CacheInvalidateRelcache(rel);
if (!InRecovery)
CacheInvalidateRelcache(rel);
_bt_relbuf(rel, metabuf);
}
@ -1789,7 +1790,8 @@ _bt_newroot(Relation rel, Buffer lbuf, Buffer rbuf)
END_CRIT_SECTION();
/* send out relcache inval for metapage change */
CacheInvalidateRelcache(rel);
if (!InRecovery)
CacheInvalidateRelcache(rel);
/* done with metapage */
_bt_relbuf(rel, metabuf);