Re: tuplesort Generation memory contexts don't play nicely with index builds

From: David Rowley <dgrowleyml(at)gmail(dot)com>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Robert Haas <robertmhaas(at)gmail(dot)com>
Subject: Re: tuplesort Generation memory contexts don't play nicely with index builds
Date: 2022-07-06 01:34:37
Message-ID: CAApHDvrNXuE3egg3pVCsepNj_Y8eBhwFdFwxc=H=xc-aG7jSXg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, 29 Jun 2022 at 12:59, David Rowley <dgrowleyml(at)gmail(dot)com> wrote:
> I noticed while doing some memory context related work that since we
> now use generation.c memory contexts for tuplesorts (40af10b57) that
> tuplesort_putindextuplevalues() causes memory "leaks" in the
> generation context due to index_form_tuple() being called while we're
> switched into the state->tuplecontext.

I voiced my dislike for the patch I came up with to fix this issue to
Andres. He suggested that I just add a version of index_form_tuple
that can be given a MemoryContext pointer to allocate the returned
tuple into.

I like that idea much better, so I've attached a patch to fix it that way.

If there are no objections, I plan to push this in the next 24 hours.

David

Attachment Content-Type Size
add_index_form_tuple_context_function.patch text/plain 3.5 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2022-07-06 01:48:20 Re: Issue with pg_stat_subscription_stats
Previous Message Masahiko Sawada 2022-07-06 01:25:02 Re: Issue with pg_stat_subscription_stats