diff options
Diffstat (limited to 'src/backend/bootstrap/bootparse.y')
-rw-r--r-- | src/backend/bootstrap/bootparse.y | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/src/backend/bootstrap/bootparse.y b/src/backend/bootstrap/bootparse.y index 867f77076d0..de3695c7e05 100644 --- a/src/backend/bootstrap/bootparse.y +++ b/src/backend/bootstrap/bootparse.y @@ -22,7 +22,6 @@ #include "access/htup.h" #include "access/itup.h" #include "access/tupdesc.h" -#include "access/xact.h" #include "bootstrap/bootstrap.h" #include "catalog/catalog.h" #include "catalog/heap.h" @@ -49,6 +48,7 @@ #include "storage/off.h" #include "storage/smgr.h" #include "tcop/dest.h" +#include "utils/memutils.h" #include "utils/rel.h" @@ -63,19 +63,27 @@ #define YYMALLOC palloc #define YYFREE pfree +static MemoryContext per_line_ctx = NULL; + static void do_start(void) { - StartTransactionCommand(); - elog(DEBUG4, "start transaction"); + Assert(CurrentMemoryContext == CurTransactionContext); + /* First time through, create the per-line working context */ + if (per_line_ctx == NULL) + per_line_ctx = AllocSetContextCreate(CurTransactionContext, + "bootstrap per-line processing", + ALLOCSET_DEFAULT_SIZES); + MemoryContextSwitchTo(per_line_ctx); } static void do_end(void) { - CommitTransactionCommand(); - elog(DEBUG4, "commit transaction"); + /* Reclaim memory allocated while processing this line */ + MemoryContextSwitchTo(CurTransactionContext); + MemoryContextReset(per_line_ctx); CHECK_FOR_INTERRUPTS(); /* allow SIGINT to kill bootstrap run */ if (isatty(0)) { |