From: | Antonin Houska <ah(at)cybertec(dot)at> |
---|---|
To: | Mihail Nikalayeu <mihailnikalayeu(at)gmail(dot)com> |
Cc: | Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>, Fujii Masao <masao(dot)fujii(at)gmail(dot)com>, Robert Treat <rob(at)xzilla(dot)net>, Pg Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Re: Adding REPACK [concurrently] |
Date: | 2025-08-21 18:07:04 |
Message-ID: | 40729.1755799624@localhost |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Mihail Nikalayeu <mihailnikalayeu(at)gmail(dot)com> wrote:
> Also, I think I found an issue (or lost something during rebase): we
> must preserve xmin,cmin during initial copy
> to make sure that data is going to be visible by snapshots of
> concurrent changes later:
>
> static void
> reform_and_rewrite_tuple(......)
> .....
> /*It is also crucial to stamp the new record with the exact same
> xid and cid,
> * because the tuple must be visible to the snapshot of the
> applied concurrent
> * change later.
> */
> CommandId cid = HeapTupleHeaderGetRawCommandId(tuple->t_data);
> TransactionId xid = HeapTupleHeaderGetXmin(tuple->t_data);
>
> heap_insert(NewHeap, copiedTuple, xid, cid, HEAP_INSERT_NO_LOGICAL, NULL);
When posting version 12 of the patch [1] I raised a concern that the the MVCC
safety is too expensive when it comes to logical decoding. Therefore, I
abandoned the concept for now, and v13 [2] uses plain heap_insert(). Once we
implement the MVCC safety, we simply rewrite the tuple like v12 did - that's
the simplest way to preserve fields like xmin, cmin, ...
[1] https://www.postgresql.org/message-id/178741.1743514291%40localhost
[2] https://www.postgresql.org/message-id/97795.1744363522%40localhost
--
Antonin Houska
Web: https://www.cybertec-postgresql.com
From | Date | Subject | |
---|---|---|---|
Next Message | Nathan Bossart | 2025-08-21 18:07:10 | Re: vacuumdb --missing-stats-only and permission issue |
Previous Message | Nathan Bossart | 2025-08-21 17:59:52 | Re: vacuumdb --missing-stats-only and permission issue |