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 1sFFw6-000WPQ-0p for pgsql-general@arkaria.postgresql.org; Thu, 06 Jun 2024 16:25:58 +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 1sFFw3-001mk7-DP for pgsql-general@arkaria.postgresql.org; Thu, 06 Jun 2024 16:25:56 +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 1sFFw3-001mjz-1I for pgsql-general@lists.postgresql.org; Thu, 06 Jun 2024 16:25:55 +0000 Received: from mail-ot1-x329.google.com ([2607:f8b0:4864:20::329]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1sFFw1-000Jx7-IL for pgsql-general@lists.postgresql.org; Thu, 06 Jun 2024 16:25:55 +0000 Received: by mail-ot1-x329.google.com with SMTP id 46e09a7af769-6f94086e1ccso678550a34.0 for ; Thu, 06 Jun 2024 09:25:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717691152; x=1718295952; darn=lists.postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=XJTim1Y33E5Y8rS2CqLxLNAb1+tO49sZdGauie0/K60=; b=HgsAEFkfoog3mVFOpC56UKuj1QLCI4lCSEkczsGaCAi1D1be2Q+zJAX8uIBjY44FmC OTdH7537WWqA1sumiQG8/DLzz0f08ck5uz6QDtqW4+iEyriKoqQt886DL+cZ2sLwS3C+ D07r0kZIUOchAnz/htYUyoDc6MxeW+dxi3sICDWzdWukyNz0ShcXtKlzHwEm8vT4WAem 8Nom6ITqR/+bgQwvofSE1ZaA4uxXvkIVZXZY5T6rBhE8Cor3t/i3FpliecuxLuIbCUmj PAcZIzKt7UxW3xTxOFWKvb5jGd2dYl/NvUUrg3dSC7cXcRPxqPLhggC/vYCzF7EpP9eO 95aQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717691152; x=1718295952; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=XJTim1Y33E5Y8rS2CqLxLNAb1+tO49sZdGauie0/K60=; b=eta+uaUM0OFDrbhK2g5hX/nEIdkd8NJENX19UTq53TP4aj9S1qOSTJU+92nGLGMRZO YXlVq5cUJNbz76pBCiecDH98IEelTUJSZ8Hq9aOoFSirXuwg42Tl28cobJyp1A1O4t4a 99fTBRQbh2+E0prIsHUM+M3s9RR9LA8oXKyXjQMCClrmzPs1r6s+z5B362Trh5kUL4Xy k+cIY3p1MUOH9aISEjni2e5J2kWPzUiZXnlvEreSMKnhgr6IGmtVoaJ8TrJ5JEkPxTmw O63wa0zUgUcBMSQ+QZjefvUkXp82KPFmkG5gyXFl1/ZzkcW8t1k/7Wlb8yR+Eus8k4fy Vd3w== X-Forwarded-Encrypted: i=1; AJvYcCUp0Ca3bYIi/fgNqYfw9DIPJ1jBQYoT45Wz5XAVRrQBPfa/l+QZafzmiKcj9QCR3wTbcGW9OXiJIYfaoQesVG1dF7Y0Vq8JJPyKzhKQuKnkCZq1 X-Gm-Message-State: AOJu0Yxrvxp4e/x+mvVxnkMsa4T2h404HGyC/pQoslfQ8JjoGsy0VLwJ o4KJLy0rqOrxVkJgbQKLsrwMwo+h9EK2VPnfOdrIY627Bujhc/EV39XCmFU3FrkwzMMkENtPZxZ Sv6bxw45Y63W43Ee0lJUmdLNJ30A= X-Google-Smtp-Source: AGHT+IFXLy+iW6xLTsR7ttFvmKkClAgE/X2Mbp+cUyAXhphWgch2hdN4jdjZlWQ+Be1qAtpk1T+VTSP497QA63XcSrw= X-Received: by 2002:aca:1217:0:b0:3d2:1c0:26c1 with SMTP id 5614622812f47-3d20439ae81mr5917548b6e.25.1717691150245; Thu, 06 Jun 2024 09:25:50 -0700 (PDT) MIME-Version: 1.0 References: <705876869cf3692a7a89e097195b4e502e3348da.camel@cybertec.at> In-Reply-To: <705876869cf3692a7a89e097195b4e502e3348da.camel@cybertec.at> From: Ron Johnson Date: Thu, 6 Jun 2024 12:25:38 -0400 Message-ID: Subject: Re: Logical replication type- WAL recovery fails and changes the size of wal segment in archivedir To: Laurenz Albe Cc: Meera Nair , "pgsql-general@lists.postgresql.org" , Punit Pranesh Koujalgi , B Ganesh Kishan Content-Type: multipart/alternative; boundary="000000000000d82765061a3b2279" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000d82765061a3b2279 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, Jun 5, 2024 at 6:26=E2=80=AFAM Laurenz Albe wrote: > On Wed, 2024-06-05 at 06:36 +0000, Meera Nair wrote: > > 2024-06-05 11:41:32.369 IST [54369] LOG: restored log file > "00000005000000010000006A" from archive > > 2024-06-05 11:41:33.112 IST [54369] LOG: restored log file > "00000005000000010000006B" from archive > > cp: cannot stat =E2=80=98/home/pgsql/wmaster/00000005000000010000006C= =E2=80=99: No such > file or directory > > 2024-06-05 11:41:33.167 IST [54369] LOG: redo done at 1/6B000100 > > 2024-06-05 11:41:33.172 IST [54369] FATAL: archive file > "00000005000000010000006B" has wrong size: 0 instead of 16777216 > > 2024-06-05 11:41:33.173 IST [54367] LOG: startup process (PID 54369) > exited with exit code 1 > > 2024-06-05 11:41:33.173 IST [54367] LOG: terminating any other active > server processes > > 2024-06-05 11:41:33.174 IST [54375] FATAL: archive command was > terminated by signal 3: Quit > > 2024-06-05 11:41:33.174 IST [54375] DETAIL: The failed archive command > was: cp pg_wal/00000005000000010000006B > /home/pgsql/wmaster/00000005000000010000006B > > 2024-06-05 11:41:33.175 IST [54367] LOG: archiver process (PID 54375) > exited with exit code 1 > > 2024-06-05 11:41:33.177 IST [54367] LOG: database system is shut down > > > > Here =E2=80=98/home/pgsql/wmaster=E2=80=99 is my archivedir (the folder= where WAL > segments are restored from) > > > > Before attempting start, size of > > 00000005000000010000006B file was 16 MB. > > After failing to detect 00000005000000010000006C, there is a FATAL erro= r > saying wrong size for 00000005000000010000006B > > Now the size of 00000005000000010000006B is observed as 2 MB. Size of > all other WAL segments remain 16 MB. > > > > -rw------- 1 postgres postgres 2359296 Jun 5 11:34 > 00000005000000010000006B > > That looks like you have "archive_mode =3D always", and "archive_command" > writes > back to the archive. Don't do that. > In fact, don't write your own PITR backup process. Use something like PgBackRest or BarMan. --000000000000d82765061a3b2279 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Wed, Jun 5, 2024 at 6:26=E2=80=AFAM La= urenz Albe <laurenz.albe@cyb= ertec.at> wrote:
On Wed, 2024-06-05 at 06:36 +0000, Meera= Nair wrote:
> 2024-06-05 11:41:32.369 IST [54369] LOG:=C2=A0 restored log file "= ;00000005000000010000006A" from archive
> 2024-06-05 11:41:33.112 IST [54369] LOG:=C2=A0 restored log file "= ;00000005000000010000006B" from archive
> cp: cannot stat =E2=80=98/home/pgsql/wmaster/00000005000000010000006C= =E2=80=99: No such file or directory
> 2024-06-05 11:41:33.167 IST [54369] LOG:=C2=A0 redo done at 1/6B000100= =C2=A0=C2=A0=C2=A0
> 2024-06-05 11:41:33.172 IST [54369] FATAL:=C2=A0 archive file "00= 000005000000010000006B" has wrong size: 0 instead of 16777216
> 2024-06-05 11:41:33.173 IST [54367] LOG:=C2=A0 startup process (PID 54= 369) exited with exit code 1
> 2024-06-05 11:41:33.173 IST [54367] LOG:=C2=A0 terminating any other a= ctive server processes
> 2024-06-05 11:41:33.174 IST [54375] FATAL:=C2=A0 archive command was t= erminated by signal 3: Quit
> 2024-06-05 11:41:33.174 IST [54375] DETAIL:=C2=A0 The failed archive c= ommand was: cp pg_wal/00000005000000010000006B /home/pgsql/wmaster/00000005= 000000010000006B
> 2024-06-05 11:41:33.175 IST [54367] LOG:=C2=A0 archiver process (PID 5= 4375) exited with exit code 1
> 2024-06-05 11:41:33.177 IST [54367] LOG:=C2=A0 database system is shut= down
> =C2=A0
> Here =E2=80=98/home/pgsql/wmaster=E2=80=99 is my archivedir (the folde= r where WAL segments are restored from)
> =C2=A0
> Before attempting start, size of
> 00000005000000010000006B file was 16 MB.
> After failing to detect 00000005000000010000006C, there is a FATAL err= or saying wrong size for 00000005000000010000006B
> Now the size of 00000005000000010000006B is observed as 2 MB. Size of = all other WAL segments remain 16 MB.
> =C2=A0
> -rw------- 1 postgres postgres=C2=A0 2359296 Jun=C2=A0 5 11:34 0000000= 5000000010000006B

That looks like you have "archive_mode =3D always", and "arc= hive_command" writes
back to the archive.=C2=A0 Don't do that.
=C2=A0
In fact, don't write your own PITR backup process.=C2=A0 Use s= omething like PgBackRest or BarMan.

--000000000000d82765061a3b2279--