Re: Should we add xid_current() or a int8->xid cast?

From: btfujiitkp <btfujiitkp(at)oss(dot)nttdata(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Cc: andres(at)anarazel(dot)de, tgl(at)sss(dot)pgh(dot)pa(dot)us, thomas(dot)munro(at)gmail(dot)com
Subject: Re: Should we add xid_current() or a int8->xid cast?
Date: 2019-10-29 04:23:07
Message-ID: 75c80ef909d58399d93b941b02d58173@oss.nttdata.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

>
> Thomas Munro <thomas(dot)munro(at)gmail(dot)com> writes:
>> On Sun, Sep 1, 2019 at 5:04 PM Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
>> wrote:
>>> Adding to CF.
>
>> Rebased. An OID clashed so re-roll the dice. Also spotted a typo.
>

I have some questions in this code.

First,
"FullTransactionIdPrecedes(xmax, val)" is not equal to "val >= xmax" of
the previous code. "FullTransactionIdPrecedes(xmax, val)" expresses
"val > xmax". Is it all right?

@@ -384,15 +324,17 @@ parse_snapshot(const char *str)
while (*str != '\0')
{
/* read next value */
- val = str2txid(str, &endp);
+ val = FullTransactionIdFromU64(pg_strtouint64(str, &endp, 10));
str = endp;

/* require the input to be in order */
- if (val < xmin || val >= xmax || val < last_val)
+ if (FullTransactionIdPrecedes(val, xmin) ||
+ FullTransactionIdPrecedes(xmax, val) ||
+ FullTransactionIdPrecedes(val, last_val))

In addition to it, as to current TransactionId(not FullTransactionId)
comparison, when we express ">=" of TransactionId, we use
"TransactionIdFollowsOrEquals". this method is referred by some methods.
On the other hand, FullTransactionIdFollowsOrEquals has not implemented
yet. So, how about implementing this method?

Second,
About naming rule, "8" of xid8 means 8 bytes, but "8" has different
meaning in each situation. For example, int8 of PostgreSQL means 8
bytes, int8 of C language means 8 bits. If 64 is used, it just means 64
bits. how about xid64()?

regards,

Takao Fujii

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Langote 2019-10-29 04:23:15 Re: [PATCH] Do not use StdRdOptions in Access Methods
Previous Message Michael Paquier 2019-10-29 04:16:58 Re: [BUG] Partition creation fails after dropping a column and adding a partial index