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.98.2) (envelope-from ) id 1xMMAa-00000001z7Z-3RAa for pgsql-hackers@arkaria.postgresql.org; Thu, 29 Oct 2026 09:11:37 +0000 Received: from localhost ([127.0.0.1]:41976 helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.98.2) (envelope-from ) id 1xMMAZ-00000003cVF-0KqC for pgsql-hackers@arkaria.postgresql.org; Thu, 29 Oct 2026 09:11:35 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]:37596) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1xMMAY-00000003cUz-3Eru for pgsql-hackers@lists.postgresql.org; Thu, 29 Oct 2026 09:11:34 +0000 Received: from mail-wr1-x42d.google.com ([2a00:1450:4864:20::42d]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1xMMAW-00000001Yxd-0ZFF for pgsql-hackers@lists.postgresql.org; Thu, 29 Oct 2026 09:11:34 +0000 Received: by mail-wr1-x42d.google.com with SMTP id ffacd0b85a97d-48b060ec084so1093633f8f.0 for ; Thu, 29 Oct 2026 02:11:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1793265089; x=1793869889; darn=lists.postgresql.org; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:from:to:cc:subject :date:message-id:reply-to:content-type; bh=1r8v0OqUX9zVxVLlaJ/dADp5DGrg+Y7ES5pLXw5p/oU=; b=Bs4lWDwbkOsGDhbCJ1v/Y7yrxGUBJqtm5KV98/PngzOmf20K5VA0wW4azgaqQSPI1A Ambc85WTh6I8egXy/8TylNKxiva6g4pmESfaMAgG8PIFVmrkilhW6jLIVoyflHRB/Ju1 zu/hQ8tknL8YdJbWlms0YJHWx42ngKRx2uwPPk10Fba3Mth/5hT+eweB1fsAJ7RnE4Bg YiQF70iKZuGiDIEfk2kBHFB0Q4OcBi1lDYHuqqjVh27G2OdmY7ilBatSvzV83ybmIjuO KF1uyFYZ+fOCFZo1AWrWdwQs1rGYiUOAVHv0CKRHmmLI/dY+P+D64qo49QBDhyEiPshi XKHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1793265089; x=1793869889; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=1r8v0OqUX9zVxVLlaJ/dADp5DGrg+Y7ES5pLXw5p/oU=; b=WSXz85rxBb3XbJgfzvHykEYgAqXVImKDHLozwKDhk1wdD5gxKSbQRAjkGTLWCHlvHb 3M3LdmTM74WhOtILm9J4ZttuvjLucBQie2nHhfjLnq6/vcSthJPcsjVqtrE8EXUJYOma 5KZL5pKD45hIToIYA97uiYVYW07t24LCt8UsxtCwkN3T6JGLP7vMm3+JtCteRTg2qwxK k1Q+Yd6LLgRtKQv+YDesCSjSt4dHX4KpfzdHkTYvxiT6WgUPZXtnWVZomT2oCIehVpsn iq/46D650nEkksIOHjYc6Sc9LRyx5eGg3edTcTBAgNQ7DNW6eHtSmhnC8wxNhjyVIYvZ 0GPQ== X-Forwarded-Encrypted: i=1; AKwUvBzx47Bvu5KFNMMCD9MzJyE9UlP5fogYcaa2KOeoUjG13yWEeZuQ5sESSmwL2HXpoxTyaiDQOTEesYYL784T@lists.postgresql.org X-Gm-Message-State: AFq9FYJjG16X5kBXZiqDapRJOgw//xKHKWhJxnSsGsue85h+jb1vyQMg E2KTyQk837y22gDmvIVevOUTdKL4w6Z2oZf6OhvRCXxUMyUbp9g+tWDS X-Gm-Gg: AYBFou2Ptk/P9n0VVIgiZ9Mlws7smOlF3ABwA0Gs815wo+A5yUSL0J3LuVH/U6Ytdo2 iGWhLDVc3aywRFDFZiB64Zw0fCLb/0uKBe2mQAsGc2ueaaadJ55bg9xpXjbBRmmQE3f67xGZ4BR k0lWwUyxa5qB5oxtBx1GgpTMFWOrni0WU86LZciRrwqDwupsAiOLQXdPwQrdAgkCM7UquqGAowo 6jmYje9K3+F9nDZGf4NnBrJp2tCLCHCibUtuN3SrzgSzRwLw9rcUELL0jdttMok6hH/zvjDnLHh VqcR2K/Gz9hHU3gDlMBxzDAhCM/ULEISikpYs9JSmtTYq+XMMdC7Yd3fUVoieWXK/XBQRJII++F Qe90r+N5ARDGmjeI63/et3u86Vka6GTtRaC4ffifZiFKnFQ9OOH/jmUh0Oviz8HKdnn5e2Ci0E/ kJJ1/dNV5TUXIPYXTeVgynIFPOriJZaqhVxxiP8YkZTquO5EjuAD6UPoGKoF1YQ8q4MBY3nYd43 238fk0GLqhkX5hpWsn68HqcgooLfyZiEzF0TY0OZaiF6ktFEIlGM7Xd2PuRP/rtRLpoQ5cFJt4/ gCfU7ImM6cgAx+rxMBukzbDP8mCX9ws7U7a5vCffjMl9r0AyKuArJIjq620IDCMbjaqktX0h5iF xjGLUiGF/puVoJ3pU+sgnDZ4nwhYes9jM7A== X-Received: by 2002:a05:600c:1d1a:b0:4a1:fc0a:8b75 with SMTP id 5b1f17b1804b1-4a966d36218mr108342065e9.24.1793265089154; Thu, 29 Oct 2026 02:11:29 -0700 (PDT) Received: from bdtpg (ec2-15-237-197-144.eu-west-3.compute.amazonaws.com. [15.237.197.144]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4aa7fead817sm51349625e9.12.2026.10.29.02.11.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Oct 2026 02:11:28 -0700 (PDT) Date: Thu, 29 Oct 2026 09:11:27 +0000 From: Bertrand Drouvot To: Zhijie Hou Cc: shveta malik , pgsql-hackers@lists.postgresql.org, amit.kapila16@gmail.com, shveta malik Subject: Re: Avoid resetting subscription two_phase state to pending when already enabled Message-ID: References: <8e85abdf-738b-4578-ac42-4dc8eaa061dd@gmail.com> <3ba34b9c-455e-487c-9815-8a7f31297065@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3ba34b9c-455e-487c-9815-8a7f31297065@gmail.com> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, On Thu, Oct 29, 2026 at 03:04:12PM +0800, Zhijie Hou wrote: > Agreed. I adjusted the test order to make it clear. > > Here is the V2 patch. Thanks for the patch! + /* + * Change system catalog accordingly, but do not reset the + * state to PENDING if two_phase is already enabled. + */ + if (!(opts.twophase && + sub->twophasestate == LOGICALREP_TWOPHASE_STATE_ENABLED)) The new condition also preserves 'e' when slot_name changes. In that case, a replacement slot with two_phase=false remains false because the worker does not go through the PENDING state. I reproduced this with: ALTER SUBSCRIPTION sub SET (slot_name = 'replacement', two_phase = true); Should we preserve 'e' only when the slot name is unchanged? Regards, -- Bertrand Drouvot PostgreSQL Contributors Team RDS Open Source Databases Amazon Web Services: https://aws.amazon.com