From: Heikki Linnakangas Date: Wed, 11 Jun 2008 08:42:35 +0000 (+0000) Subject: Fix bug in the WAL recovery code to finish an incomplete split. X-Git-Url: http://git.postgresql.org/gitweb/static/gitweb.js?a=commitdiff_plain;h=729ace84886d988b651231fedb0f800e695b4014;p=users%2Fbernd%2Fpostgres.git 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. --- diff --git a/src/backend/access/nbtree/nbtinsert.c b/src/backend/access/nbtree/nbtinsert.c index 7323746450..b06fc79014 100644 --- a/src/backend/access/nbtree/nbtinsert.c +++ b/src/backend/access/nbtree/nbtinsert.c @@ -690,7 +690,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); } @@ -1623,7 +1624,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);