pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Amit Kapila <akapila@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Reorder subskiplsn in pg_subscription to avoid alignment issues.
Date: Thu, 07 Apr 2022 04:21:42 +0000
Message-ID: <E1ncJeQ-000g61-0Z@gemulon.postgresql.org> (raw)

Reorder subskiplsn in pg_subscription to avoid alignment issues.

The column 'subskiplsn' uses TYPALIGN_DOUBLE (which has 4 bytes alignment
on AIX) for storage. But the C Struct (Form_pg_subscription) has 8-byte
alignment for this field, so retrieving it from storage causes an
unaligned read.

To fix this, we rearranged the 'subskiplsn' column in the catalog so that
it naturally comes at an 8-byte boundary.

We have fixed a similar problem in commit f3b421da5f. This patch adds a
test to avoid a similar mistake in the future.

Reported-by: Noah Misch
Diagnosed-by: Noah Misch, Masahiko Sawada, Amit Kapila
Author: Masahiko Sawada
Reviewed-by: Noah Misch, Amit Kapila
Discussion: https://postgr.es/m/20220401074423.GC3682158@rfd.leadboat.com
            https://postgr.es/m/CAD21AoDeScrsHhLyEPYqN3sydg6PxAPVBboK=30xJfUVihNZDA@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/79b716cfb7a1be2a61ebb4418099db1258f35e30

Modified Files
--------------
doc/src/sgml/catalogs.sgml                 | 20 ++++++-------
src/backend/catalog/pg_subscription.c      |  2 +-
src/backend/catalog/system_views.sql       |  4 +--
src/backend/commands/subscriptioncmds.c    |  2 +-
src/include/catalog/catversion.h           |  2 +-
src/include/catalog/pg_subscription.h      | 11 ++++----
src/test/regress/expected/sanity_check.out | 29 +++++++++++++++++++
src/test/regress/expected/test_setup.out   |  4 +++
src/test/regress/regress.c                 | 45 ++++++++++++++++++++++++++++++
src/test/regress/sql/sanity_check.sql      | 26 +++++++++++++++++
src/test/regress/sql/test_setup.sql        |  5 ++++
11 files changed, 130 insertions(+), 20 deletions(-)



Message-ID: <E1ncJeQ-000g61-0Z@gemulon.postgresql.org>
Permalink:  ../E1ncJeQ-000g61-0Z@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1ncJeQ-000g61-0Z@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: akapila@postgresql.org
  Subject: Re: pgsql: Reorder subskiplsn in pg_subscription to avoid alignment issues.
  In-Reply-To: <E1ncJeQ-000g61-0Z@gemulon.postgresql.org>
  References: <E1ncJeQ-000g61-0Z@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox