Re: Unnecessary smgropen in {heapam_relation,index}_copy_data?

From: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
To: Japin Li <japinli(at)hotmail(dot)com>, Aleksander Alekseev <aleksander(at)timescale(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Unnecessary smgropen in {heapam_relation,index}_copy_data?
Date: 2024-02-12 09:13:26
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On 25/01/2024 17:22, Japin Li wrote:
> On Thu, 25 Jan 2024 at 21:43, Aleksander Alekseev <aleksander(at)timescale(dot)com> wrote:
>>> I find heapam_relation_copy_data() and index_copy_data() have the following code:
>>> dstrel = smgropen(*newrlocator, rel->rd_backend);
>>> ...
>>> RelationCreateStorage(*newrlocator, rel->rd_rel->relpersistence, true);
>>> The smgropen() is also called by RelationCreateStorage(), why should we call
>>> smgropen() explicitly here?
>>> I try to remove the smgropen(), and all tests passed.
>> That's a very good question. Note that the second argument of
>> smgropen() used to create dstrel changes after applying your patch.
>> I'm not 100% sure whether this is significant or not.
> Thanks for the review.
> According the comments of RelationData->rd_backend, it is the backend id, if
> the relation is temporary. The differnece is RelationCreateStorage() uses
> relpersistence to determinate the backend id.

Committed, thanks!

Heikki Linnakangas
Neon (

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2024-02-12 09:40:12 Re: Synchronizing slots from primary to standby
Previous Message vignesh C 2024-02-12 09:03:59 Re: Documentation to upgrade logical replication cluster