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 1pKKM2-00086S-DP for pgsql-hackers@arkaria.postgresql.org; Tue, 24 Jan 2023 14:32:54 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pKKM0-0001Om-WD for pgsql-hackers@arkaria.postgresql.org; Tue, 24 Jan 2023 14:32:53 +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 1pKKM0-0001Od-LN for pgsql-hackers@lists.postgresql.org; Tue, 24 Jan 2023 14:32:52 +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 1pKKLv-0006o4-5i for pgsql-hackers@postgresql.org; Tue, 24 Jan 2023 14:32:51 +0000 Received: by mail-wm1-x32e.google.com with SMTP id o17-20020a05600c511100b003db021ef437so11068281wms.4 for ; Tue, 24 Jan 2023 06:32:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:references:cc:to:from :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=I0/X6J+oEAZCw10PPrlN6Dml+L7h4lypclF3CzNsQcA=; b=E3uCVzILV274AKvYYZRRTkkCaG4pWyccVz/jHl8EgDBkEAwujA96ddhvpcc7Z3FTTX 4KDNU6uLyva5BstBH2Kpym2dOUt7wOaXK/+uHovyw4LSMyxLVZ0JScggu7MU//3g2nMz +r6/bU3D6JerFN6TU527V4ap19qLOHLuh5OpFFocvQD6B9+oe8IXRDn0UjVKJTtEP7sn gphiDIs2HNQjxsa5xyc+GNdMNLvKLqh7tr6MeLLVfWzmfQ92rgYWxU2tOIMuv2yP+IUv E7TSzRwa8BBFYpn/cTSqddhr7nkLoLtGml1KO1nUWtCvi/ZYn4HYNy9/dAOTix0Eu2L+ h14w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:references:cc:to:from :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=I0/X6J+oEAZCw10PPrlN6Dml+L7h4lypclF3CzNsQcA=; b=n7w+a5jPtAoCeR1ZsLEC8Cw/pOb5o1gNezL6o+D1/WPF7XkZtSvZGDXYow0fKnXXeA YCVH7vlya8wZJpHKSio4tprnyaeCsKhcVz0yf56V5R71qOor1+c24Av9aImXic+ZYhTv +z0aRRiYE04D5JB3wCx/Pt9YTyWci86eldnqONPTm98dE0xWRoeegSHv9RfUthDBdHPn wkKed3Vjocyj3C/Vs8L9d7B3Oj4TvAyMMGMH5+QGAHdI4oeQLwQZUFGEl6E8zNQzXH85 f2zqaxxe2GaCBoiBGs1DlwfT63Tx5l+B+ToTBcbVzx0tijJhT8dfxt3Rjl5tZHxS00oK swDQ== X-Gm-Message-State: AFqh2kqm4+sbBzDrT+NtF2tjpjYmMzB18Ti3fYuVQCdDehgDYT5FStNg oJ0MXppU2qrp3uw9T0w4F24= X-Google-Smtp-Source: AMrXdXu38MGV2iqY5Q4ql7meL6b0JW+z6BzZ1J+ANmWv4F1RDQx8j47YzTyTPpC7V5bTtcwEzcDGow== X-Received: by 2002:a05:600c:1713:b0:3da:fd90:19dd with SMTP id c19-20020a05600c171300b003dafd9019ddmr28089166wmn.26.1674570765586; Tue, 24 Jan 2023 06:32:45 -0800 (PST) Received: from [192.168.5.118] ([54.239.6.189]) by smtp.gmail.com with ESMTPSA id h33-20020a05600c49a100b003db2dbbd710sm2124848wmp.25.2023.01.24.06.32.43 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 24 Jan 2023 06:32:44 -0800 (PST) Message-ID: <9dfd49e6-6675-526e-0636-0ba09396744e@gmail.com> Date: Tue, 24 Jan 2023 15:31:24 +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 Content-Language: en-US From: "Drouvot, Bertrand" 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> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, On 1/24/23 6:20 AM, Drouvot, Bertrand wrote: > Hi, > > On 1/24/23 1:46 AM, Andres Freund wrote: >> Hi, >> >> On 2023-01-19 10:43:27 +0100, Drouvot, Bertrand wrote: >>> 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... >> Yeah, you are right: ReplicationSlotsComputeRequiredXmin() is missing for the logical slot invalidation case (and ReplicationSlotsComputeRequiredXmin() also needs to take care of it). I'll provide a fix in the next revision along with the TAP tests comments addressed. Regards, -- Bertrand Drouvot PostgreSQL Contributors Team RDS Open Source Databases Amazon Web Services: https://aws.amazon.com