pgsql: Code review for tqueue.c: fix memory leaks, speed it up, other f

Поиск
Список
Период
Сортировка
От Tom Lane
Тема pgsql: Code review for tqueue.c: fix memory leaks, speed it up, other f
Дата
Msg-id E1bTwzM-0006dx-BQ@gemulon.postgresql.org
обсуждение исходный текст
Список pgsql-committers
Code review for tqueue.c: fix memory leaks, speed it up, other fixes.

When doing record typmod remapping, tqueue.c did fresh catalog lookups
for each tuple it processed, which was pretty horrible performance-wise
(it seemed to about halve the already none-too-quick speed of bulk reads
in parallel mode).  Worse, it insisted on putting bits of that data into
TopMemoryContext, from where it never freed them, causing a
session-lifespan memory leak.  (I suppose this was coded with the idea
that the sender process would quit after finishing the query ---
but the receiver uses the same code.)

Restructure to avoid repetitive catalog lookups and to keep that data
in a query-lifespan context, in or below the context where the
TQueueDestReceiver or TupleQueueReader itself lives.

Fix some other bugs such as continuing to use a tupledesc after
releasing our refcount on it.  Clean up cavalier datatype choices
(typmods are int32, please, not int, and certainly not Oid).  Improve
comments and error message wording.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/a9ed875fdc2c44b5793a07727274786b417fc924

Modified Files
--------------
src/backend/executor/tqueue.c | 1142 +++++++++++++++++++++++++----------------
1 file changed, 695 insertions(+), 447 deletions(-)


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

Предыдущее
От: Stephen Frost
Дата:
Сообщение: pgsql: Correctly handle owned sequences with extensions
Следующее
От: Tom Lane
Дата:
Сообщение: pgsql: Doc: remove claim that hash index creation depends on effective_