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 1t98OY-007yCp-IR for pgsql-general@arkaria.postgresql.org; Thu, 07 Nov 2024 19:42:18 +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 1t98OV-001mA5-UW for pgsql-general@arkaria.postgresql.org; Thu, 07 Nov 2024 19:42:16 +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 1t98OV-001m9w-B3 for pgsql-general@lists.postgresql.org; Thu, 07 Nov 2024 19:42:16 +0000 Received: from mail-lj1-x229.google.com ([2a00:1450:4864:20::229]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1t98OR-000j1z-Fj for pgsql-general@lists.postgresql.org; Thu, 07 Nov 2024 19:42:15 +0000 Received: by mail-lj1-x229.google.com with SMTP id 38308e7fff4ca-2fb443746b8so12149861fa.0 for ; Thu, 07 Nov 2024 11:42:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vt-edu.20230601.gappssmtp.com; s=20230601; t=1731008532; x=1731613332; 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=mXWA57WEJBEg1ujvrnUqIgKQmavGhz9oEhshwu/K0co=; b=gWknRi0cskP40ISluFGfMwhacDwc9KsEPBcUfxq/8KBR7RuWy3jCMjJvNy3gLKpJQr Be9RnKGYl6TadVymWWTAS54coa25iDqmK9skuE/+C0SBHUQ2dHtL54QrGMPQWeGznnhY 8YYq/leKRReiZRknpC5cFXt9wZPbLkbEQQqHze7jgKRPwQSXl7Z1AjnCjSnIcJe0DtjX Jr3iY2U+x4+vDUpX0SfCqwsMI1tEHqesxrXb7C6+mIQFllGAR0FAahmrN6yZY+iqmRig 7ozvfgFCQbFf2m5EPUZ3/+7EXDo3tbhW29yW/Cn5yBd7YIop8fNTdIk7XGYPC/z7TdLh +/gw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731008532; x=1731613332; 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=mXWA57WEJBEg1ujvrnUqIgKQmavGhz9oEhshwu/K0co=; b=OneClcVhqZ1gv1fEHvC6+8dyxSqnSZoY07H/8B6x+FSkZwvZI/LV0Ge9v316RjZqhc gG4HUMp+mB2wBbJdOAvRAShPYYMkVQnFtuFYL6inyGLcqnIhbdDQLL30FcSm2gWalOe/ lbsWH5figDYvcevAsgi7555Y+7a3E+NxzR7rbez0QhDihmkf/z2B2A8NN5ljvOk4fq9C 8vvFbmG98NNE3f0aj3G47QZIHfaanFL2/r2lZ+5JfG2LdPHoW0oZu+X5SiOdOdyCHKnj rgO+Va+ZT98YoNmmaSUWF7QmbDnBI/SUkfmDgp6BR3pFdGupE0M/SJZj+CJ3ZxoVY8qE IMXw== X-Gm-Message-State: AOJu0YyCP2wNWMfutG5AUvOlgWep8vq+XmEmINRpACgc7/0+nbbWw+vj azQIbjMLnsEF+CYfU9I31TDW2pR4dtQLJQwQmdBn8ygVRJ9M8DMgMjEar+1E2TPOZuC9LcSPnnZ O+RaXOpj5OnNj9UYzLHM6CsL+rIghNhftV20DeVsI5X6ZdDr0 X-Google-Smtp-Source: AGHT+IH/pYUMGeQU6O1x7Vi2O7hr4QqCXRL6QT01p34dJxVmoYG5zrNE/2vwM5etntXXNT4GjIQw4Hq27MgMbg3pN6w= X-Received: by 2002:a2e:a888:0:b0:2fb:5014:c963 with SMTP id 38308e7fff4ca-2ff2026a704mr1210261fa.20.1731008531629; Thu, 07 Nov 2024 11:42:11 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Craig McIlwee Date: Thu, 7 Nov 2024 14:42:01 -0500 Message-ID: Subject: Re: Trouble using pg_rewind to undo standby promotion To: =?UTF-8?Q?Torsten_F=C3=B6rtsch?= Cc: pgsql-general@lists.postgresql.org Content-Type: multipart/alternative; boundary="000000000000a19e87062657d490" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000a19e87062657d490 Content-Type: text/plain; charset="UTF-8" > > >> Are you archiving WAL on the promoted machine in a way that your >> restore_command can find it? Check archive_command and archive_mode on the >> promoted machine. >> > > No, the promoted machine is not archiving. How should that work? Is it > OK for a log shipping standby that uses restore_command to also push to the > same directory with an archive_command or would that cause issues of trying > to read and write the same file simultaneously during WAL replay? Or > should I be setting up an archive_command that pushes to a separate > directory and have a restore_command that knows to check both locations? > > Hmm, as I write that out, I realize that I could use archive_mode = on > instead of archive_mode = always to avoid the potential for read/write > conflicts during WAL replay. I can try this later and report back. > Setting archive_mode = on and a restore_command that reads from the WAL archive did the trick. With those changes in place, I was able to successfully run pg_rewind and get the promoted standby back onto timeline 1. Thanks for the tips. Craig --000000000000a19e87062657d490 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

= Are you archiving WAL on the promoted machine in a way that your restore_co= mmand can find it? Check archive_command and archive_mode on the promoted m= achine.

No, the promoted machin= e is not archiving.=C2=A0 How should that work?=C2=A0 Is it OK for a log sh= ipping standby that uses restore_command to also push to the same directory= with an archive_command or would that cause issues of trying to read and w= rite the same file simultaneously during WAL replay?=C2=A0 Or should I be s= etting up an archive_command that pushes to a separate directory and have a= restore_command that knows to check both locations?

Hmm, as I write that out, I realize that I could use archive_mode =3D on= instead of archive_mode =3D always to avoid the potential for read/write c= onflicts during WAL replay.=C2=A0 I can try this later and report back.

Setting archive_mode =3D on = and a restore_command that reads from the WAL archive did the trick.=C2=A0 = With those changes in place, I was able to successfully run pg_rewind and g= et the=C2=A0promoted standby back onto timeline 1.=C2=A0 Thanks for the tip= s.

Craig
--000000000000a19e87062657d490--