Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qQr6Z-001Bms-Oy for pgsql-hackers@arkaria.postgresql.org; Tue, 01 Aug 2023 15:16:12 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1qQr6X-007hh9-QX for pgsql-hackers@arkaria.postgresql.org; Tue, 01 Aug 2023 15:16:11 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qQr6X-007hh1-Gq for pgsql-hackers@lists.postgresql.org; Tue, 01 Aug 2023 15:16:10 +0000 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1qQr6U-000DiA-6C for pgsql-hackers@lists.postgresql.org; Tue, 01 Aug 2023 15:16:09 +0000 Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-3fbd33a57b6so63681155e9.2 for ; Tue, 01 Aug 2023 08:16:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=enterprisedb.com; s=google; t=1690902964; x=1691507764; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=8efpRx8lBOv8wfpKOSk4Hp47I+unPszQV3voWTFz9VQ=; b=Ih4JpJpFb7UGLgGj6A07yglAiWrFbuZzGiiiWgkLNuI1HGnm57/hSAxrR6Hovii/EB KpLOAzfoHqdbvYVyLT9NQ2XCdJaBHIYnE8ma1f8GV0Bfa0iJXVYpWn6cp2HyKBEJp8ei vfE3pPTQzv4/H2eE+Z1kRlAj7wpTwGQjAU1pMynOCE2nuOpdYh1gizVz3cS4UjS550QO 2DNgl7R4xCLKHF9ff+yB1ZAC4SIQTu33+at8dX42tpV8oqUbDnhP6i1ODbBYQh8TWFkL vAb5mv8RVO/EF3ePL1AhLt/0Nl9x0qbOjzydA0/KflhJki0lHBo9i9Cvw3S5ylTYe77b 2cyw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690902964; x=1691507764; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=8efpRx8lBOv8wfpKOSk4Hp47I+unPszQV3voWTFz9VQ=; b=I3y6Rdv/zP16sjhcL6fT4ehfsHal4Wq7bupA16sD/0hUPTb4EGPwdLf7AZDJoWfGg0 YEh+Ms+cQZiffD0Yanw6+wAJSfMh1IEHD5L9gCMSNvT3H8N/3S9DKkk2AVL46ILI3zrQ fVw2WsXXQngUzzfh2sBwrAHb2qHmaKGKkVvwJCWyYqOvZt6dHChjiUZRxmbVlQoXo69A iWw2RaOhBIV+aBgWZFF8UmoTLLA8wS+JQgUwrwCejuLYuX42BUczFXiIO6P+KmsLw2NC ujWlEL8QBmdIF8PDwPsnim3IwTKUrMU85TIyfdkP7+Mb2RLIqQHOsJhTcXRxNpCWXTtN 0Hzg== X-Gm-Message-State: ABy/qLZSFFBbPCilPznw1T40gG16xWYpHPZSzqoleNDY4yorzlVSo3/d 0e36H4zFXhBWBIm/Li1Wn2jdFg== X-Google-Smtp-Source: APBJJlEwEadBQ2Kr4t+GV/ERorDwduunVjuHXExXVa7RX6x3Lli/SsqTR/G4WmPrqubRyri5Liaosg== X-Received: by 2002:a1c:7703:0:b0:3fe:207c:1aea with SMTP id t3-20020a1c7703000000b003fe207c1aeamr2759797wmi.23.1690902964333; Tue, 01 Aug 2023 08:16:04 -0700 (PDT) Received: from [10.137.0.17] (static-84-42-175-93.bb.vodafone.cz. [84.42.175.93]) by smtp.gmail.com with ESMTPSA id 9-20020a05600c240900b003fa98908014sm16939503wmp.8.2023.08.01.08.16.03 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 01 Aug 2023 08:16:03 -0700 (PDT) Message-ID: Date: Tue, 1 Aug 2023 17:16:02 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Subject: Re: logical decoding and replication of sequences, take 2 Content-Language: en-US To: Amit Kapila Cc: Ashutosh Bapat , PostgreSQL Hackers , Masahiko Sawada , Peter Eisentraut References: <5230cd14-7ebe-4a87-c345-782daf094847@enterprisedb.com> <21c87ea8-86c9-80d6-bc78-9b95033ca00b@enterprisedb.com> <94bbf042-7d7a-9ec5-64a9-9ffc6ddc0db3@enterprisedb.com> From: Tomas Vondra In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 8/1/23 04:59, Amit Kapila wrote: > On Mon, Jul 31, 2023 at 5:04 PM Tomas Vondra > wrote: >> >> On 7/31/23 11:25, Amit Kapila wrote: >>> ... >>> >>> Yeah, I also think this needs a review. This is a sort of new concept >>> where we don't use the LSN of the slot (for cases where copy returned >>> a larger value of LSN) or a full_snapshot created corresponding to the >>> sync slot by Walsender. For the case of the table, we build a full >>> snapshot because we use that for copying the table but why do we need >>> to build that for copying the sequence especially when we directly >>> copy it from the sequence relation without caring for any snapshot? >>> >> >> We need the slot to decode/apply changes during catchup. The main >> subscription may get ahead, and we need to ensure the WAL is not >> discarded or something like that. This applies even if the initial sync >> step does not use the slot/snapshot directly. >> > > AFAIK, none of these needs a full_snapshot (see usage of > SnapBuild->building_full_snapshot). The full_snapshot tracks both > catalog and non-catalog xacts in the snapshot where we require to > track non-catalog ones because we want to copy the table using that > snapshot. It is relatively expensive to build a full snapshot and we > don't do that unless it is required. For the current usage of this > patch, I think using CRS_NOEXPORT_SNAPSHOT would be sufficient. > Yeah, you may be right we don't need a full snapshot, because we don't need to export it. We however still need a snapshot, and it wasn't clear to me whether you suggest we don't need the slot / snapshot at all. Anyway, I think this is "just" a matter of efficiency, not correctness. IMHO there are bigger questions regarding the "going back" behavior after apply restart. regards -- Tomas Vondra EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company