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 1vC9u3-009kKi-OO for pgsql-general@arkaria.postgresql.org; Fri, 24 Oct 2025 04:59:51 +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 1vC9u2-00DiM3-Kg for pgsql-general@arkaria.postgresql.org; Fri, 24 Oct 2025 04:59:49 +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 1vC9u2-00DiLv-8Z for pgsql-general@lists.postgresql.org; Fri, 24 Oct 2025 04:59:49 +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.96) (envelope-from ) id 1vC9tz-003vgd-0E for pgsql-general@lists.postgresql.org; Fri, 24 Oct 2025 04:59:48 +0000 Received: by mail-lf1-x12a.google.com with SMTP id 2adb3069b0e04-592fb80c2faso650210e87.2 for ; Thu, 23 Oct 2025 21:59:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec.at; s=google; t=1761281984; x=1761886784; darn=lists.postgresql.org; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:to:from:subject:message-id:from:to:cc:subject:date :message-id:reply-to; bh=vrhKz1QBn7W9eaH37oWgXHFAA6dbWFSad7j1yfMCXrY=; b=g/IbFxiVaIKkMyi5KLOlzrhchpfEf3F8R6EgrVdbcSiUsbLe5cudbXQO0kyuEEeWQ7 D8E2/Goi5aca5In62cIxhbDWJ4cmKAbOtSIpLW8kiKuvsZurr0TYOPyjnZrwi/WvtjCA bbb4CmRXCB4WEwCC1nNiV4432e0xJ6e/7992w5E7KUdj97mk4KRRE8VAk2g0rFBteXzM 6qnd/q0lXqt0gwMxmfCHmu9K0CArBiS5UVjzRI0qhZAx904rz479uldSVIlIYZzF3ll0 q+RT3OffkWRauUdNgvTSycczzqzDEqLVAB06bk+Zbs6CL9qAvdj7uq96NYNDoGmbPkbk vz0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761281984; x=1761886784; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:to:from:subject:message-id:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=vrhKz1QBn7W9eaH37oWgXHFAA6dbWFSad7j1yfMCXrY=; b=rnlie2NOxE/a+f0tmp4eDQj7LFsOMLt8a5o8saPQ7ko95y9ctx74X8cT+Us9jk+Vzq 6sxKTOk/+5oFaqPSCprscWLLDn+LBe0gaSV0HiqBOyvGE4v1D1LsViwlZbLtZ+WkVyXK BcTt7KxEM4pkqh1zlSaf+Nmt4eWrRMiA1gfXw+ElZhJnWKpfs8J5seJtacv1yB9LXjId tftqlC3FGXjNYbA+VDIW4HdkIbc4u4oEWXvELQ6tMViXPncu545orOl65oig8ZTt+aTB iPREsAI6ZCNBZ9/MA1OoIGMHWX4iHd4wOL8UR6dfuN2qdhSLXbBi/nEEGi0uRn7hvTKP yuKQ== X-Forwarded-Encrypted: i=1; AJvYcCVZhB17gzjmwCdByjrEMYhw+0veInc5dIS+DJHu9cLplp3FnRNJZh7bsAidSwEck5ZSVFen6KeSVnsSpDdG@lists.postgresql.org X-Gm-Message-State: AOJu0Yxmp0o6EmnV8NT8wYD6ssB0hHJRREeOoZXTkJfaqba9LXAe7nN9 RnNV3zCiV3jZ50jVSIEfLGXFmgRzTgKHEaySE9vFP4bjZ70FshLDqUTlG8NKS0MQTs4Uq6cHOg2 fUL1DNMM6DQ== X-Gm-Gg: ASbGncskaDgTtdi8IiE1DGZFbciuR4/H2sQUL/eeSBvBgl3cNuQVzzqyrX7Q2mUvyzW bsliVpWPh+0ANxMO8iwa92sFA8TCD+SSsctT9WJiBi46JfgZD0Ep3F65pPH4XCoAMYo2+aL1Xr2 Pz5s9SIQJMRG/tZi4UA9q2iV8JJGmWofRdfky6DPX8U/uDIhDtfVyTRWuSF/CiwZmvOTvRKo/ek wZvUdGerb+PD2erf7uer5GAc2rK8CSzhZHaWi0iAiTyrvixkfldI9dBfvZKKyyP5EFeooHTy8Hv UEjSFpaHgKsRgUPSC3ccYcrL0qTNmyk6NU104MO/OpZQTxiN1fjjZ2h/IXsTaqhrbqK4QSLeTb0 yAjiBQq146ODRIUrydYe6xbTPYTapjoxJ/0i5afL+Hfarml75PffsZs4H1+gP+KhSpUYS0ZzYnn 83ZACVZqqQQqt9IC3RzUvNMFNeBLEXCjV9o92gMG7Rug== X-Google-Smtp-Source: AGHT+IEN7x7dwjazay41oI1Yu51pIgPHp2bbZjg90xom9jOB/T9w6+1dzqzvYZ8Iz1ROBwzp2OMV9A== X-Received: by 2002:a05:6512:639a:10b0:591:eb03:ce34 with SMTP id 2adb3069b0e04-591eb03cf29mr4162721e87.51.1761281984326; Thu, 23 Oct 2025 21:59:44 -0700 (PDT) Received: from laurenz.albe-K4N0CV00F97414D ([159.148.223.130]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-592f4d3a1d8sm1305459e87.111.2025.10.23.21.59.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Oct 2025 21:59:44 -0700 (PDT) Message-ID: <4e68824dfa5242fd0db8a856d47b2411046f6df2.camel@cybertec.at> Subject: Re: could not stat file "pg_wal/RECOVERYHISTORY": No such file or director From: Laurenz Albe To: Dmitry Litvintsev , "pgsql-generallists.postgresql.org" Date: Fri, 24 Oct 2025 07:59:43 +0300 In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.56.2 (3.56.2-2.fc42) MIME-Version: 1.0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Thu, 2025-10-23 at 21:54 +0000, Dmitry Litvintsev wrote: > I have been setting PITR backup off of base backup. Wal files are shipped= to > the host running pg_basebackup pulling backup from master host.=20 >=20 > Once base backup finished I wanted to try recovery.=20 >=20 > I added >=20 > restore_command =3D 'gunzip /data/xlogs/%f.gz > %p' >=20 > (that command is wrapped in a script that checks existence of input and e= xits w/ 0 if it does not as per instructions) >=20 > I see in the log: >=20 >=20 > < 2025-10-23 16:05:30.750 CDT 2876871 > LOG: database system was interr= upted; last known up at 2025-10-23 02:00:41 CDT > < 2025-10-23 16:05:31.582 CDT 2876871 > LOG: could not stat file "pg_wa= l/RECOVERYHISTORY": No such file or directory > < 2025-10-23 16:05:31.582 CDT 2876871 > DETAIL: restore_command returne= d a zero exit status, but stat() failed. > < 2025-10-23 16:05:31.582 CDT 2876871 > LOG: starting archive recovery > < 2025-10-23 16:05:31.583 CDT 2876871 > LOG: starting backup recovery w= ith redo LSN 20975/FE0AC690, checkpoint LSN 20975/FE21CA88, on timeline ID = 4 > < 2025-10-23 16:05:31.586 CDT 2876871 > LOG: could not stat file "pg_wa= l/RECOVERYHISTORY": No such file or directory > < 2025-10-23 16:05:31.586 CDT 2876871 > DETAIL: restore_command returne= d a zero exit status, but stat() failed. > < 2025-10-23 16:05:31.798 CDT 2876871 > LOG: restored log file "0000000= 400020975000000FE" from archive > < 2025-10-23 16:05:31.819 CDT 2876871 > LOG: redo starts at 20975/FE0AC= 690 > < 2025-10-23 16:05:33.927 CDT 2876871 > LOG: restored log file "0000000= 400020975000000FF" from archive >=20 > it seems to be churning on, but I am a bit worried about : >=20 > could not stat file "pg_wal/RECOVERYHISTORY": No such file or directory I read the code, and that means the following: - PostgreSQL tries to restore a *.history file to get the timeline history - it calls "restore_command" to get the next history file and names it RECO= VERYHISTORY locally - "restore_command" exits with a return code 0, but the file is not in "pg_= wal" So it is a way for archive restore to fail, but an unusual way. Normally, you would expect "restore_command" to have created the file if it= returns 0. So you should improve your "restore_command" if you don't want to see that = message. Yours, Laurenz Albe