Re: Add 64-bit XIDs into PostgreSQL 15

From: Aleksander Alekseev <aleksander(at)timescale(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Cc: Maxim Orlov <orlovmg(at)gmail(dot)com>, Shubham Khanna <khannashubham1197(at)gmail(dot)com>, Daniel Gustafsson <daniel(at)yesql(dot)se>, Pavel Borisov <pashkin(dot)elfe(at)gmail(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, Chris Travers <chris(at)orioledata(dot)com>, Bruce Momjian <bruce(at)momjian(dot)us>, Chris Travers <chris(dot)travers(at)gmail(dot)com>, Peter Geoghegan <pg(at)bowt(dot)ie>, Fedor Sigaev <teodor(at)sigaev(dot)ru>, Alexander Korotkov <aekorotkov(at)gmail(dot)com>, Konstantin Knizhnik <knizhnik(at)garret(dot)ru>, Nikita Glukhov <n(dot)gluhov(at)postgrespro(dot)ru>, Yura Sokolov <y(dot)sokolov(at)postgrespro(dot)ru>
Subject: Re: Add 64-bit XIDs into PostgreSQL 15
Date: 2024-06-19 13:22:21
Message-ID: CAJ7c6TNMuKWUuMfh5KWgJJBoJGqPHYdZeN4t+LB6WdRLbDfVTw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

> > Please send the Re-base version of the patch.
>
> PFA the rebased patchset.
>
> In order to keep the scope reasonable I suggest we focus on
> 0001...0005 for now. 0006+ are difficult to rebase / review and I'm a
> bit worried for the committer who will merge them. We can return to
> 0006+ when we deal with the first 5 patches. These patches can be
> delivered to PG18 independently, as we did with SLRU in the PG17
> cycle.
>
> Tested on Intel MacOS w/ Autotools and ARM Linux w/ Meson.

cfbot revealed a bug in 0004:

```
../src/backend/access/common/reloptions.c:1842:26: runtime error:
store to misaligned address 0x55a5c6d64d94 for type 'int64', which
requires 8 byte alignment
0x55a5c6d64d94: note: pointer points here
ff ff ff ff 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 ff ff ff ff
^
==18945==Using libbacktrace symbolizer.
#0 0x55a5c4a9b273 in fillRelOptions
../src/backend/access/common/reloptions.c:1842
#1 0x55a5c4a9c709 in build_reloptions
../src/backend/access/common/reloptions.c:2002
#2 0x55a5c4a9c739 in default_reloptions
../src/backend/access/common/reloptions.c:1957
#3 0x55a5c4a9ccc0 in heap_reloptions
../src/backend/access/common/reloptions.c:2109
#4 0x55a5c4da98d6 in DefineRelation ../src/backend/commands/tablecmds.c:858
#5 0x55a5c52549ac in ProcessUtilitySlow ../src/backend/tcop/utility.c:1164
#6 0x55a5c52545a2 in standard_ProcessUtility
../src/backend/tcop/utility.c:1067
#7 0x55a5c52546fd in ProcessUtility ../src/backend/tcop/utility.c:523
#8 0x55a5c524fe5b in PortalRunUtility ../src/backend/tcop/pquery.c:1158
#9 0x55a5c5250531 in PortalRunMulti ../src/backend/tcop/pquery.c:1315
#10 0x55a5c5250bd6 in PortalRun ../src/backend/tcop/pquery.c:791
#11 0x55a5c5249e44 in exec_simple_query ../src/backend/tcop/postgres.c:1274
#12 0x55a5c524cc07 in PostgresMain ../src/backend/tcop/postgres.c:4680
#13 0x55a5c524d18c in PostgresSingleUserMain
../src/backend/tcop/postgres.c:4136
#14 0x55a5c4f155e2 in main ../src/backend/main/main.c:194
#15 0x7fc3a77e5d09 in __libc_start_main
(/lib/x86_64-linux-gnu/libc.so.6+0x23d09)
#16 0x55a5c4a6a249 in _start
(/tmp/cirrus-ci-build/build/tmp_install/usr/local/pgsql/bin/postgres+0x8e1249)

Aborted (core dumped)
```

Here is the fix. It can be tested like this:

```
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -1839,6 +1839,7 @@ fillRelOptions(void *rdopts, Size basesize,
((relopt_int *) options[i].gen)->default_val;
break;
case RELOPT_TYPE_INT64:
+ Assert((((uint64)itempos) & 0x7) == 0);
*(int64 *) itempos = options[i].isset ?
options[i].values.int64_val :
((relopt_int64 *) options[i].gen)->default_val;
```

--
Best regards,
Aleksander Alekseev

Attachment Content-Type Size
v54-0005-README.XID64.patch application/octet-stream 7.2 KB
v54-0004-Use-64-bit-GUCs.patch application/octet-stream 32.7 KB
v54-0002-Use-64-bit-FullTransactionId-instead-of-Epoch-xi.patch application/octet-stream 22.2 KB
v54-0001-Use-64-bit-format-to-output-XIDs.patch application/octet-stream 141.1 KB
v54-0003-Use-64-bit-SLRU-pages-in-callers.patch application/octet-stream 4.2 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Joel Jacobson 2024-06-19 13:26:03 Re: Add pg_get_acl() function get the ACL for a database object
Previous Message Robert Haas 2024-06-19 13:17:00 Re: use CREATE DATABASE STRATEGY = FILE_COPY in pg_upgrade