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 1lZTdt-0006aB-AS for pgsql-admin@arkaria.postgresql.org; Thu, 22 Apr 2021 07:20:53 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lZTdq-0003n5-RW for pgsql-admin@arkaria.postgresql.org; Thu, 22 Apr 2021 07:20:50 +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 1lZTdq-0003my-FI for pgsql-admin@lists.postgresql.org; Thu, 22 Apr 2021 07:20:50 +0000 Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1lZTdn-0001Br-1o for pgsql-admin@lists.postgresql.org; Thu, 22 Apr 2021 07:20:49 +0000 Received: by mail-wr1-x42b.google.com with SMTP id s7so43598566wru.6 for ; Thu, 22 Apr 2021 00:20:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec-at.20150623.gappssmtp.com; s=20150623; h=message-id:subject:from:to:date:in-reply-to:references:user-agent :mime-version:content-transfer-encoding; bh=KLNs7klPugIpGwVrhiwZU0NF/8sMQJ77TVaL9oILoWs=; b=sjadiUQ3qJ1qqZKdvMHZvtECWaxp+daeJydwMpK0+eX95buA3unzTqmRqnUT30lyo6 95PumCnfkuqPrGiUIx45s1VnnvwjzLW8B7FdNNhvhMY8C3qKQztgSe9IIDO58jv+FPxN PX183gqR4kUZCKowhgodSgZKqnSlcYia37TkmXrbqxP2Crh5pl47EwC7wkeUyf8W58QS /Nuev6A/EeTrBpnXcLQkj+bscm1u8h8R4HRgzHUAvsSKCx93ZUn1xS4S5x/NJGWwL5mQ FvTiZ/oFFpdpVqkoTHB5r4MHOs69+3eoSVkOE+bdUCbpGNn+FEmVk26bejJeV0epgSsY Kqug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:subject:from:to:date:in-reply-to :references:user-agent:mime-version:content-transfer-encoding; bh=KLNs7klPugIpGwVrhiwZU0NF/8sMQJ77TVaL9oILoWs=; b=qFhbzLXVsYiX3qkM5H+S137ea3kYNz3k/qILukT1mf0fpHxW7/zYFeiqn6YzN8Bhdu E+j1heNNVgN9/0uffKqAs3fdShwbA/hChAUzEjgEcnPv2uLbSJ7j2McET5PAEkshqFHP vPBz22cJXpIqRPVtiMhmCV1WKBsqcncVO6VvP1N9AfO1ZeKfOBMZ6EGoOqfuzeMtesNo R4NCJ45UzX39tNLdYdmxClzeQAF+f7ED94sOkuX+EZ63KcQf/z+yF9WOc7mIfcxxSVc/ LB2hLp9V4yfQCllRtl44edE0grCKTq984job9EQA/6gpnLly+NYBn8f2H/3XokoKYaDh jViw== X-Gm-Message-State: AOAM532/CFoytdVMCnNV8q4AYwTXNvOL6Tn4wppbkUaEgLgel2gxyzIL A8b3w3HoQQ/Lfk3tcb5x5m/RFej1xybvhA== X-Google-Smtp-Source: ABdhPJzBHLHYe269/od2+lC3tL/zCh+9N1HkjGpiVHbx9K9ql8NeaiahqPS5IQ8lxKS3EcMGz9oLEA== X-Received: by 2002:a5d:4006:: with SMTP id n6mr2318271wrp.240.1619076044454; Thu, 22 Apr 2021 00:20:44 -0700 (PDT) Received: from localhost.localdomain (217-149-164-106.nat.highway.telekom.at. [217.149.164.106]) by smtp.gmail.com with ESMTPSA id a13sm2164405wrs.78.2021.04.22.00.20.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Apr 2021 00:20:44 -0700 (PDT) Message-ID: <8ec1143e5f1e45714b415076b3ad7533346e2734.camel@cybertec.at> Subject: Re: A streaming replica catching up From: Laurenz Albe To: Victor Sudakov , pgsql-admin@lists.postgresql.org Date: Thu, 22 Apr 2021 09:20:43 +0200 In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.36.5 (3.36.5-2.fc32) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Thu, 2021-04-22 at 10:16 +0700, Victor Sudakov wrote: > After a streaming standby has been down for a time, I know of two > options for it to catch up with the master: > > 1. The replica can fetch all the necessary WAL records via the > replication protocol from the master (unless max_slot_wal_keep_size is > not the default -1, all the required WAL archives should be available from > the master). > > 2. The replica can be provided with a restore_command and will fetch > all WAL files from the WAL archive before starting streaming WAL from > the master. > > Which is the preferred way? > > Of course if max_slot_wal_keep_size is limited, the second options seems > the only safe one. > > OTOH, if the master does not write to a WAL archive, only the first > option is left to us. Both methods are equally feasible. Which one you choose depends on your situation, just as you describe in the last two sentences. Yours, Laurenz Albe -- Cybertec | https://www.cybertec-postgresql.com