From: Heikki Linnakangas Date: Wed, 11 Jun 2008 08:40:32 +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=dc724021c392e4bcf0e9d22579c6f80666cd0c91;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 7fb395fc5c..324599716a 100644 --- a/src/backend/access/nbtree/nbtinsert.c +++ b/src/backend/access/nbtree/nbtinsert.c @@ -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);