Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nbGAZ-0002W2-Ld for pgsql-hackers@arkaria.postgresql.org; Mon, 04 Apr 2022 06:26:31 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nbGAX-0000ss-H4 for pgsql-hackers@arkaria.postgresql.org; Mon, 04 Apr 2022 06:26:29 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nbGAX-0000si-7i for pgsql-hackers@lists.postgresql.org; Mon, 04 Apr 2022 06:26:29 +0000 Received: from mail-qt1-x829.google.com ([2607:f8b0:4864:20::829]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1nbGAU-0002ur-Oi for pgsql-hackers@postgresql.org; Mon, 04 Apr 2022 06:26:28 +0000 Received: by mail-qt1-x829.google.com with SMTP id 10so6901810qtz.11 for ; Sun, 03 Apr 2022 23:26:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=leadboat.com; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=4Atw+Btjfh/jl0/2iYiOHEBNdV8C85k3178lPqu9pFM=; b=Zy52XprHM9cAIkBH/yiusUCquuPm0sOQv2QycpVYoDROcpJd9FoPOGpow4SdQrNfrE 2UzTZR1oQ+wTy617rngX1qo15hwx47Es6RJPfDPIWw5jEyOqAVxZMZUhxeI+W5GClnEU 2/dJ0uYDLZV3GGm7XmWD+uApXpiNF58HaJzL0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=4Atw+Btjfh/jl0/2iYiOHEBNdV8C85k3178lPqu9pFM=; b=b5DL4N7B82yofEdwXMIAhaiLphfBXSXRhAbVja5JewUeIk/Ol7TAX+g5U89qCkwbaM dw5v0HVzbyoQhRWOze6MRznMWvd+Y2YCZSNE/LBdQkf4+TXh/3kB1ZGZ0rVWC8qA3fDv JV+Dwoee5Qe+ocZsl9dwIu6dDiiXWKx+WZn+uCta3AbCRfVFG1D8xAEtRsDAa0wMX2s+ 2JkFtUZonsstxQ1a2X0rb3MP2x0GDHefCThH3DVvRsvDGh06VdbeCgt6C6Dd7gu4TOa7 ibVlLQeELFI00a4/yr5fTR/YMjW9OwWNRikeR7wuhdutcZuWQLnNbMt3DRb9W0l9BYvy OV8g== X-Gm-Message-State: AOAM530g8FXp+ul1lXTyaWEBTGdCnilFEWWaI96AUHeGCmy5fxQXKcV0 LdzSd4GndaoHEd/h4+oEZmNcaQ== X-Google-Smtp-Source: ABdhPJyWqLxTG1/2H3ap6HFlypanrUTAl+khwIx71poZEfK0YuTSr7P4yZvRcEMtUjo6RvdUqM610g== X-Received: by 2002:ac8:7f06:0:b0:2e2:dc3f:a8e8 with SMTP id f6-20020ac87f06000000b002e2dc3fa8e8mr16593741qtk.17.1649053584389; Sun, 03 Apr 2022 23:26:24 -0700 (PDT) Received: from rfd.leadboat.com ([2600:1702:a20:5750::2e]) by smtp.gmail.com with ESMTPSA id m1-20020ae9e001000000b0067d430bba8asm5754104qkk.88.2022.04.03.23.26.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 03 Apr 2022 23:26:23 -0700 (PDT) Date: Sun, 3 Apr 2022 23:26:20 -0700 From: Noah Misch To: Amit Kapila Cc: Masahiko Sawada , Euler Taveira , "osumi.takamichi@fujitsu.com" , Peter Eisentraut , "David G. Johnston" , "tanghy.fnst@fujitsu.com" , vignesh C , Greg Nancarrow , "houzj.fnst@fujitsu.com" , Alexey Lesovsky , pgsql-hackers Subject: Re: Skipping logical replication transactions on subscriber side Message-ID: <20220404062620.GE3799006@rfd.leadboat.com> References: <20220402015943.GB3719101@rfd.leadboat.com> <20220402081346.GD3719101@rfd.leadboat.com> <20220403004555.GA3759211@rfd.leadboat.com> <20220404023128.GA3799006@rfd.leadboat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Mon, Apr 04, 2022 at 08:20:08AM +0530, Amit Kapila wrote: > On Mon, Apr 4, 2022 at 8:01 AM Noah Misch wrote: > > On Mon, Apr 04, 2022 at 10:28:30AM +0900, Masahiko Sawada wrote: > > > On Sun, Apr 3, 2022 at 9:45 AM Noah Misch wrote: > > > > On Sat, Apr 02, 2022 at 08:44:45PM +0900, Masahiko Sawada wrote: > > > > > On Sat, Apr 2, 2022 at 7:04 PM Amit Kapila wrote: > > > > > > On Sat, Apr 2, 2022 at 1:43 PM Noah Misch wrote: > > > > > > > Some options: > > > > > > > - Move subskiplsn after subdbid, so it's always aligned anyway. I've > > > > > > > confirmed that this lets the test pass, in 44s. > > > > > --- a/src/include/catalog/pg_subscription.h > > > +++ b/src/include/catalog/pg_subscription.h > > > @@ -54,6 +54,17 @@ CATALOG(pg_subscription,6100,SubscriptionRelationId) BKI_SHARED_RELATION BKI_ROW > > > > > > Oid subdbid BKI_LOOKUP(pg_database); /* Database the > > > * subscription is in. */ > > > + > > > + /* > > > + * All changes finished at this LSN are skipped. > > > + * > > > + * Note that XLogRecPtr, pg_lsn in the catalog, is 8-byte alignment > > > + * (TYPALIGN_DOUBLE) and it does not match the alignment on some platforms > > > + * such as AIX. Therefore subskiplsn needs to be placed here so it is > > > + * always aligned. > > > > I'm reading this comment as saying that TYPALIGN_DOUBLE is always 8 bytes, but > > the problem arises precisely because TYPALIGN_DOUBLE==4 on AIX. > > How about a comment like: "It has to be kept at 8-byte alignment > boundary so as to be accessed directly via C struct as it uses > TYPALIGN_DOUBLE for storage which has 4-byte alignment on platforms > like AIX."? Can you please suggest a better comment if you don't like > this one? I'd write it like this, though I'm not sure it's an improvement on your words: When ALIGNOF_DOUBLE==4 (e.g. AIX), the C ABI may impose 8-byte alignment on some of the C types that correspond to TYPALIGN_DOUBLE SQL types. To ensure catalog C struct layout matches catalog tuple layout, arrange for the tuple offset of each fixed-width, attalign='d' catalog column to be divisible by 8 unconditionally. Keep such columns before the first NameData column of the catalog, since packagers can override NAMEDATALEN to an odd number. The best place for such a comment would be in one of src/test/regress/sql/*sanity*.sql, next to a test written to detect new violations. If adding such a test would materially delay getting the buildfarm green, putting the comment in pg_subscription.h works for me.