Delete the temporary file used in buffered GiST build, after the build.
authorHeikki Linnakangas
Wed, 30 May 2012 08:58:54 +0000 (11:58 +0300)
committerHeikki Linnakangas
Wed, 30 May 2012 09:05:57 +0000 (12:05 +0300)
There were two bugs here: We forgot to call gistFreeBuildBuffers() function
at the end of build, and we passed interXact == true to BufFileCreateTemp,
so the file wasn't automatically cleaned up at end-of-transaction either.

src/backend/access/gist/gistbuild.c
src/backend/access/gist/gistbuildbuffers.c

index eb39c667c15f51c5ebe276ff0476b00dea9af813..73cdc5f5b477c4ffd09cf343db31eee3589f5f4f 100644 (file)
@@ -214,6 +214,7 @@ gistbuild(PG_FUNCTION_ARGS)
    {
        elog(DEBUG1, "all tuples processed, emptying buffers");
        gistEmptyAllBuffers(&buildstate);
+       gistFreeBuildBuffers(buildstate.gfbb);
    }
 
    /* okay, all heap tuples are indexed */
index a40b83857c139f1a5f0a5c4705863cc31def44d8..f108e65695ec96d0fc6deeb3801f2134174f9abb 100644 (file)
@@ -58,7 +58,7 @@ gistInitBuildBuffers(int pagesPerBuffer, int levelStep, int maxLevel)
     * Create a temporary file to hold buffer pages that are swapped out of
     * memory.
     */
-   gfbb->pfile = BufFileCreateTemp(true);
+   gfbb->pfile = BufFileCreateTemp(false);
    gfbb->nFileBlocks = 0;
 
    /* Initialize free page management. */