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 1nRKdc-00083y-Rx for pgsql-hackers@arkaria.postgresql.org; Mon, 07 Mar 2022 21:11: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 1nRKdb-0006oJ-Fg for pgsql-hackers@arkaria.postgresql.org; Mon, 07 Mar 2022 21:11:27 +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 1nRKda-0006oA-Ry for pgsql-hackers@lists.postgresql.org; Mon, 07 Mar 2022 21:11:27 +0000 Received: from mail-wr1-x433.google.com ([2a00:1450:4864:20::433]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1nRKdX-0000iJ-Hw for pgsql-hackers@lists.postgresql.org; Mon, 07 Mar 2022 21:11:25 +0000 Received: by mail-wr1-x433.google.com with SMTP id x15so25312109wru.13 for ; Mon, 07 Mar 2022 13:11:23 -0800 (PST) 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 :from:to:cc:references:in-reply-to:content-transfer-encoding; bh=pFML81YDLjFUbK18bL7bVxdU0aGpqVv+/lT2dwX3Fc4=; b=Tc91352wYmzPYFVjTqEOq4zl8wDGd+bbQ9qkDsA0Wd4h1zexOCqdNRBXki2/1JMj8t eEqY5/l+OSvgnya4hYoWNDDEqpJWcc+CQxEzA2K3dl/16tDPBvuIWe5IvV2Tg2RVqs5R qu1MHWxFCvXEtcFRFHubPdmPQcmqH2gjYOeIv4OUAnaf5GNMUMHJ9AJ/FJjb/zdh6XXJ B2G18w1Y04x7HEin8YHPMPRfzyV53E6KCWsNX7fvR5+CG3G3OC67or15UDlDDqFp64zz EhwOrtyCvhFG4MSP2NgEcZyWFJpHYrU3lLI1AbXQl0bZrVKAyplAjjymsT2R4gEQz+oO Bq3w== 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:from:to:cc:references:in-reply-to :content-transfer-encoding; bh=pFML81YDLjFUbK18bL7bVxdU0aGpqVv+/lT2dwX3Fc4=; b=Y+BW7JLX1T8GKw81F7TLnq8A1MzEmWvGsvqoobwB8Q0vEFnLC/Bj4vZMJUneDp4ehh /x8gcwKxS0rnATapqVTlu1F26WzTZzLCTrRMPReSq+Kj5EGJ0AYaw3p1EOzmV7z+KgBJ xcad3EU/1Bch3mjkL8VaFybpQdXWAirE2uGk8SjpXzDTYcyyBw30/61RsbEdUa6PTWgV z87m77pZ1kyWNZjDgz1yTaqdxYjF/5xlWAaR/gptiwQqgwI7xM0IcqKa44rhe29Iu+7d QhxE/XFg2e/TuX1fAFLz47DvBMgq0yx3zxoUzljfsmO+pLGWu016sYLDC82dfsAPKZwE okjQ== X-Gm-Message-State: AOAM530Zjd09dfv09BfXLJMw/9Cugqx+JStkuSMSlyzdsSK0vP9dEGU2 PV8omt7qey/kOl+8va1chV+UKWolRvfneHo2KMAoXAx1xB2nOBvPRlycCm9Qu178xmI351nUjZL e/e0a/+TSC9rTcqXWU4bn17ug2R0TrNk8VOJ3I5fjkePAIIfUFisetriiGF8MX2t4Cx20TO2v4D btttzyGXwksZ2xFLKZQ07V+LYZDOSPQ2hBiudAqvERjUWemOjHDeDd X-Google-Smtp-Source: ABdhPJxdoAnxxC430dI99VHEXf5bryG1/sIEm7Ehx55TuQgdSftAJyaJrSE4J5X7mDtmU3cHv5/xBw== X-Received: by 2002:a05:6000:381:b0:1ef:fad4:59c0 with SMTP id u1-20020a056000038100b001effad459c0mr9686227wrf.162.1646687482128; Mon, 07 Mar 2022 13:11:22 -0800 (PST) Received: from [10.137.0.18] (ip-86-49-251-241.net.upcbroadband.cz. [86.49.251.241]) by smtp.gmail.com with ESMTPSA id q16-20020a056000137000b001f046a21afcsm12639844wrz.15.2022.03.07.13.11.20 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 07 Mar 2022 13:11:21 -0800 (PST) Message-ID: <352ee4b9-ae44-0640-71c3-edca97b89036@enterprisedb.com> Date: Mon, 7 Mar 2022 22:11:19 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 Subject: Re: logical decoding and replication of sequences Content-Language: en-US From: Tomas Vondra To: Amit Kapila Cc: Peter Eisentraut , Petr Jelinek , PostgreSQL Hackers References: <90b4e402-3f07-14f4-deca-5eaca31f70a3@enterprisedb.com> <22aef14d-0ea1-9044-c2e7-29f88762eaec@enterprisedb.com> <32540e16-fab6-f790-b99b-5a8fca8bde52@enterprisedb.com> <3B014BE4-EE61-4834-8FF6-937B43C46BC7@enterprisedb.com> <3d68b45a-ceb5-6824-3a39-f53411fd0c88@enterprisedb.com> <802f8b1b-a798-be52-c829-7f0fb9faafd5@enterprisedb.com> <983bf0c7-9757-fd13-3896-8452cf4c4c52@enterprisedb.com> <9211312a-6501-1caf-ee7b-c0d4814b6091@enterprisedb.com> <41ada110-bc7c-32a3-08bd-fb5023dd74ba@enterprisedb.com> In-Reply-To: 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 3/7/22 17:39, Tomas Vondra wrote: > > > On 3/1/22 12:53, Amit Kapila wrote: >> On Mon, Feb 28, 2022 at 5:16 PM Amit Kapila wrote: >>> >>> On Sat, Feb 12, 2022 at 6:04 AM Tomas Vondra >>> wrote: >>>> >>>> On 2/10/22 19:17, Tomas Vondra wrote: >>>>> I've polished & pushed the first part adding sequence decoding >>>>> infrastructure etc. Attached are the two remaining parts. >>>>> >>>>> I plan to wait a day or two and then push the test_decoding part. The >>>>> last part (for built-in replication) will need more work and maybe >>>>> rethinking the grammar etc. >>>>> >>>> >>>> I've pushed the second part, adding sequences to test_decoding. >>>> >>> >>> The test_decoding is failing randomly in the last few days. I am not >>> completely sure but they might be related to this work. The two of >>> these appears to be due to the same reason: >>> https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=skink&dt=2022-02-25%2018%3A50%3A09 >>> https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=locust&dt=2022-02-17%2015%3A17%3A07 >>> >>> TRAP: FailedAssertion("prev_first_lsn < cur_txn->first_lsn", File: >>> "reorderbuffer.c", Line: 1173, PID: 35013) >>> 0 postgres 0x00593de0 ExceptionalCondition + 160\\0 >>> >> >> While reviewing the code for this, I noticed that in >> sequence_decode(), we don't call ReorderBufferProcessXid to register >> the first known lsn in WAL for the current xid. The similar functions >> logicalmsg_decode() or heap_decode() do call ReorderBufferProcessXid >> even if they decide not to queue or send the change. Is there a reason >> for not doing the same here? However, I am not able to deduce any >> scenario where lack of this will lead to such an Assertion failure. >> Any thoughts? >> > > Thanks, that seems like an omission. Will fix. > I've pushed this simple fix. Not sure it'll fix the assert failures on skink/locust, though. Given the lack of information it'll be difficult to verify. So let's wait a bit. regards -- Tomas Vondra EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company