Re: XID formatting and SLRU refactorings (was: Add 64-bit XIDs into PostgreSQL 15)

From: Aleksander Alekseev <aleksander(at)timescale(dot)com>
To: Postgres hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Cc: Andres Freund <andres(at)anarazel(dot)de>, Peter Geoghegan <pg(at)bowt(dot)ie>, Michael Paquier <michael(at)paquier(dot)xyz>, Ian Lawrence Barwick <barwick(at)gmail(dot)com>, Maxim Orlov <orlovmg(at)gmail(dot)com>, Simon Riggs <simon(dot)riggs(at)enterprisedb(dot)com>, Hamid Akhtar <hamid(dot)akhtar(at)percona(dot)com>, Pavel Borisov <pashkin(dot)elfe(at)gmail(dot)com>, Justin Pryzby <pryzby(at)telsasoft(dot)com>, Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>, Japin Li <japinli(at)hotmail(dot)com>, Alexander Korotkov <aekorotkov(at)gmail(dot)com>, Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>, Ilya Anfimov <ilan(at)tzirechnoy(dot)com>
Subject: Re: XID formatting and SLRU refactorings (was: Add 64-bit XIDs into PostgreSQL 15)
Date: 2022-12-09 09:50:46
Message-ID: CAJ7c6TMnKtF4Z3_XC27DSRwSdCi1z92QU9J5wp5p4jLJ4Occ_A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Andres,

> This causes a lot of failures with ubsan

Thanks for reporting this!

I managed to reproduce the issue locally and to fix it. UBSAN is happy
now. PFA v49.

> I bet that this alignment issue can be fixed by using PGAlignedBlock
> instead of a raw char buffer for a page. (I'm guessing, I haven't
> directly checked.)

No, actually the problem was much simpler.

0001 changes SLRU page numbering from 32-bit to 64-bit one. This also
changed the SlruScanDirCbReportPresence() callback:

```
bool
SlruScanDirCbReportPresence(SlruCtl ctl, char *filename, int64 segpage,
void *data)
{
int64 cutoffPage = *(int64 *) data;
```

However TruncateCLOG() and TruncateCommitTs() were not changed
accordingly in v47, they were passing a pointer to int32 as *data.

--
Best regards,
Aleksander Alekseev

Attachment Content-Type Size
v49-0003-Use-64-bit-FullTransactionId-instead-of-Epoch-xi.patch application/octet-stream 18.8 KB
v49-0001-Use-64-bit-numbering-of-SLRU-pages.patch application/octet-stream 31.2 KB
v49-0002-Use-64-bit-format-to-output-XIDs.patch application/octet-stream 126.3 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2022-12-09 09:52:17 Re: generic plans and "initial" pruning
Previous Message Richard Guo 2022-12-09 09:16:47 Check lateral references within PHVs for memoize cache keys