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 1ncPC4-0004NN-Dd for pgsql-hackers@arkaria.postgresql.org; Thu, 07 Apr 2022 10:16:48 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1ncPC3-00068P-AS for pgsql-hackers@arkaria.postgresql.org; Thu, 07 Apr 2022 10:16:47 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ncPC3-00068G-1i for pgsql-hackers@lists.postgresql.org; Thu, 07 Apr 2022 10:16:47 +0000 Received: from mail-yw1-x1129.google.com ([2607:f8b0:4864:20::1129]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1ncPC0-0005ff-Od for pgsql-hackers@lists.postgresql.org; Thu, 07 Apr 2022 10:16:46 +0000 Received: by mail-yw1-x1129.google.com with SMTP id 00721157ae682-2eb57fd3f56so56048967b3.8 for ; Thu, 07 Apr 2022 03:16:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=wrbzfLZZ3Q2wdDdGH24+LngPKUEChgbUhmeb+/FgVHg=; b=avDBVqNBv1jrdOB4QleNAye1bi+AOoo2kxuCeGK05TIkCv9/ePFy0E1lBqdTRUufXG Epy6wkkssQYTyoqvMANM1KjWPsfhYLkdxt4NPtqWuV6kDp1oLH556i49HfSVLb3Phm9Z Pulr3bVQoiilRyo8WWw+wroMPy/6+nNKy+BRoQIts6I49FnzJVSK3cZfEe2BNSLjuMtc yPJKDhsnSlEbM0VZUJOJTZFJS0kop/bTJ8ghza0jKq7kB96GXFt1tIepIc+iMEjqfb/d eBY5i2YkTR0tXyd1nFW7fSjcUJ9YqmdkxRYz2nPC0kLaEsIYfPoYlMNLQUGyS4uD/jI0 yq0Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=wrbzfLZZ3Q2wdDdGH24+LngPKUEChgbUhmeb+/FgVHg=; b=aavUVf0VapilL2gnsjYLNZAbEbXEyYp1zbwWc18zVIeLxK9KLS3ZtC+ycDAzC4Qgfx mNmxmF2pgIrll0SGMENEmM1wZ23BYFi/iaMB7hm8S923qqDqnUkV4lxdgdkamul36BIV kLi8dNacVlvVTw7/qXLwwfYqRhvpVF/wTvCwSJfYZsOqzAugEfyuX0eJyQ+WmJn0UoDT 5K5nvI8OeKhZd+Au+bf04/3gzmj743s9y/GiYzrhWjeHYHng/a+KFKIwvBCJWtFu9v0P oTkBrhNpgttHApfbYKkS7FZRJzB3m7fCyxOpE2Zb556u06emqJ2xafbgtZwHizh1UiC6 AWHw== X-Gm-Message-State: AOAM532jY+FTgfcre9gdVkaytz3zUrVcJ1WA4YGgPSs6brQ2fZIMhFrA C8Dv3rHDkRN4FHfFUPOlgZuJHITNpa56avoREBg= X-Google-Smtp-Source: ABdhPJzy83tlXHbZEsgQbeY1Py8jQJfOmFPqe97Kn6AtsKfNZ0wDI59L0kBylo5U4ixiiow3zrxAa0XXRlE39TdiIeI= X-Received: by 2002:a81:a155:0:b0:2e5:827a:700f with SMTP id y82-20020a81a155000000b002e5827a700fmr10770549ywg.305.1649326603985; Thu, 07 Apr 2022 03:16:43 -0700 (PDT) MIME-Version: 1.0 References: <202203162206.7spggyktx63e@alvherre.pgsql> In-Reply-To: From: Amit Kapila Date: Thu, 7 Apr 2022 15:46:32 +0530 Message-ID: Subject: Re: Support logical replication of DDLs To: Japin Li Cc: Zheng Li , Alvaro Herrera , Dilip Kumar , rajesh.rs0541@gmail.com, PostgreSQL Hackers Content-Type: text/plain; charset="UTF-8" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Wed, Mar 23, 2022 at 10:39 AM Japin Li wrote: > > Thanks for fixing this. I rebase the patchset on current master (383f222119) > and attach here for further review. > Some initial comments: =================== 1. +/* + * Write logical decoding DDL message into XLog. + */ +XLogRecPtr +LogLogicalDDLMessage(const char *prefix, Oid roleoid, const char *message, + size_t size, bool transactional) I don't see anywhere the patch using a non-transactional message. Is it required for any future usage? The non-transactional behavior has some known consistency issues, see email [1]. 2. For DDL replication, do we need to wait for a consistent point of snapshot? For DMLs, that point is a convenient point to initialize replication from, which is why we export a snapshot at that point, which is used to read normal data. Do we have any similar needs for DDL replication? 3. The patch seems to be creating an entry in pg_subscription_rel for 'create' message. Do we need some handling on Drop, if not, why? I think adding some comments for this aspect would make it easier to follow. 4. The handling related to partition tables seems missing because, on the subscriber-side, it always creates a relation entry in pg_subscription_rel which won't work. Check its interaction with publish_via_partition_root. [1] - https://www.postgresql.org/message-id/CAA4eK1KAFdQEULk%2B4C%3DieWA5UPSUtf_gtqKsFj9J9f2c%3D8hm4g%40mail.gmail.com -- With Regards, Amit Kapila.