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 1sqRFx-009jq0-A5 for pgsql-hackers@arkaria.postgresql.org; Tue, 17 Sep 2024 06:00:10 +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 1sqRFw-005LNM-Uq for pgsql-hackers@arkaria.postgresql.org; Tue, 17 Sep 2024 06:00:08 +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 1sqRFw-005LN0-J1 for pgsql-hackers@lists.postgresql.org; Tue, 17 Sep 2024 06:00:08 +0000 Received: from mail-lf1-x12a.google.com ([2a00:1450:4864:20::12a]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1sqRFs-001bBU-CU for pgsql-hackers@lists.postgresql.org; Tue, 17 Sep 2024 06:00:07 +0000 Received: by mail-lf1-x12a.google.com with SMTP id 2adb3069b0e04-5365cf5de24so6645911e87.1 for ; Mon, 16 Sep 2024 23:00:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1726552804; x=1727157604; 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=yB/JBOFMByhSk7fSlEHLnMGTbyQO6fziJ8uchgqquJg=; b=AmKL/QwZHKwc/0KbDBgHKSO+r8OxI5HIazcRa8BQNfHsR4mUW19FZKFUN+Gii9H+n8 QrUJ2aFE1AkkKRjLh/ZVzQBxk/dcptuZw4phKB4H2J6naMDEXE+WRQrG8a3X1FBx29Q1 mUEMqobiPqJPOK8PlI4fQhzIMtdk9FaF6GIb0MFFvw7w+M4T0ce5HiUWJBIdvWS+MebA 0tjaB74mxbmawEtYn5srkOn03Z8g5ANgqy0/44qA0XmZx0R1o7wkILhK2N5/H78ZPLjv JiiGgEp8io7cZYx9EULrzAFZUtP/AZKnBENNw8gDSNGcwfVwEcAlRMScTSBbQoq6gGHx tO1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726552804; x=1727157604; 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=yB/JBOFMByhSk7fSlEHLnMGTbyQO6fziJ8uchgqquJg=; b=FwSSfoJKlTukXAvdV6rYWl62dWfQZtJCaKdq2kkAR4c7hi3/4uX6CYLuHR30bjxjrY Rqc1vAmcQbLIGjlDFUY4T//KKmFcSBXdfx+Q44jIaaVaKHmd6s+HHLb0UyOxNrCfpdcZ PBPwVil/VMXqbdwzG/+z7mBbff16WkpFqMFSTjyEMfcZO/Sjw88IZ582FhN3tlCt4vng KouVYrjEZRB5Ff9O52oBCUkRp6HggPGaLqUgM44bUrC1k6ZlZEdCEOr12kvEXEMMw60z WW4ZXPyIQ0s+w6D+crR/K8ZkOVLjocPX+jIOSm/rIbv8ZJax0TXpPZcFrpg00EOlKH3K lJTw== X-Forwarded-Encrypted: i=1; AJvYcCVBwLVyCEjpk+o5ySm+kyWiQEpBe3QB1J+otsdiiD2Z56kNyRqeEpvJq4+5pK4iMJcxLiplzTMkn9/oj4F1@lists.postgresql.org X-Gm-Message-State: AOJu0YxWoXPSZRD30r++xhvjbgyhc/o9Xt8wDkjW76vKXoEoVi9BxwpK ONWJJKZbkLh8OHHDXWMFQkxRP2Kk0AV2yWb1Ko2xCDRRtkq/ZmX/ X-Google-Smtp-Source: AGHT+IGidSfqzczQf2JcfmsOsRAiyOdL0JeiH42q8JEOhlnMMWKe/XV9d6p9gLGGjL73umtx+N6qFg== X-Received: by 2002:a05:6512:224f:b0:52f:c13f:23d2 with SMTP id 2adb3069b0e04-53678fbf051mr9192875e87.25.1726552803294; Mon, 16 Sep 2024 23:00:03 -0700 (PDT) Received: from [1.0.0.7] ([91.185.76.62]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-53687046852sm1076692e87.44.2024.09.16.23.00.01 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 16 Sep 2024 23:00:02 -0700 (PDT) Message-ID: <4a7b82d8-17ad-83ae-4aa1-563c3c64c4c3@gmail.com> Date: Tue, 17 Sep 2024 09:00:00 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Subject: Re: [HACKERS] make async slave to wait for lsn to be replayed Content-Language: en-US To: Alexander Korotkov Cc: Kevin Hale Boyes , Kartyshov Ivan , Kyotaro Horiguchi , hlinnaka@iki.fi, alvherre@alvh.no-ip.org, pashkin.elfe@gmail.com, bharath.rupireddyforpostgres@gmail.com, euler@eulerto.com, thomas.munro@gmail.com, peter@eisentraut.org, amit.kapila16@gmail.com, dilipbalaut@gmail.com, smithpb2250@gmail.com, pgsql-hackers@lists.postgresql.org References: <20240620.173045.1163445432733259320.horikyota.ntt@gmail.com> <8d0286f9f0c2f9fc29794dda6b5f4600@postgrespro.ru> <1d7b08f2-64a2-77fb-c666-c9a74c68eeda@gmail.com> From: Alexander Lakhin 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 Hi Alexander, 16.09.2024 21:55, Alexander Korotkov wrote: > Please find two patches attached. The first one does minor cleanup > including misuse of words you've pointed. The second one adds missing > wait_for_catchup(). That should fix the test failure you've spotted. > Please, check if it fixes an issue for you. Thank you for looking at that! Unfortunately, the issue is still here — the test failed for me 6 out of 10 runs, as below: [05:14:02.807](0.135s) ok 8 - got error after standby promote error running SQL: 'psql::1: ERROR:  recovery is not in progress HINT:  Waiting for LSN can only be executed during recovery.' while running 'psql -XAtq -d port=12734 host=/tmp/04hQ75NuXf dbname='postgres' -f - -v ON_ERROR_STOP=1' with sql 'CALL pg_wal_replay_wait('0/300F248');' at .../src/test/recovery/../../../src/test/perl/PostgreSQL/Test/Cluster.pm line 2140. 043_wal_replay_wait_standby.log: 2024-09-17 05:14:02.714 UTC [1817258] 043_wal_replay_wait.pl ERROR: recovery is not in progress 2024-09-17 05:14:02.714 UTC [1817258] 043_wal_replay_wait.pl DETAIL:  Recovery ended before replaying target LSN 2/570CD648; last replay LSN 0/300F210. 2024-09-17 05:14:02.714 UTC [1817258] 043_wal_replay_wait.pl STATEMENT:  CALL pg_wal_replay_wait('2/570CD648'); 2024-09-17 05:14:02.714 UTC [1817155] LOG:  checkpoint starting: force 2024-09-17 05:14:02.714 UTC [1817154] LOG:  database system is ready to accept connections 2024-09-17 05:14:02.811 UTC [1817270] 043_wal_replay_wait.pl LOG: statement: CALL pg_wal_replay_wait('0/300F248'); 2024-09-17 05:14:02.811 UTC [1817270] 043_wal_replay_wait.pl ERROR: recovery is not in progress pg_waldump -p .../t_043_wal_replay_wait_primary_data/pgdata/pg_wal/ 000000010000000000000003 rmgr: Transaction len (rec/tot):     34/    34, tx:        748, lsn: 0/0300F1E8, prev 0/0300F1A8, desc: COMMIT 2024-09-17 05:14:01.654874 UTC rmgr: Standby     len (rec/tot):     50/    50, tx:          0, lsn: 0/0300F210, prev 0/0300F1E8, desc: RUNNING_XACTS nextXid 749 latestCompletedXid 748 oldestRunningXid 749 I wonder, can you reproduce this with that bgwriter's modification? I've also found two more "achievements" coined by 3c5db1d6b: doc/src/sgml/func.sgml:   It may also happen that target lsn is not achieved src/backend/access/transam/xlog.c-       * recovery was ended before achieving the target LSN. Best regards, Alexander