Re: Add 64-bit XIDs into PostgreSQL 15

From: Maxim Orlov <orlovmg(at)gmail(dot)com>
To: Dilip Kumar <dilipbalaut(at)gmail(dot)com>
Cc: Pavel Borisov <pashkin(dot)elfe(at)gmail(dot)com>, Aleksander Alekseev <aleksander(at)timescale(dot)com>, Postgres hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Justin Pryzby <pryzby(at)telsasoft(dot)com>, Stephen Frost <sfrost(at)snowman(dot)net>, Alexander Korotkov <aekorotkov(at)gmail(dot)com>, Andres Freund <andres(at)anarazel(dot)de>, Ilya Anfimov <ilan(at)tzirechnoy(dot)com>
Subject: Re: Add 64-bit XIDs into PostgreSQL 15
Date: 2022-09-16 08:59:20
Message-ID: CACG=ezZUhMiBSrjj4ZhxXyaoOP3zf-YVAh+0UK7YhOQ=N88efw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Thank you for your review.

Since we have converted TransactionId to 64-bit, so do we still need
> the concept of FullTransactionId? I mean it is really confusing to
> have 3 forms of transaction ids. i.e. Transaction Id,
> FullTransactionId and ShortTransactionId.
>
Yeah, I totally agree with you. Actually, it is better to get rid of them,
if this patch set will be committed.
We've already tried to do some experiments on this issue. But,
unfortunately, this resulted in bloating
the patch set. So, we decided to address this in the future.

1.
> typedef struct HeapTupleData
> {
> + TransactionId t_xmin; /* base value for normal transaction ids */
> + TransactionId t_xmax; /* base value for mutlixact */
>
> I think the field name and comments are not in sync, field says xmin
> and xmax whereas the comment says base value for
> transaction id and multi-xact.
>
Fixed.

> 2.
> extern bool heap_page_prepare_for_xid(Relation relation, Buffer buffer,
> TransactionId xid, bool multi);
>
> I noticed that this function is returning bool but all the callers are
> ignoring the return type.
>
Fixed.

> 3.
> +static int
> +heap_page_try_prepare_for_xid(Relation relation, Buffer buffer, Page page,
> + TransactionId xid, bool multi, bool is_toast)
> +{
> + TransactionId base;
> + ShortTransactionId min = InvalidTransactionId,
>
> add function header comments.
>
Fixed. Also, I made some refactoring to make this more clear.

> 4.
> Why no handling for multi? And this function has absolutely no
> comments to understand the reason for this.
>
Actually, this function works for multi transactions as well as for
"regular" transactions.
But in case of "regular" transactions, we have to look through multi
transactions to
see if any update transactions for particular tuple is present or not.
I add comments around here to make it clear.

> 5.
> Why pd_xid_base can not be just RecentXmin? Please explain in the
> comments above.
>
We're doing this, If I'm not mistaken, to be able to get all the possible
XID's
values, include InvalidTransactionId, FrozenTransactionId and so on. In
other
words, me must be able to get XID's values including special ones.

Here is a rebased version of a patch set. As always, reviews are very
welcome!

--
Best regards,
Maxim Orlov.

Attachment Content-Type Size
v46-0005-Add-initdb-option-to-initialize-cluster-with-non.patch application/octet-stream 24.4 KB
v46-0003-Use-64-bit-FullTransactionId-instead-of-Epoch-xi.patch application/octet-stream 18.8 KB
v46-0004-Use-64-bit-pages-representation-in-SLRU-callers.patch application/octet-stream 23.7 KB
v46-0002-Use-64-bit-format-to-output-XIDs.patch application/octet-stream 122.1 KB
v46-0001-Use-64-bit-numbering-of-SLRU-pages.patch application/octet-stream 24.5 KB
v46-0006-README.XID64.patch application/octet-stream 7.2 KB
v46-0007-Use-64-bit-GUCs.patch application/octet-stream 24.6 KB
v46-0008-Use-64-bit-XIDs.patch application/octet-stream 739.3 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Richard Guo 2022-09-16 09:59:11 About displaying NestLoopParam
Previous Message Amit Kapila 2022-09-16 08:58:34 Re: A question about wording in messages