From: Heikki Linnakangas Date: Fri, 2 Mar 2012 11:16:09 +0000 (+0200) Subject: When a GiST page is split during index build, it might not have a buffer. X-Git-Tag: REL9_2_BETA1~345 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2502f45979fca76a6b19a07c98d7a41737a3dc7b;p=postgresql When a GiST page is split during index build, it might not have a buffer. Previously it was thought that it's impossible as the code stands, because insertions create buffers as tuples are cascaded downwards, and index split also creaters buffers eagerly for all halves. But the example from Jay Levitt demonstrates that it can happen, when the root page is split. It's in fact OK if the buffer doesn't exist, so we just need to remove the sanity check. In fact, we've been discussing the possibility of destroying empty buffers to conserve memory, which would render the sanity check completely useless anyway. Fix by Alexander Korotkov --- diff --git a/src/backend/access/gist/gistbuildbuffers.c b/src/backend/access/gist/gistbuildbuffers.c index 2a5f7b3422..34a12bc79c 100644 --- a/src/backend/access/gist/gistbuildbuffers.c +++ b/src/backend/access/gist/gistbuildbuffers.c @@ -606,12 +606,8 @@ gistRelocateBuildBuffersOnSplit(GISTBuildBuffers *gfbb, GISTSTATE *giststate, HASH_FIND, &found); if (!found) { - /* - * Node buffer should exist at this point. If it didn't exist before, - * the insertion that caused the page to split should've created it. - */ - elog(ERROR, "node buffer of page being split (%u) does not exist", - blocknum); + /* The page has no buffer, so we have nothing to do. */ + return; } /*