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 1wxRf5-002ip5-3A for pgsql-hackers@arkaria.postgresql.org; Fri, 21 Aug 2026 16:00:07 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wxRf4-00E5Fb-2p for pgsql-hackers@arkaria.postgresql.org; Fri, 21 Aug 2026 16:00:06 +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 1wxRf4-00E5FT-1q for pgsql-hackers@lists.postgresql.org; Fri, 21 Aug 2026 16:00:06 +0000 Received: from mail-ed1-x530.google.com ([2a00:1450:4864:20::530]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wxRf2-00000000WtN-1by1 for pgsql-hackers@postgresql.org; Fri, 21 Aug 2026 16:00:06 +0000 Received: by mail-ed1-x530.google.com with SMTP id 4fb4d7f45d1cf-6a156627e22so4289635a12.1 for ; Fri, 21 Aug 2026 09:00:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1787328003; x=1787932803; darn=postgresql.org; h=content-transfer-encoding:content-type:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:from:to:cc:subject:date:message-id:reply-to :content-type; bh=WqeR1SENCpmyllatrSEvQG81CfYRkifxo18+0cM/TZo=; b=L8IruoMkHzgARruAL6/tl+ixFgnhY1m8Oxz47U8T7kGMZc9FCeVp5b91XHUixbwK6c 4m+iU1dg8OPu0VQqqMnmYhRqrfGwI0qxer28pKG3T5E/sIxjZTU5ry3ZIAEKC5yxgTBm YSugkZK6IRh0xbqxWOjJAl9c94aE+AcVxplLfoLfMnBy7XYHhYaWswcPCwu8Lp7b6/Y7 CBW7GVWL/RgN4gWiyg2ZrsC2mBn+ElGONIvbm90oniTSUpkPUxUDupGaGR8bNRGUPhBy rS/qzK7bSCP0rj3s8DDEKoFvGRqcb1EMrdtOp4UZw/z8m1tpcvQOLJbpRoXrD3na+NEf 8CTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787328003; x=1787932803; h=content-transfer-encoding:content-type:in-reply-to:from :content-language:references:cc:to:subject: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=WqeR1SENCpmyllatrSEvQG81CfYRkifxo18+0cM/TZo=; b=cWDtY2UuEPmKjn2rK4l2gSyakR4+9knLlTktdzl6Y6iqw2oZgYmc/W4edtnxTp/46x cGY3UHPq0OvlhujbfQ8HK79GIEAUK6kIt8NPXmjHBWe3r3aaac10559G17qcHJZ4CE0g AGudEYw71R2nJkgJoIxbAlP2ljK29wW8yxbBNSjh4AMqUi//75va/vJRVpcP+O7NiD2T nEnTZiXPR2XeDt7dydj1DfFMwPgiJMyh4BzbaPbFdLkE7MqcRAFG29lV5IjPe0Ospbnq pIoT5GpfQd49lz7cstH5l0nWMPxqNwagU6oQRqhDcuEU+L99lbPZx+vz8MuTgXuaq/d5 DFnQ== X-Forwarded-Encrypted: i=1; AHgh+RoerXfBcYZOreRinPV9mCUSmG7uj9W4xG1jC9bbyvmQe0ndcK6HxfcK/gsA/M4S10YihGaverTq0mFbB+08@postgresql.org X-Gm-Message-State: AFuF++li9vLbw3quogTbz3rZ/oM+HYNUWxEFF5Y8hEKBaKiUybG9Mk3C yjBkxPwwYFpwSjxPZyIzO56r3QRN1NDpNdJnG/6jjGxY8gP+nXq0qMSs4xkopw== X-Gm-Gg: AR+sD13wuQgC8Wb3E5qPtroltLRlDiWG2WlUSyVPJCBOHAB87C72D1tUO5E4hOJBi9i oecfTDtFao4Vj/pAM3UDBLOqbuIWeY0RRp/5MXHJdVBLQRRlyYdFroV+FbkzWDYDpGuBbym7qKh +J2XsuTt6pS3VJ6yzWCIpnBqffwLYrfR9jdthVhfPSlhKY6Txk2QZzU5EHXCsMvfbllj7+/++TH 98RNPbUyDemL2nsOxbEdbLwtiVE5jtcuNWR9bPO12URX8A8DSiXqgv6IV027auemMuxzHR6z7fn EMZT5R92bI9JmfIhwp/Q/HfZtx30b4QPozoLj5IXmGANVhfu+XNOk+1pfE1mriSKpKxIcTTMTSE QC/kDlRWZPqAVF3+akeENOco4lASyENfU+77pEZD/avHScBkB1SzmecyKGMUzGSBk5Ngz3quJH/ dzgTo1GribS2oFackgAJkZMOp5Fp7JmRERfNENVNbieWRunxtXLkJKe+iCaUSRkwwv9+K/d3XUG A== X-Received: by 2002:a17:907:3e89:b0:c21:7c98:d9ec with SMTP id a640c23a62f3a-c244d6349a2mr1190106066b.5.1787328003017; Fri, 21 Aug 2026 09:00:03 -0700 (PDT) Received: from [192.168.0.50] ([89.149.120.180]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-c245921e461sm583450666b.54.2026.08.21.09.00.01 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 21 Aug 2026 09:00:02 -0700 (PDT) Message-ID: Date: Fri, 21 Aug 2026 19:00:00 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: walsummarizer can get stuck when switching timelines To: Andrey Borodin Cc: Robert Haas , "Zhijie Hou (Fujitsu)" , Amit Kapila , "pgsql-hackers@postgresql.org" References: <820AC023-9025-43A4-ABDD-F6FB96C53C56@yandex-team.ru> <294c42ea-2608-4bae-93de-6c1ba5f72107@gmail.com> <417c58cc-284b-4280-8c6f-1c18e0b2a317@gmail.com> <55A6AB0E-D4A8-43CD-B79B-2CD5D5828C45@yandex-team.ru> Content-Language: en-US From: Alexander Lakhin In-Reply-To: <55A6AB0E-D4A8-43CD-B79B-2CD5D5828C45@yandex-team.ru> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi Andrey, 20.08.2026 21:43, Andrey Borodin wrote: > I think you are right. The test records node1_final_lsn after waiting > for node2 to catch up. Any WAL generated on node1 between those two > operations can therefore move node1_final_lsn past the point from which > node2 is later promoted. > > Perhaps we should instead obtain the LSN together with the operation > whose WAL we want node2 to replay, and only then wait for catchup: > > my $node1_final_lsn = $node1->safe_psql('postgres', < CREATE TABLE dummy (); > SELECT pg_current_wal_insert_lsn(); > EOM > $node1->wait_for_replay_catchup($node2); > > This way node1_final_lsn identifies the position immediately after the > test's own pre-promotion WAL, and wait_for_replay_catchup() guarantees > that node2 has replayed at least that far. Any WAL generated on node1 > afterwards can no longer move the reference point past node2's fork > point. > > WDYT? > I wonder if $node1_final_lsn should be pg_current_wal_flush_lsn instead of pg_current_wal_insert_lsn. I've tried flush_lsn and it seems to fix the issue, but I'm not sure if it's correct test-wise. Best regards, Alexander