From: | Pavel Borisov <pashkin(dot)elfe(at)gmail(dot)com> |
---|---|
To: | Japin Li <japinli(at)hotmail(dot)com> |
Cc: | PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Re: Fix parameters order for relation_copy_for_cluster |
Date: | 2024-04-01 11:13:05 |
Message-ID: | CALT9ZEGPcVjZNAii7QVuE_yZsADFLXPzvtZj-CTLiOdi2u-CHg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi, Japin!
On Mon, 1 Apr 2024 at 12:15, Japin Li <japinli(at)hotmail(dot)com> wrote:
>
> Hi,
>
> When attempting to implement a new table access method, I discovered that
> relation_copy_for_cluster() has the following declaration:
>
>
> void (*relation_copy_for_cluster) (Relation NewTable,
> Relation OldTable,
> Relation OldIndex,
> bool use_sort,
> TransactionId OldestXmin,
> TransactionId *xid_cutoff,
> MultiXactId *multi_cutoff,
> double *num_tuples,
> double *tups_vacuumed,
> double *tups_recently_dead);
>
> It claims that the first parameter is a new table, and the second one is an
> old table. However, the table_relation_copy_for_cluster() uses the first
> parameter as the old table, and the second as a new table, see below:
>
> static inline void
> table_relation_copy_for_cluster(Relation OldTable, Relation NewTable,
> Relation OldIndex,
> bool use_sort,
> TransactionId OldestXmin,
> TransactionId *xid_cutoff,
> MultiXactId *multi_cutoff,
> double *num_tuples,
> double *tups_vacuumed,
> double *tups_recently_dead)
> {
> OldTable->rd_tableam->relation_copy_for_cluster(OldTable, NewTable,
> OldIndex,
> use_sort, OldestXmin,
> xid_cutoff,
> multi_cutoff,
> num_tuples,
> tups_vacuumed,
> tups_recently_dead);
> }
>
> It's a bit confusing, so attach a patch to fix this.
>
I've looked into your patch. All callers of *_relation_copy_for_cluster
now use Relation OldTable, Relation NewTable order. It coincides to what is
expected by the function, no now code is not broken. The only wrong thing
is naming of arguments in declaration of this function in tableam.h I think
this is a minor oversight from original commit d25f519107b
Provided all the above I'd recommend committing this catch. This is for
clarity only, no changes in code behavior.
Thank you for finding this!
Best regards,
Pavel Borisov
Supabase
From | Date | Subject | |
---|---|---|---|
Next Message | Ashutosh Bapat | 2024-04-01 11:26:39 | Re: Statistics Import and Export |
Previous Message | Alvaro Herrera | 2024-04-01 11:06:12 | Re: Popcount optimization using AVX512 |