buffile.c resource owner breakage on segment extension

Поиск
Список
Период
Сортировка
От Andres Freund
Тема buffile.c resource owner breakage on segment extension
Дата
Msg-id 20131101183107.GA3567@awork2.anarazel.de
обсуждение исходный текст
Ответы Re: buffile.c resource owner breakage on segment extension  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
Hi,

The attached testcase demonstrates that it currently is possible that
buffile.c segments get created belonging to the wrong resource owner
leading to WARNINGs ala "temporary file leak: File %d still referenced",
ERRORs like "write failed", asserts and segfaults.

The problem is that while BufFileCreateTemp() callers like tuplestore
take care to use proper resource owners for it, they don't during
BufFileWrite()->BufFileDumpBuffer()->extendBufFile(). The last in that
chain creates a new tempfile which then gets owned by
CurrentResourceOwner. Which, like in the testcase, might a
subtransaction's one.

While not particularly nice, given the API, it seems best for buffile.c
to remember the resource owner used for the original segment and
temporarily set that during the extension.

Greetings,

Andres Freund

--
 Andres Freund                       http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training & Services

Вложения

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Hannu Krosing
Дата:
Сообщение: Re: Save Hash Indexes
Следующее
От: Andres Freund
Дата:
Сообщение: Re: missing RelationCloseSmgr in FreeFakeRelcacheEntry?