Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit1601830

Browse files
committed
Make ginbuild's funcCtx be independent of its tmpCtx.
Previously the funcCtx was a child of the tmpCtx, but that was brokenby commiteaa5808, which madeMemoryContextReset() delete, not reset, child contexts. The behavior ofhaving a tmpCtx reset also clear the other context seems rather dubiousanyway, so let's just disentangle them. Per report from Erik Rijkers.In passing, fix badly-inaccurate comments about these contexts.
1 parent9a8e233 commit1601830

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

‎src/backend/access/gin/gininsert.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -370,16 +370,20 @@ ginbuild(PG_FUNCTION_ARGS)
370370
buildstate.buildStats.nEntryPages++;
371371

372372
/*
373-
* create a temporary memory context that isreset once for each tuple
374-
*inserted into the index
373+
* create a temporary memory context that isused to hold data not yet
374+
*dumped out to the index
375375
*/
376376
buildstate.tmpCtx=AllocSetContextCreate(CurrentMemoryContext,
377377
"Gin build temporary context",
378378
ALLOCSET_DEFAULT_MINSIZE,
379379
ALLOCSET_DEFAULT_INITSIZE,
380380
ALLOCSET_DEFAULT_MAXSIZE);
381381

382-
buildstate.funcCtx=AllocSetContextCreate(buildstate.tmpCtx,
382+
/*
383+
* create a temporary memory context that is used for calling
384+
* ginExtractEntries(), and can be reset after each tuple
385+
*/
386+
buildstate.funcCtx=AllocSetContextCreate(CurrentMemoryContext,
383387
"Gin build temporary context for user-defined function",
384388
ALLOCSET_DEFAULT_MINSIZE,
385389
ALLOCSET_DEFAULT_INITSIZE,
@@ -408,6 +412,7 @@ ginbuild(PG_FUNCTION_ARGS)
408412
}
409413
MemoryContextSwitchTo(oldCtx);
410414

415+
MemoryContextDelete(buildstate.funcCtx);
411416
MemoryContextDelete(buildstate.tmpCtx);
412417

413418
/*

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp