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

Commit04bcf9e

Browse files
committed
Adjust tuplestore.c not to allocate BufFiles in generation context
590b045 made it so tuplestore.c would store tuples inside ageneration.c memory context. After fixing a bug report in97651b0, itseems that it's probably best not to allocate BufFile relatedallocations in that context. Let's keep it just for tuple data.This adjusts the code to switch to the Tuplestorestate.context's parent,which is the MemoryContext that tuplestore_begin_common() was called in.It does not seem worth adding a new field in Tuplestorestate to storethis when we can access it by looking at the Tuplestorestate'scontext's parent.Discussion:https://postgr.es/m/CAApHDvqFt_CdJtSr+E9YLZb7jZAyRCy3hjQ+ktM+dcOFVq-xkg@mail.gmail.com
1 parent97651b0 commit04bcf9e

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

‎src/backend/utils/sort/tuplestore.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -799,6 +799,7 @@ tuplestore_puttuple_common(Tuplestorestate *state, void *tuple)
799799
TSReadPointer*readptr;
800800
inti;
801801
ResourceOwneroldowner;
802+
MemoryContextoldcxt;
802803

803804
state->tuples++;
804805

@@ -850,8 +851,17 @@ tuplestore_puttuple_common(Tuplestorestate *state, void *tuple)
850851
oldowner=CurrentResourceOwner;
851852
CurrentResourceOwner=state->resowner;
852853

854+
/*
855+
* We switch out of the state->context as this is a generation
856+
* context, which isn't ideal for allocations relating to the
857+
* BufFile.
858+
*/
859+
oldcxt=MemoryContextSwitchTo(state->context->parent);
860+
853861
state->myfile=BufFileCreateTemp(state->interXact);
854862

863+
MemoryContextSwitchTo(oldcxt);
864+
855865
CurrentResourceOwner=oldowner;
856866

857867
/*

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp