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 1wrX8O-000P1E-0s for pgsql-hackers@arkaria.postgresql.org; Wed, 05 Aug 2026 08:37:56 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wrX8M-009bts-0f for pgsql-hackers@arkaria.postgresql.org; Wed, 05 Aug 2026 08:37:54 +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 1wrX5u-008v4I-29 for pgsql-hackers@lists.postgresql.org; Wed, 05 Aug 2026 08:35:22 +0000 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wrTjY-00000000Jf8-3hB7 for pgsql-hackers@lists.postgresql.org; Wed, 05 Aug 2026 05:00:07 +0000 Received: by mail-wr1-x434.google.com with SMTP id ffacd0b85a97d-47f92e3c14bso436165f8f.0 for ; Tue, 04 Aug 2026 22:00:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1785906003; x=1786510803; darn=lists.postgresql.org; h=content-transfer-encoding:content-type:in-reply-to:content-language :references:cc:to:subject:from:user-agent:mime-version:date :message-id:from:to:cc:subject:date:message-id:reply-to:content-type; bh=StU/uN2L9clI1yupMrIWouEz49c8wDMTRfHUG111gWQ=; b=sT/hVn6hME3lNcod5fCISjgMSx8DW5M+QSeI1uhajbJRQwxqqP5VcpRe4KbDGqYMyv Ph8dfHQRNwsvEAYjdQWlk/uOPXoV7hpJEH1a2sKdYO7U6sh6mAY68y/EZIFWe1rn6J2x ecnpYHEM9DrBDlD41+P//S6kFTDz7JpVQYKmP/RFanD290GxXYTth38OyfjtPfbdeNy1 8tjDT4hYla098Q9nVdpCJziXz7x+0BINBQKEPC2Mw7EmTavcnbjmr4XejIeIaVcdDZi9 95G52HXDNPdjZZaDMmwf4HepGyADrdbuycWgXAGBhWq+jag9aidUVJsfzqyJ+m/SOHMg ZeUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785906003; x=1786510803; h=content-transfer-encoding:content-type:in-reply-to:content-language :references:cc:to:subject:from:user-agent:mime-version:date :message-id:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=StU/uN2L9clI1yupMrIWouEz49c8wDMTRfHUG111gWQ=; b=DchtHRA5V81NwEMYcjYbJjiFhiqo8DucBBPSIgWEJjVvBp8yxb5r8GCTmRyANXw87X AYpX/X5sC5i3dXy8N7jcaizgf68z+e6G/m+18EfKfMy0S50VwovhsQuRiMeFknuGJP1T 687KXSccV1E8JdmKIYR7zgaSiMJxxVsFS/JjbrsAPfdFlMrnreWsT+mPFkI9LD+EyG9h 4GZzLfrd5gFCSF4xzmfJn0bt+mBW3kQ2ErrG/PNO7rR5xhuGeHStl2FgwHVDjEcf6qJv W07NvjSQ8miflXGGoy7hp0wCjntXwyGrq3G6CEv5hkZ4FgpdagcK996EdBA542IMpNvI 6d9A== X-Forwarded-Encrypted: i=1; AHgh+RpYgjEHOnunwzY474DcHu8d5En37dU8avaryIVpAZDRe1Ed9j4ZGacnJMtpYvJxbfcz0OFwGjHG+hKR4TUV@lists.postgresql.org X-Gm-Message-State: AOJu0Yyc1CvIErzcoM+Wo0PmKy5uKnVabwdz7F2DcZGShS0Z0M6lIBQA kl5uiCyi01vYZnCtqkTsbocFBpfFiqLwlxaUg+evgHs15Mq3YMG3O2mJ X-Gm-Gg: AR+sD133GBzXrkFVYeW/m17QLD/T4DwuexiMKd2VQEeiLTPryzQR+//vgHcQQXMmCj1 nLjKojnoYDV/68f/CsPTpgKvBEndJD1AMQrvhqoCM5+vA7/esqzg5EJklxwSFYCmOT8agn4Gt8p 9ozApjicSohFtyFNNCokBnS8NQXvVjtPZ0u9ZcXmAr3Fq7SZ+zqf0mlvGoiTVu5ExpWAajVkCUv 756JZwt0JiRxnpcUu6fQvjz5BnPL2n1KFQ5PUIVz9fvPHzD3D+NcWdF50qe/78AOxuUJyIb1CE7 vjQnTo9baiWZPXuQCEg14FkuZ4N0Gtl/TdZmlMgAZO88petgZTtRUL5Pmxd/B+ebunqcad2WVqg Lm8bT2aRzfVlndj5m2U802yPHD8TQvj/btWp+U/vgaYn3Yu5kV+Ds9e2pRK+Z4JxkdfU67ZUcTL fFKbfser25tGDElWrErSpmjhJoq2XW44pKSWiloRQseJivCBWxmuyPULbfFAJlud5z1okD9+IGs g== X-Received: by 2002:a05:6000:1869:b0:47f:f002:3652 with SMTP id ffacd0b85a97d-47ff00236c8mr2397405f8f.12.1785906002447; Tue, 04 Aug 2026 22:00:02 -0700 (PDT) Received: from [192.168.0.50] ([89.149.120.180]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-47fec23e250sm6090107f8f.26.2026.08.04.22.00.01 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 04 Aug 2026 22:00:01 -0700 (PDT) Message-ID: Date: Wed, 5 Aug 2026 08:00:00 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird From: Alexander Lakhin Subject: Re: [bug fix] prepared transaction might be lost when max_prepared_transactions is zero on the subscriber To: "Zhijie Hou (Fujitsu)" , Amit Kapila Cc: "Hayato Kuroda (Fujitsu)" , "pgsql-hackers@lists.postgresql.org" , shveta malik References: Content-Language: en-US In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hello hackers, 23.12.2025 08:42, Zhijie Hou (Fujitsu) wrote: > On Tuesday, December 23, 2025 12:21 PM Amit Kapila wrote: >> +# Test the ability to re-apply a transaction when a parallel apply >> +worker fails # to prepare the transaction due to insufficient >> +max_prepared_transactions # setting. >> +$node_subscriber->append_conf('postgresql.conf', >> >> How does the test ensure that error is raised by parallel apply worker? I see >> that in the previous test, we set 'debug_logical_replication_streaming = >> immediate', so that should help to invoke parallel apply worker. But is there a >> more direct way to ensure the same? Can we test for LOG like: "ERROR: >> logical replication parallel apply worker exited due to error"? > OK, I have added a general log test for "ERROR .. logical replication parallel > apply worker ..." to ensure that it's the parallel apply worker that failed to > apply the transaction. Buildfarm animal olingo discovered a way to break this test, [1]: 400/402 subscription - postgresql:subscription/023_twophase_stream ERROR           230.82s   (exit status 255 or 0xff) [22:24:32.246](0.650s) ok 29 - transaction is committed on subscriber ### Restarting node "subscriber" # Running: pg_ctl --wait --pgdata /home/bf/bf-build/olingo/REL_19_STABLE/pgsql.build/testrun/subscription/023_twophase_stream/data/t_023_twophase_stream_subscriber_data/pgdata --log /home/bf/bf-build/olingo/REL_19_STABLE/pgsql.build/testrun/subscription/023_twophase_stream/log/023_twophase_stream_subscriber.log restart waiting for server to shut down.... done server stopped waiting for server to start.... done server started # Postmaster PID for node "subscriber" is 61596 [22:27:45.401](193.155s) # die: timed out waiting for file /home/bf/bf-build/olingo/REL_19_STABLE/pgsql.build/testrun/subscription/023_twophase_stream/log/023_twophase_stream_subscriber.log contents to match: (?^:ERROR: .*logical replication parallel apply worker.*) at /home/bf/bf-build/olingo/REL_19_STABLE/pgsql/src/test/subscription/t/023_twophase_stream.pl line 460. [22:27:45.401](0.001s) 1..29 timed out waiting for file /home/bf/bf-build/olingo/REL_19_STABLE/pgsql.build/testrun/subscription/023_twophase_stream/log/023_twophase_stream_subscriber.log contents to match: (?^:ERROR: .*logical replication parallel apply worker.*) at /home/bf/bf-build/olingo/REL_19_STABLE/pgsql/src/test/subscription/t/023_twophase_stream.pl line 460. # Postmaster PID for node "publisher" is 54199 ### Stopping node "publisher" using mode immediate pgsql.build/testrun/subscription/023_twophase_stream/log/023_twophase_stream_subscriber.log 2026-08-03 22:24:33.209 CEST [62186][logical replication parallel worker][120/4:730] ERROR:  prepared transactions are disabled 2026-08-03 22:24:33.209 CEST [62186][logical replication parallel worker][120/4:730] HINT:  Set "max_prepared_transactions" to a nonzero value. 2026-08-03 22:24:33.209 CEST [62186][logical replication parallel worker][120/4:730] CONTEXT:  processing remote data for replication origin "pg_16397" during message type "STREAM PREPARE" in transaction 719, finished at 0/01810A18 2026-08-03 22:24:33.211 CEST [61742][logical replication apply worker][119/0:0] ERROR:  logical replication parallel apply worker exited due to error 2026-08-03 22:24:33.211 CEST [61742][logical replication apply worker][119/0:0] CONTEXT:  processing remote data for replication origin "pg_16397" during message type "STREAM PREPARE" in transaction 719, finished at 0/01810A18     logical replication parallel apply worker     processing remote data for replication origin "pg_16397" during message type "STREAM PREPARE" in transaction 719, finished at 0/01810A18 2026-08-03 22:24:33.227 CEST [61596][postmaster][:0] LOG: background worker "logical replication parallel worker" (PID 62186) exited with exit code 1 2026-08-03 22:24:33.250 CEST [62213][logical replication apply worker][121/2:0] LOG:  logical replication apply worker for subscription "tap_sub" has started 2026-08-03 22:24:33.267 CEST [61596][postmaster][:0] LOG: background worker "logical replication apply worker" (PID 61742) exited with exit code 1 2026-08-03 22:24:33.552 CEST [62213][logical replication apply worker][121/0:0] ERROR:  prepared transactions are disabled 2026-08-03 22:24:33.552 CEST [62213][logical replication apply worker][121/0:0] HINT:  Set "max_prepared_transactions" to a nonzero value. 2026-08-03 22:24:33.552 CEST [62213][logical replication apply worker][121/0:0] CONTEXT:  processing remote data for replication origin "pg_16397" during message type "PREPARE" in transaction 719, finished at 0/01810A18 2026-08-03 22:24:33.569 CEST [61596][postmaster][:0] LOG: background worker "logical replication apply worker" (PID 62213) exited with exit code 1 ... 2026-08-03 22:27:44.655 CEST [61596][postmaster][:0] LOG: background worker "logical replication apply worker" (PID 183059) exited with exit code 1 2026-08-03 22:27:45.113 CEST [183345][logical replication apply worker][123/262:0] LOG:  logical replication apply worker for subscription "tap_sub" has started 2026-08-03 22:27:45.154 CEST [183345][logical replication apply worker][123/0:0] ERROR:  prepared transactions are disabled 2026-08-03 22:27:45.154 CEST [183345][logical replication apply worker][123/0:0] HINT:  Set "max_prepared_transactions" to a nonzero value. 2026-08-03 22:27:45.154 CEST [183345][logical replication apply worker][123/0:0] CONTEXT:  processing remote data for replication origin "pg_16397" during message type "PREPARE" in transaction 719, finished at 0/01810A18 2026-08-03 22:27:45.192 CEST [61596][postmaster][:0] LOG: background worker "logical replication apply worker" (PID 183345) exited with exit code 1 2026-08-03 22:27:45.565 CEST [61596][postmaster][:0] LOG:  received immediate shutdown request That is, there is only one "ERROR:  logical replication parallel apply worker exited due to error" in the log, all the following errors are produced not by parallel worker, but by a leader worker... I'm able to reproduce this failure with: --- a/src/test/subscription/t/023_twophase_stream.pl +++ b/src/test/subscription/t/023_twophase_stream.pl @@ -445,2 +445,3 @@ $node_publisher->safe_psql(      INSERT INTO test_tab_2 values(2); +    SELECT pg_sleep(0.5);      PREPARE TRANSACTION 'xact'; Could you have a look, please? [1] https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=olingo&dt=2026-08-03%2020%3A13%3A19 Best regards, Alexander