Re: pgsql: Store 2PC GID in commit/abort WAL recs for logical decoding

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
Cc: Simon Riggs <simon(at)2ndQuadrant(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pgsql: Store 2PC GID in commit/abort WAL recs for logical decoding
Date: 2018-04-10 07:24:35
Message-ID: 20180410072435.GE26769@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

On Mon, Apr 09, 2018 at 03:30:39PM +0300, Heikki Linnakangas wrote:
> There seems to be some confusion on the padding here. Firstly, what's the
> point of zero-padding the GID length to the next MAXALIGN boundary, which
> would be 8 bytes on 64-bit systems, if the start is only guaranteed 4-byte
> alignment, per the comment at the memcpy() above. Secondly, if we're
> memcpying the fields that follow anyway, why bother with any alignment
> padding at all?

It seems to me that you are right here: those complications are not
necessary.

if (replorigin)
+ {
/* Move LSNs forward for this replication origin */
replorigin_session_advance(replorigin_session_origin_lsn,
gxact->prepare_end_lsn);
+ }
This is better style.

+ /* twophase_gid follows if XINFO_HAS_GID. As a null-terminated string. */
+ /* xl_xact_origin follows if XINFO_HAS_ORIGIN, stored unaligned! */

Worth mentioning that the first one is also unaligned with your patch?
And that all the last fields of xl_xact_commit and xl_xact_abort are
kept as such on purpose?
--
Michael

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Julien Rouhaud 2018-04-10 08:08:16 Re: pgsql: Merge catalog/pg_foo_fn.h headers back into pg_foo.h headers.
Previous Message David Rowley 2018-04-10 03:37:31 Re: pgsql: Support partition pruning at execution time

Browse pgsql-hackers by date

  From Date Subject
Next Message Julien Rouhaud 2018-04-10 08:08:16 Re: pgsql: Merge catalog/pg_foo_fn.h headers back into pg_foo.h headers.
Previous Message Jaime Casanova 2018-04-10 07:07:58 Partitioned tables and covering indexes