Move memory management away from writetup() and tuplesort_put*()
authorAlexander Korotkov <akorotkov@postgresql.org>
Wed, 27 Jul 2022 05:27:58 +0000 (08:27 +0300)
committerAlexander Korotkov <akorotkov@postgresql.org>
Wed, 27 Jul 2022 05:27:58 +0000 (08:27 +0300)
commit097366c45f5dfe142eb232dc6d348ca0705a63a9
tree7c750e7815354bb51a5cf4cf2c71b7fb03eb1322
parent033dd02db2248ed792332b950431ced4771b8304
Move memory management away from writetup() and tuplesort_put*()

This commit puts some generic work away from sort-variant-specific function.
In particular, tuplesort_put*() now doesn't need to decrease available memory
and switch to sort context before calling puttuple_common().  writetup()
doesn't need to free SortTuple.tuple and increase available memory.

Discussion: https://postgr.es/m/CAPpHfdvjix0Ahx-H3Jp1M2R%2B_74P-zKnGGygx4OWr%3DbUQ8BNdw%40mail.gmail.com
Author: Alexander Korotkov
Reviewed-by: Pavel Borisov, Maxim Orlov, Matthias van de Meent
Reviewed-by: Andres Freund, John Naylor
src/backend/utils/sort/tuplesort.c