Re: some pointless HeapTupleHeaderIndicatesMovedPartitions calls

From: Álvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: Anastasia Lubennikova <a(dot)lubennikova(at)postgrespro(dot)ru>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: some pointless HeapTupleHeaderIndicatesMovedPartitions calls
Date: 2021-02-22 20:15:57
Message-ID: 20210222201557.GA32655@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2021-Feb-21, Michael Paquier wrote:

> On Sat, Feb 20, 2021 at 12:25:58PM -0300, Álvaro Herrera wrote:

> > Hmm. Alternatively, maybe it'd make sense to change
> > HeapTupleHeaderSetMovedPartition to use ItemPointerSetMovedPartitions
> > instead of doing ItemPointerSet directly. But that looks mostly
> > pointless, since the extensibility aspect of this interface has been
> > superseded by table AM work. I agree we should just remove the macro
> > and update the comment as you suggest.
>
> Thanks. So you will do this change in the same commit, right?

I changed my mind on this after noticing that
ItemPointerIndicatesMovedPartitions has a few callers; leaving the
interface incomplete/asymmetric would be worse. So I propose to do
this.

diff --git a/src/include/access/htup_details.h b/src/include/access/htup_details.h
index 7c62852e7f..86b3622b5e 100644
--- a/src/include/access/htup_details.h
+++ b/src/include/access/htup_details.h
@@ -443,11 +443,10 @@ do { \
)

#define HeapTupleHeaderIndicatesMovedPartitions(tup) \
- (ItemPointerGetOffsetNumber(&(tup)->t_ctid) == MovedPartitionsOffsetNumber && \
- ItemPointerGetBlockNumberNoCheck(&(tup)->t_ctid) == MovedPartitionsBlockNumber)
+ ItemPointerIndicatesMovedPartitions(&(tup)->t_ctid)

#define HeapTupleHeaderSetMovedPartitions(tup) \
- ItemPointerSet(&(tup)->t_ctid, MovedPartitionsBlockNumber, MovedPartitionsOffsetNumber)
+ ItemPointerSetMovedPartitions(&(tup)->t_ctid)

#define HeapTupleHeaderGetDatumLength(tup) \
VARSIZE(tup)

--
Álvaro Herrera Valdivia, Chile
"¿Cómo puedes confiar en algo que pagas y que no ves,
y no confiar en algo que te dan y te lo muestran?" (Germán Poo)

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message John Naylor 2021-02-22 20:16:08 Re: WIP: BRIN multi-range indexes
Previous Message Robert Haas 2021-02-22 19:48:25 Re: libpq compression