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 1rAsFC-008Xl7-SQ for pgsql-hackers@arkaria.postgresql.org; Wed, 06 Dec 2023 13:47:18 +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 1rAsFB-009hUp-Ht for pgsql-hackers@arkaria.postgresql.org; Wed, 06 Dec 2023 13:47:17 +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 1rAsFB-009hUg-6M for pgsql-hackers@lists.postgresql.org; Wed, 06 Dec 2023 13:47:17 +0000 Received: from mail-ed1-x535.google.com ([2a00:1450:4864:20::535]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1rAsF7-00AOaM-Sp for pgsql-hackers@lists.postgresql.org; Wed, 06 Dec 2023 13:47:16 +0000 Received: by mail-ed1-x535.google.com with SMTP id 4fb4d7f45d1cf-54c77e0835bso5671508a12.2 for ; Wed, 06 Dec 2023 05:47:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=enterprisedb.com; s=google; t=1701870432; x=1702475232; darn=lists.postgresql.org; 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=oIXjX1rwYdPsJLPGy8jbAJY/AdnQSiJ03JHwxwy3L8Y=; b=kO4vS1UA/YrTf3reQcPxVQ8L762q7C8MCU1JznM03AGbkYt+jXeeBaRG8DDvKn0M0C V/UoZiuw8MM12Bq2GlD4vmMcfMY/uovo4HzQ5szvrZjcg4KVNYGxACxglS7XnrP9D39+ 3r4lrJU5yBioBr6qEq/xQo4dQ0hY8lB89fJTeL+VJR1Dz8B/JBnpXQRgmra3L1wxjpse 34d6p3QCECUiQCMwNDdiGYbNgCFkdg0IgYCuLVG00kYt2mwLEzfpcZv16BWEZg0cAjgN DWv51jfjDjF5NOKMXsohTUSZj9UEfisS6WapDj7O9fPLq+vjJrAzzHG722V0KriOuXGs 7mzg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701870432; x=1702475232; 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=oIXjX1rwYdPsJLPGy8jbAJY/AdnQSiJ03JHwxwy3L8Y=; b=A3jqpwK1vw7iHPBUQ/5Tw3/WQZnf/JtsC7D8O83YjhMO3877qTuSXEyn9HVdAH2lMt CxOaUXGcAUyXqeYX3AShX2F6/jxDaOR6M21OuXLwUOrHftQ0xFKHOsvIRwyY0Q7Se96h uslwpM30kqBsmTurAK7F9WxdHHNMUvOePCmXVBc96lQW85ILwTqTBCRK3uveLhWDqmW+ rhE84dFtON2RkPtQ7uftIwJznNuvmFGYCMpiPezBdECZp9/NDJWyALKZWHCLbbZMQ3NG PipXSbqg5KRI3gDqZJvmabfpx8KyOYE56pZfphFIWTu9zK4q/evA+XDXGmMlxPC3Z00G gZLw== X-Gm-Message-State: AOJu0YwUy9BFDdJstplvuELoQKtIky4fEdbY2nDnVBziNQNSR/Q6ZYlb JtMt3SCCZ6l8fxok1tBBHVN+Bw== X-Google-Smtp-Source: AGHT+IEmARJSDm8BpMCuHLWulHWKu4DZ0kYq06oSl8EgjSCCVSjbmRdmw5/PjD11mDAjFWdHni7PEg== X-Received: by 2002:aa7:c901:0:b0:54c:4837:8b62 with SMTP id b1-20020aa7c901000000b0054c48378b62mr742773edt.48.1701870432311; Wed, 06 Dec 2023 05:47:12 -0800 (PST) Received: from [10.137.0.17] (ip-86-49-229-30.bb.vodafone.cz. [86.49.229.30]) by smtp.gmail.com with ESMTPSA id o23-20020aa7d3d7000000b0054ca2e83d4bsm2467449edr.17.2023.12.06.05.47.11 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 06 Dec 2023 05:47:12 -0800 (PST) Message-ID: <86cea9a2-9a79-0228-bae4-287cebe54bc7@enterprisedb.com> Date: Wed, 6 Dec 2023 14:47:11 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.15.1 Subject: Re: logical decoding and replication of sequences, take 2 Content-Language: en-US To: Dilip Kumar , Amit Kapila Cc: "Hayato Kuroda (Fujitsu)" , "Zhijie Hou (Fujitsu)" , Ashutosh Bapat , PostgreSQL Hackers , Masahiko Sawada , Peter Eisentraut References: <36f3a200-f185-887c-da08-fdc866436e6c@enterprisedb.com> <195be236-7580-72c6-97c7-59f06c4e093c@enterprisedb.com> <4954a4f8-ba9d-d352-571b-7b94372ea5ae@enterprisedb.com> <418ff5ac-1664-9038-8ac6-0dd308b5df07@enterprisedb.com> <8a2f25d8-23d4-4ab8-2a23-7c8d2d976209@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 12/6/23 12:05, Dilip Kumar wrote: > On Wed, Dec 6, 2023 at 3:36 PM Amit Kapila wrote: >> >>> Why can't we use the same concept of >>> SnapBuildDistributeNewCatalogSnapshot(), I mean we keep queuing the >>> non-transactional changes (have some base snapshot before the first >>> change), and whenever there is any catalog change, queue new snapshot >>> change also in the queue of the non-transactional sequence change so >>> that while sending it to downstream whenever it is necessary we will >>> change the historic snapshot? >>> >> >> Oh, do you mean maintain different historic snapshots and then switch >> based on the change we are processing? I guess the other thing we need >> to consider is the order of processing the changes if we maintain >> separate queues that need to be processed. > > I mean we will not specifically maintain the historic changes, but if > there is any catalog change where we are pushing the snapshot to all > the transaction's change queue, at the same time we will push this > snapshot in the non-transactional sequence queue as well. I am not > sure what is the problem with the ordering? because we will be > queueing all non-transactional sequence changes in a separate queue in > the order they arrive and as soon as we process the next commit we > will process all the non-transactional changes at that time. Do you > see issue with that? > Isn't this (in principle) the idea of queuing the non-transactional changes and then applying them on the next commit? Yes, I didn't get very far with that, but I got stuck exactly on tracking which snapshot to use, so if there's a way to do that, that'd fix my issue. Also, would this mean we don't need to track the relfilenodes, if we're able to query the catalog? Would we be able to check if the relfilenode was created by the current xact? regards -- Tomas Vondra EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company