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 1nlZzF-0000Xg-F9 for pgsql-hackers@arkaria.postgresql.org; Mon, 02 May 2022 17:37:29 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nlZzE-0004PO-BG for pgsql-hackers@arkaria.postgresql.org; Mon, 02 May 2022 17:37:28 +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 1nlZzE-0004Mo-1U for pgsql-hackers@lists.postgresql.org; Mon, 02 May 2022 17:37:28 +0000 Received: from mail-ej1-x62b.google.com ([2a00:1450:4864:20::62b]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1nlZzB-0000bq-Kp for pgsql-hackers@lists.postgresql.org; Mon, 02 May 2022 17:37:27 +0000 Received: by mail-ej1-x62b.google.com with SMTP id bv19so29068381ejb.6 for ; Mon, 02 May 2022 10:37:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=enterprisedb.com; s=google; h=message-id:date:mime-version:user-agent:subject:content-language:to :cc:references:from:in-reply-to:content-transfer-encoding; bh=II3OPxKGxUjCK4DeQx+nidhnVp4ySZnB4cmPx3S6/rs=; b=RZzDntokHduLKYATWwlcoqDbw03+1Kssanqz57X0mxg9QphGbkIo86xrTbZNuzmNCK BGIOOZJCGo2Khg0mi9d/Gcn60PWGMQzlRKiEkqMGbdymQV61xtuTIUWgGX8G72qrXQxe QO0e6z97dJj/Z8OCoE80BafDg5bjfeZQOK25iJoVWmMJ6zCPEGLjfcsvhUW46kOGb1dU 07HbaD62W34Y3SGAc1ud8uFGduqGDTmRFRNCVtPiyKGwehLpAUqmdnHWsBTE746m3Daw Nq/ubY5m09vPe3yZwINAS5SX62ftODWZjQI+LrVVI+0oWgavJ6Wz4wOMWoy1vLtMJhJ/ TVcQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=II3OPxKGxUjCK4DeQx+nidhnVp4ySZnB4cmPx3S6/rs=; b=EXm5KUD6s7J0rtCiJ58u7wX1Z2thv43VeZLyrn7euPfvUsK8pC0YXOcGkUfiRTg/ph OD1nvQAEEffni51saB8G1w7gAlgdJKp1p98G0deqkl9SbaOynkz4iZpJYMwfyOmeRZTM PtPR5s6MbHJuc0grYTCxvFvOvjgcPIWLrJdCChjJFYrXnHyrZTM5XACU0/ThnTTLX9ID I/wKXVF1TujsdJ0po/+qC+c+FCJw3N4+9Gadvclag47HpVWvS7r9qypr8j4+lANE3hLh gRIxI6qlTeuqiOS7lXIQjhMFqmnrg9Rx8Gnsw45lvasDIcyQf3eKiv+Yrnuhjcti89W9 ym7g== X-Gm-Message-State: AOAM530Gnh0ROiSnkSLlTYq2n/3fLm9k6MTEtzAv0/Xe7NWace/wbPzw DNZ8Rl5McjlQmleJz4ci5+kbVk4mRIb2Bvt95kT6FqWMwkNLd6Hvn1aa/FGo3O51R85C7QeM4Jl 8kjdaxyENkRBHJkTqkKKBAb0kKxRGX3t6cHqaFjpgSOxopd2+eb+kLMwlKSQ4ke0/1zCGNt9cAu X8kYBZObhH9kFhUy0rZaBOgMeLalJ1F/ZT0a+6wlwq5lg8Gc2x6j56 X-Google-Smtp-Source: ABdhPJwDsje0SgrCjDJ4Pkct5x2ehs2qzsp8KMsaetncLUIyiedHh7qKayFlSvg4t1vvEH5Ats9Vpw== X-Received: by 2002:a17:907:6e19:b0:6f0:1e4c:b4d3 with SMTP id sd25-20020a1709076e1900b006f01e4cb4d3mr12254626ejc.583.1651513044099; Mon, 02 May 2022 10:37:24 -0700 (PDT) Received: from [10.137.0.17] (ip-86-49-250-165.net.upcbroadband.cz. [86.49.250.165]) by smtp.gmail.com with ESMTPSA id x42-20020a50baad000000b00426cae11e63sm3719989ede.43.2022.05.02.10.37.18 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 02 May 2022 10:37:20 -0700 (PDT) Message-ID: Date: Mon, 2 May 2022 19:36:54 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.8.0 Subject: Re: bogus: logical replication rows/cols combinations Content-Language: en-US To: Alvaro Herrera , Amit Kapila Cc: Peter Eisentraut , Pg Hackers References: <202205021144.zkbvyekn52v7@alvherre.pgsql> From: Tomas Vondra In-Reply-To: <202205021144.zkbvyekn52v7@alvherre.pgsql> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-CLOUD-SEC-AV-Info: enterprisedb,google_mail,monitor X-CLOUD-SEC-AV-Sent: true X-Gm-Spam: 0 X-Gm-Phishy: 0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 5/2/22 13:44, Alvaro Herrera wrote: > On 2022-May-02, Amit Kapila wrote: > >> We don't do that currently but we can as mentioned in my previous >> email [1]. Let me write the relevant part again. We need to expose all >> publications for a walsender, and then we can find the exact set of >> publications where the current publication is used with other >> publications and we can check only those publications. So, if we have >> three walsenders (walsnd1: pub1, pub2; walsnd2 pub2; walsnd3: pub2, >> pub3) in the system and we are currently altering publication pub1 >> then we need to check only pub3 for any conflicting conditions. > > Hmm ... so what happens in the current system, if you have a running > walsender and modify the publication concurrently? Will the subscriber > start getting the changes with the new publication definition, at some > arbitrary point in the middle of their stream? If that's what we do, > maybe we should have a signalling system which disconnects all > walsenders using that publication, so that they can connect and receive > the new definition. > > I don't see anything in the publication DDL that interacts with > walsenders -- perhaps I'm overlooking something. > pgoutput.c is relies on relcache callbacks to get notified of changes. See the stuff that touches replicate_valid and publications_valid. So the walsender should notice the changes immediately. Maybe you have some particular case in mind, though? >> I think it is possible to expose a list of publications for each >> walsender as it is stored in each walsenders >> LogicalDecodingContext->output_plugin_private. AFAIK, each walsender >> can have one such LogicalDecodingContext and we can probably share it >> via shared memory? > > I guess we need to create a DSM each time a walsender opens a > connection, at START_REPLICATION time. Then ALTER PUBLICATION needs to > connect to all DSMs of all running walsenders and see if they are > reading from it. Is that what you have in mind? Alternatively, we > could have one DSM per publication with a PID array of all walsenders > that are sending it (each walsender needs to add its PID as it starts). > The latter might be better. > I don't quite follow what we're trying to build here. The walsender already knows which publications it works with - how else would pgoutput.c know that? So the walsender should be able to validate the stuff it's supposed to replicate is OK. Why would we need to know publications replicated by other walsenders? And what if the subscriber is not connected at the moment? In that case there'll be no walsender. regards -- Tomas Vondra EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company