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.96) (envelope-from ) id 1vam1G-00DS3X-1P for pgsql-hackers@arkaria.postgresql.org; Wed, 31 Dec 2025 02:33:03 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vam1F-005FVO-0h for pgsql-hackers@arkaria.postgresql.org; Wed, 31 Dec 2025 02:33:02 +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.96) (envelope-from ) id 1vam1E-005FVA-2x for pgsql-hackers@lists.postgresql.org; Wed, 31 Dec 2025 02:33:01 +0000 Received: from mail-pf1-x434.google.com ([2607:f8b0:4864:20::434]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vam1A-003fMy-21 for pgsql-hackers@lists.postgresql.org; Wed, 31 Dec 2025 02:33:01 +0000 Received: by mail-pf1-x434.google.com with SMTP id d2e1a72fcca58-803474aaa8bso3772806b3a.0 for ; Tue, 30 Dec 2025 18:32:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1767148374; x=1767753174; darn=lists.postgresql.org; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=ggTd1rrnkaiITC01bV9WlnIG311SIFANywk7FiPvoXI=; b=T2wZVu1a/7Iu44ELlKohiW8jd7htV/r38kPxr/2+4mWWbJY7QGu0xaQOU1jQfWV6Au Sl5s1x2BOipFwRsbSP+Ds5JAoVzfuyhgLka4UBjb9MaLbONiDQmxnDBbKQJx7EFTeGpp ilYU0HgkX303Hlia4NyLmxL4oD+tqIupCk+Po7VjqqDlsiTkiEUOoMKs+dWZIJ8vnTuH ZDyw9oDoLIfymwnYaDwd7sgOuy1MxhjUt79LqRqfPA0OvjpwmKtnpc9qobhUHFlboCYy Y4OHardwFo0hGvzz5PMqTZt9xYQWCaoTo+dEIqoximlH0f9wCNeMkqNTPNBOyUqR5Jio YJfQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1767148374; x=1767753174; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-gg:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=ggTd1rrnkaiITC01bV9WlnIG311SIFANywk7FiPvoXI=; b=v7bA/O+sylF9jcRugfG6EYAsbdpDDx9ziI3lYfUNUh0NmZMz/EP5DJBPsZ9+8qfeHp o601Y/4lXQk2TuiRg6SKSIqSn7XL205mEiQbAAmS9lG3JS3Mw8wxhX6uS1ow860qrl3L fxcecaHYO8j27B7c3Az4LuxLjcqeQqnToshlvqIpbimhQG1anBrP5MGd44amM+DbpVli 0LKvG6QOkpOO98NixxykZnQ5Fr1aW5qzeoDfVQSOjgIKU45bG+XNUvRSJ1xTaRAnW/Eu pF60cRCads0aResdXUEk4gPNnayfypI9blqWy7ydbkfohCQCcFhvUUEJMq/GeYQabPpJ t8Rg== X-Gm-Message-State: AOJu0YwSIZeYmYh3R05nXfGPwm796HbZ/C+KCYIgMV7vjyGSfwDkxB9T OfEwDxTqOVe0s8rXiPsvr8IG/b/taxs7K2UJB73IqupsjXfF2gxfKuig X-Gm-Gg: AY/fxX73RjdIb5XoRxymAJ4VqqIvMkga0rUhRToTRq9ZbyG8mNl6/r922I+BSwL5JsV sl0NE9NyXAkIWwusARiGplu8HuHfGsWiA8JtecM3FArrqKB7NuPYyv7w61t2k8IfTc5Bbaara0h skLUGVQOBnyD81AsK3OXGMKcJWBmusi9Ld+mHgXk3EHbVs5udcmdfVjzaXCAZy6hluKuQsjRJn1 zKScwE6iTWvsb/zZoraJP5UrAV/4ocLiRTx/RNS8a7e8X2PQjFMib76q6CTfH/1JvN0000Enmmq q/zYQKMX0AQ4XTMaNkLiuK3mQ9YzUdzjBnzdXFa48YVHxLoeIktuUMmz5DoP2EPdPcv7VXFewDf l6iDFUchqvoCWxMemlz8qgp6gT4Y8rBJ5wKVMJ2OwpPsPWxgpEBlAnYuYWTlbP/72bv8xJj7m0k 7mF0FyDfxmQy7/aKfi3rxi X-Google-Smtp-Source: AGHT+IF8/2lAZrqhUTs+FoZQDWxlP0O+qNT+0VMBp1qmFAmdE3GQhPpPIpo3PqXbgAImknwud5zFYQ== X-Received: by 2002:aa7:930d:0:b0:781:1110:f175 with SMTP id d2e1a72fcca58-7ff5330cca8mr37525341b3a.14.1767148374398; Tue, 30 Dec 2025 18:32:54 -0800 (PST) Received: from smtpclient.apple ([185.135.79.161]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7ff7e682870sm33677121b3a.57.2025.12.30.18.32.52 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 30 Dec 2025 18:32:53 -0800 (PST) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3826.700.81\)) Subject: Re: Wrong comment for ReplicationSlotCreate From: Chao Li In-Reply-To: Date: Wed, 31 Dec 2025 10:32:17 +0800 Cc: Postgres hackers Content-Transfer-Encoding: quoted-printable Message-Id: References: <00DB978B-828D-44FE-8A0B-1643CE03878E@gmail.com> To: Daniil Davydov <3danissimo@gmail.com> X-Mailer: Apple Mail (2.3826.700.81) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > On Dec 30, 2025, at 18:07, Daniil Davydov <3danissimo@gmail.com> = wrote: >=20 > Hi, >=20 > On Tue, Dec 30, 2025 at 4:18=E2=80=AFPM Chao Li = wrote: >>=20 >> But I think the updated version is too simple. It loses the = information that enabling two_phase later can result in missing PREPARE. >>=20 >> So, I would suggest something like: >> ``` >> * two_phase: If enabled, allows decoding of prepared transactions. >> * Note that enabling this option after decoding has already = advanced >> * may result in missing PREPARE records for transactions that = were >> * prepared before the option was enabled. >>=20 >> ``` >=20 > Thanks for the review! >=20 > As far as I understand, if the publisher prepares a transaction and > then subscriber > tries to create a subscription, walsender will wait until the prepared > transaction is > finished (during execution of CREATE_REPLICATION_SLOT command). > We can find this logic inside the SnapBuildFindSnapshot function. = Thus, we > cannot miss any PREPARE record for the created slot. >=20 > Am I missing something? >=20 > -- > Best regards, > Daniil Davydov You=E2=80=99re right that during CREATE_REPLICATION_SLOT, = SnapBuildFindSnapshot() ensures we don=E2=80=99t miss PREPARE records = for prepared transactions that exist at creation time. 1462aad2e introduced support for altering logical replication slot = options, including two_phase, after the slot has been created. The = commit comment says: ``` Changing the 'two_phase' option for a subscription from 'true' to = 'false' is permitted only when there are no pending prepared transactions corresponding to that subscription. Otherwise, the changes of = already prepared transactions can be replicated again along with their = corresponding commit leading to duplicate data or errors. ``` true->false is not allowed, however false->true is permitted. So, I = think the old comment is still possible today: ``` * Note that enabling this option after decoding has already advanced * may result in missing PREPARE records for transactions that were * prepared before the option was enabled. ``` Best regards, -- Chao Li (Evan) HighGo Software Co., Ltd. https://www.highgo.com/