Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pQDFr-0000tO-Cu for pgsql-admin@arkaria.postgresql.org; Thu, 09 Feb 2023 20:10:51 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pQDFp-0006qP-FU for pgsql-admin@arkaria.postgresql.org; Thu, 09 Feb 2023 20:10:49 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pQDFo-0006mL-RJ for pgsql-admin@lists.postgresql.org; Thu, 09 Feb 2023 20:10:49 +0000 Received: from mail-ed1-x52e.google.com ([2a00:1450:4864:20::52e]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1pQDFm-00068e-8s for pgsql-admin@postgresql.org; Thu, 09 Feb 2023 20:10:47 +0000 Received: by mail-ed1-x52e.google.com with SMTP id r3so3067424edq.13 for ; Thu, 09 Feb 2023 12:10:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec-at.20210112.gappssmtp.com; s=20210112; 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=NyUcNUZJFdlDp1WJ1su83bWrKVDc5QQAnludiIULJvI=; b=rbv24mLcnedl/R5jgh69DNHbBzLRaA1EYBNTn+5+UVw8cAPwnDRAB4u0Gcpe+4Rl8P 7rBmERGBxyx3xxeDKYKyNsE+1tQ63yyJpsceb0FY+X8zFC++i25Urwq47xEU24Rm8xHq abh7fTY8g6JFwr71TBwuUX5vbPlKblmB+wLC/npAYoHiDq4wsKIoyknnGlRetlbIVg/+ hRfh24hDTdiRRqz8jpFPrgBivCo7rqLT7oqNjx0qtePVm7EI96fKantcvkWtKhaccJkc 6DzLQqmEJJyn/Z2A2uZG/rzxV2xaWhn4g6L9Pc3daoEW8+rY9bghQs8i/YStGiTcj/cF Id7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=NyUcNUZJFdlDp1WJ1su83bWrKVDc5QQAnludiIULJvI=; b=px+R1rDUhF08H0Vbd4xNWJTVPR6gxUKQw/ft2pJ2LnCauHHCpadqGITAHrLwSn7fF4 yTrhHAhOMdzmt4FnFDFxJMrRG4dItIxbsncO+hNBeTTT3i0LR2UzpAOJQdgOYKSdrsAd QvJaDH2lZAu98EfosgoLaKAI/0v5T/dTL66TB9nnscdQ53TBoP1iy2v548aluXkU1O5i unilzZuTD0OtpZolvl35WExsbM/KTVOnB1hLH59zcc9Wgz36oIyWsqhcG7aXYF9cM46Z z0J7wmzNS9MiEr+5z4zWePb22I61g+sByAkxyOQn45OesqyGakWDcWXfIO2I1v19aErO uZwA== X-Gm-Message-State: AO0yUKV6O5a+8dxoP05e1yQsKXeAdsLWMr2uH93A63CR1b9qXSIZuFhm Ue1pZqhi9e5JZDoqXPwREQq0TWQSHS3Vf+9mZfgO8Q== X-Google-Smtp-Source: AK7set+NrOMTG5P9MoP8RAsEil8F/wTdCxhtr2OC7OeaKVXwMnJW2JVwl15RKcbk5u7lIUzXHGSBCQ== X-Received: by 2002:a50:d71a:0:b0:4ab:15f6:ffcd with SMTP id t26-20020a50d71a000000b004ab15f6ffcdmr6966934edi.39.1675973444639; Thu, 09 Feb 2023 12:10:44 -0800 (PST) Received: from localhost.localdomain (ip5f5aedce.dynamic.kabel-deutschland.de. [95.90.237.206]) by smtp.gmail.com with ESMTPSA id c1-20020a50d641000000b004ab1d683d3dsm1211338edj.32.2023.02.09.12.10.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Feb 2023 12:10:44 -0800 (PST) Message-ID: <2095e0615451e1a5a017a14d829ddda2d59a04b5.camel@cybertec.at> Subject: Re: Cascading Replication - Standby Recovering Faster from Archive rather than Upstream node From: Laurenz Albe To: Tim , posgres support Date: Thu, 09 Feb 2023 21:10:27 +0100 In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.46.3 (3.46.3-1.fc37) MIME-Version: 1.0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Thu, 2023-02-09 at 13:41 -0500, Tim wrote: > We have a cascading replication setup with multiple nodes 2 of which are = in a different > cloud region for DR purposes.=C2=A0 >=20 > DRnode01 > DRnode02=C2=A0 >=20 > They are both standby nodes, DRnode01 only recovers from the archive and = does not connect > to any upstream node for streaming. DRnode02 has the same restore_command= which points to > that WAL archive, but it is also configured with primary_conninfo to stre= am from DRnode01. > I'd like it to just WAL stream instead of using the archive, but it just = ends up recovering > slightly faster from the archive than DRnode01 can send WALs so the logs = end up being > spammed with=C2=A0 >=20 > > 2023-02-09 13:32:00 EST [1277714]: [1-1] user=3D,db=3D,app=3D,client=3D= LOG:=C2=A0 started streaming WAL from primary at 74CC/B5000000 on timeline= 33 > > 2023-02-09 13:32:00 EST [1277714]: [2-1] user=3D,db=3D,app=3D,client=3D= FATAL:=C2=A0 could not receive data from WAL stream: ERROR:=C2=A0 requeste= d starting point 74CC/B5000000 is ahead of the WAL flush position of > > this server 74CC/B4FFFA08.=C2=A0 >=20 > pg_wal_replay_pause() does not work, it ends up in the same situation aft= er resuming. > Changing restore_command requires a restart and turning it off altogether= is not good > for DR. >=20 > I cannot get it out of this loop and this has been a recurring issue for = a while.=C2=A0 >=20 > Is there anything I can do to force to WAL stream instead of recovering f= rom the archive > without removing the restore_command setting? My idea: - On DRnode01, set "archive_mode =3D always" and configure an "archive_comm= and" that copies WAL segments to a directory shared with DRnode02 (e.g. via NFS) - DRnode02 has "primary_conninfo" that connects to DRnode01 and a "restore_= command" that copies WAL segments from the shared directory. - DRnode02 has an "archive_cleanup_command" that removes WAL segments that = it no longer needs from the shared directory. Yours, Laurenz Albe