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 1nbCVI-00087t-Re for pgsql-hackers@arkaria.postgresql.org; Mon, 04 Apr 2022 02:31:40 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nbCVF-00044o-E6 for pgsql-hackers@arkaria.postgresql.org; Mon, 04 Apr 2022 02:31:37 +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 1nbCVE-00044f-Ti for pgsql-hackers@lists.postgresql.org; Mon, 04 Apr 2022 02:31:37 +0000 Received: from mail-qt1-x82c.google.com ([2607:f8b0:4864:20::82c]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1nbCVC-0000ji-5P for pgsql-hackers@postgresql.org; Mon, 04 Apr 2022 02:31:36 +0000 Received: by mail-qt1-x82c.google.com with SMTP id i4so6674725qti.7 for ; Sun, 03 Apr 2022 19:31:33 -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=869ku51Hskkhyo5SgJ/8g87oGFMg1QXYRJ2quNI4inE=; b=b3+MW5MBbgmTtopwUmU3jJgQc8roR2ZKNgzzPy913b7AJChrA2fDD79Q/x4xmonug0 KaRRBgQ+OSw/qiLKrRitTMl8Sh+gwyjQFiptJUfEDPfS3r+0I+xJKstPKkY0e9TQHevE dfBqvYC4BUw3VeyCeuRcVe3eadbqxggLmvTV8= 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=869ku51Hskkhyo5SgJ/8g87oGFMg1QXYRJ2quNI4inE=; b=6wa44ZATgttc0A+OwLZ5lFmVBXGJvKGMAHOOf3HRF3Box+ctVl5HZpnapHEzmu6kIJ k8Y9/O1bKnFNw+CpkzepDYwmUJQAQeHLE6RN/rK6ZLf/ZElcgnBD4U7iSVLt1gRYiuBM ePP/JCbhGkv/rnxjC80nl3+3MaBILQ4qVN3Bsi8shM2y7Vbe06702ymP+c9WXbaDhMZR FrvlNV4ccfWD5KBdPLs9K/rCsS9Ql4iYa1tnnVgLe+LWORaa3ciRgiyas+kgxR3SehWo KfJoe6KojnbkrN3sJhqJP69jQQJZ97dQU8f+7gmRYi7wEgEUxhByynY7uN37LNtX7sYM Ns0g== X-Gm-Message-State: AOAM532B6fwdKAaT8ECUKPIVOmZjWVdSymXqBa1XyLPMr+c5MNACz1IL o/GUSPgHMPHhrHNlAQ0xYI5u/w== X-Google-Smtp-Source: ABdhPJw5kZFJ0nTw+RlGmAoWgkvhBfCSIQoPiuh6KSJVLMthuu1yIZCvS/BaVyv2+auo/2a27VOS6w== X-Received: by 2002:a05:622a:58f:b0:2e1:eb89:60b5 with SMTP id c15-20020a05622a058f00b002e1eb8960b5mr15944699qtb.166.1649039492116; Sun, 03 Apr 2022 19:31:32 -0700 (PDT) Received: from rfd.leadboat.com ([2600:1702:a20:5750::2e]) by smtp.gmail.com with ESMTPSA id t72-20020a37464b000000b0067ec1c9dcaesm5634110qka.44.2022.04.03.19.31.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 03 Apr 2022 19:31:31 -0700 (PDT) Date: Sun, 3 Apr 2022 19:31:28 -0700 From: Noah Misch To: Masahiko Sawada Cc: Amit Kapila , 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: <20220404023128.GA3799006@rfd.leadboat.com> References: <20220402001153.GA3719101@rfd.leadboat.com> <20220402015943.GB3719101@rfd.leadboat.com> <20220402081346.GD3719101@rfd.leadboat.com> <20220403004555.GA3759211@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 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. On most hosts, the C alignment of an XLogRecPtr is 8 bytes, and TYPALIGN_DOUBLE==8. On AIX, C alignment is still 8 bytes, but TYPALIGN_DOUBLE==4. The tuples on disk and in shared buffers use TYPALIGN_DOUBLE to decide how much padding to insert, and that amount of padding needs to match the C alignment padding. Placing the field here reduces the padding to zero, making that invariant hold trivially. > + */ > + XLogRecPtr subskiplsn; > + > NameData subname; /* Name of the subscription */ > > Oid subowner BKI_LOOKUP(pg_authid); /* Owner of the subscription */ > @@ -71,9 +82,6 @@ CATALOG(pg_subscription,6100,SubscriptionRelationId) BKI_SHARED_RELATION BKI_ROW > bool subdisableonerr; /* True if a worker error should cause the > * subscription to be disabled */ > > - XLogRecPtr subskiplsn; /* All changes finished at this LSN are > - * skipped */ Some code sites list pg_subscription fields in field order. Please update them so they continue to list fields in field order. CreateSubscription() is one example.