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 1pKBkg-0002z5-0Z for pgsql-hackers@arkaria.postgresql.org; Tue, 24 Jan 2023 05:21:46 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pKBke-0004xo-GA for pgsql-hackers@arkaria.postgresql.org; Tue, 24 Jan 2023 05:21:44 +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 1pKBke-0004xf-79 for pgsql-hackers@lists.postgresql.org; Tue, 24 Jan 2023 05:21:44 +0000 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1pKBkb-00021i-Q3 for pgsql-hackers@postgresql.org; Tue, 24 Jan 2023 05:21:43 +0000 Received: by mail-wm1-x32e.google.com with SMTP id f19-20020a1c6a13000000b003db0ef4dedcso12010759wmc.4 for ; Mon, 23 Jan 2023 21:21:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=mfHzgCP/J10LIPTS/x0RPKk84Iytta9BoZILJg0Lkro=; b=N4ndWG11atN7ngPR72m13wjhsAcE5T89K79ARjY2zHRGnTAxkqf5Bf6Oj513SuJJhJ vPlLLBndty4PuYbVXkPVndx5SSkLI1s5KLxtTeaf89dIy3KRcltDhIEsb0deMpV6xOxI smkq53fg+CbPBANvBz6OsI/c6N1gY0YhWa/sp5XXaKLFXBXH6sBo/mfdGKmXLEXHZDfu +zmfrjkxiLT9Xw2TRr8UjC+Q3dYpT0FgpUOw2hhi5br7KxZ6/6RwuMi+rZUDoH9icn0E vmzB1aUoKO2Rxviio87MAMZZeNLLOnoTUmnIl+ItKA5NKlVEnmIozGEMnYMqVoz//Wzj uXgw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=mfHzgCP/J10LIPTS/x0RPKk84Iytta9BoZILJg0Lkro=; b=jyzbaPYhCV+uXarEpFApUefSQhrKkTKsDuzz7re9ApNCUDlB62P4GV9Fx9h5Kk8fJT 1rRrVfrfdv1uuRrGExNBd/9pvRyG+hC6TkS2cQgAe36/CHuIHgWt3T0TH0cyoKCSVP6+ OLTdxZLbJB3IbUzVDSc/tI4DnrVTCkV/HiUin1UYQd7mi7j1eVkGWQWyJEspDBUsSYMQ X2/hvzBOTVi5ToopGLjnOuPCX4bNeYoGRhLiJ4RdE33f0iocwZy9da5hO/61Uixd1Exe yLZFQebukH2Ma1UAZGMdUPdDCczwoQ+ZrtOMVUNHh8+TegKtANLmXBOuml7EBxwLXhjp Zdxg== X-Gm-Message-State: AFqh2krxxrHWdye7b60B/svrwc7VyiSKm6DXew/Isery9ttmxMhVf4ee fOsRnkcPxbb6H/tKRNHkalM= X-Google-Smtp-Source: AMrXdXuGCso6nSyrfWlmejtXlKY6f/tIK+qS2oj83nI8mWPSvK+OVSev+2QoetOpL3O3gipzPxQn9Q== X-Received: by 2002:a05:600c:4a27:b0:3da:fae5:7e2f with SMTP id c39-20020a05600c4a2700b003dafae57e2fmr26288382wmp.3.1674537700120; Mon, 23 Jan 2023 21:21:40 -0800 (PST) Received: from [192.168.5.118] ([54.239.6.189]) by smtp.gmail.com with ESMTPSA id l4-20020a05600c1d0400b003db2e3f2c7csm1517938wms.0.2023.01.23.21.21.39 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 23 Jan 2023 21:21:39 -0800 (PST) Message-ID: Date: Tue, 24 Jan 2023 06:20:20 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.6.1 Subject: Re: Minimal logical decoding on standbys To: Andres Freund Cc: Robert Haas , Thomas Munro , Alvaro Herrera , Ibrar Ahmed , Amit Khandekar , fabriziomello@gmail.com, tushar , Rahila Syed , pgsql-hackers References: <1f2ad9fd-53ff-74cc-a602-72d45423bcab@gmail.com> <05c0c4f3-82eb-bc6d-c876-5a265c05927b@gmail.com> <20230106034036.2m4qnn7ep7b5ipet@awork3.anarazel.de> <490206c5-bcde-e558-628a-dc67dae4d439@gmail.com> <20230119024617.jzsgpcrgjdc6ysge@awork3.anarazel.de> <20230124004612.xmryok6tcyk6i4pc@awork3.anarazel.de> Content-Language: en-US From: "Drouvot, Bertrand" In-Reply-To: <20230124004612.xmryok6tcyk6i4pc@awork3.anarazel.de> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, On 1/24/23 1:46 AM, Andres Freund wrote: > Hi, > > On 2023-01-19 10:43:27 +0100, Drouvot, Bertrand wrote: >>>> With a reload in place in my testing, now I notice that the catalog_xmin >>>> is updated on the primary physical slot after logical slots invalidation >>>> when reloading hot_standby_feedback from "off" to "on". >>>> >>>> This is not the case after a re-start (aka catalog_xmin is NULL). >>>> >>>> I think a re-start and reload should produce identical behavior on >>>> the primary physical slot. If so, I'm tempted to think that the catalog_xmin >>>> should be updated in case of a re-start too (even if all the logical slots are invalidated) >>>> because the slots are not dropped yet. What do you think? >>> >>> I can't quite follow the steps leading up to the difference. Could you list >>> them in a bit more detail? >>> >>> >> >> Sure, so with: >> >> 1) hot_standby_feedback set to off on the standby >> 2) create 2 logical replication slots on the standby and activate one >> 3) Invalidate the logical slots on the standby with VACUUM FULL on the primary >> 4) change hot_standby_feedback to on on the standby >> >> If: >> >> 5) pg_reload_conf() on the standby, then on the primary we get a catalog_xmin >> for the physical slot that the standby is attached to: >> >> postgres=# select slot_type,xmin,catalog_xmin from pg_replication_slots ; >> slot_type | xmin | catalog_xmin >> -----------+------+-------------- >> physical | 822 | 748 >> (1 row) > > How long did you wait for this to change? Almost instantaneous after pg_reload_conf() on the standby. > I don't think there's anything right > now that'd force a new hot-standby-feedback message to be sent to the primary, > after slots got invalidated. > > I suspect that if you terminated the walsender connection on the primary, > you'd not see it anymore either? > Still there after the standby is shutdown but disappears when the standby is re-started. > If that isn't it, something is broken in InvalidateObsolete... > Will look at what's going on and ensure catalog_xmin is not sent to the primary after pg_reload_conf() (if the slots are invalidated). > >> No, but a question still remains to me: >> >> Given the fact that the row removal case is already done >> in the next test (aka Scenario 2), If we want to replace the "vacuum full" test >> on the database (done in Scenario 1) with a cheaper one at the table level, >> what could it be to guarantee an invalidation? >> >> Same as scenario 2 but with "vacuum full pg_class" would not really add value >> to the tests, right? > > A database wide VACUUM FULL is also just a row removal test, no? Yeah, so I was wondering if Scenario 1 was simply not just useless. > I think it > makes sense to test that both VACUUM and VACUUM FULL both trigger conflicts, > because they internally use *very* different mechanisms. Got it, will do and replace Scenario 1 as you suggested initially. > It'd probably be > good to test at least conflicts triggered due to row removal via on-access > pruning as well. And perhaps also for btree killtuples. I think those are the > common cases for catalog tables. > Thanks for the proposal, will look at it. Regards, -- Bertrand Drouvot PostgreSQL Contributors Team RDS Open Source Databases Amazon Web Services: https://aws.amazon.com