Re: BeginCopyTo - remove switching to old memory context in between COPY TO command processing

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: BeginCopyTo - remove switching to old memory context in between COPY TO command processing
Date: 2022-01-28 11:23:57
Message-ID: YfPSTZy4HnrMrYBm@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Jan 28, 2022 at 03:41:11PM +0530, Bharath Rupireddy wrote:
> While reviewing patch at [1], it has been found that the memory
> context switch to oldcontext from cstate->copycontext in between
> BeginCopyTo is not correct because the intention of the copycontext is
> to use it through the copy command processing. It looks like a thinko
> from the commit c532d1 [2]. Attaching a small patch to remove this.
>
> Thoughts?

I think that you are right. Before c532d15d, BeginCopy() was
internally doing one switch with copycontext and the current memory
context. This commit has just moved the internals of BeginCopy()
into BeginCopyTo(), so this looks like a copy-paste error to me. I'll
go fix it, thanks for the report!
-
Michael

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Fabrice Chapuis 2022-01-28 11:35:30 Re: Logical replication timeout problem
Previous Message Japin Li 2022-01-28 11:01:20 Re: BeginCopyTo - remove switching to old memory context in between COPY TO command processing