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 1lZUvr-0001Uw-Tj for pgsql-admin@arkaria.postgresql.org; Thu, 22 Apr 2021 08:43:31 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lZUvq-0000EQ-Gp for pgsql-admin@arkaria.postgresql.org; Thu, 22 Apr 2021 08:43:30 +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 1lZUvp-0000EI-PX for pgsql-admin@lists.postgresql.org; Thu, 22 Apr 2021 08:43:30 +0000 Received: from admin.sibptus.ru ([2001:19f0:5001:21dc::10]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lZUvn-0001ry-6X for pgsql-admin@lists.postgresql.org; Thu, 22 Apr 2021 08:43:28 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sibptus.ru; s=20181118; h=In-Reply-To:Message-ID:Subject:To:From:Date; bh=oss7UC+bkS3La9eqlSLARvha6YfCG4u+XzFeiYxWbBo=; b=EdBStWubWetUV9zTaBJnBlOJZA 03zGmfO3NKuje4FIWu5KFOc6fdcTC5P79Ggk0XCN8yan7bCdsHF7FFhZkTL4dK5kq/ZN1AhxKgONS UXH5VK1Sf1+gVRxpf1HSPUlMD/Jzb3xtAxgvT4iaONb8DkYycoQLzzsx5YJ0z5ETtS0k=; Received: from vas by admin.sibptus.ru with local (Exim 4.94 (FreeBSD)) (envelope-from ) id 1lZUvj-000EDP-Ar; Thu, 22 Apr 2021 15:43:23 +0700 Date: Thu, 22 Apr 2021 15:43:23 +0700 From: Victor Sudakov To: pgsql-admin@lists.postgresql.org Cc: Laurenz Albe Subject: Re: A streaming replica catching up Message-ID: References: <8ec1143e5f1e45714b415076b3ad7533346e2734.camel@cybertec.at> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <8ec1143e5f1e45714b415076b3ad7533346e2734.camel@cybertec.at> X-PGP-Key: http://admin.sibptus.ru/~vas/ X-PGP-Fingerprint: 10E3 1171 1273 E007 C2E9 3532 0DA4 F259 9B5E C634 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Laurenz Albe wrote: > 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. I see. It is also interesting when there is Patroni involved, would it be a good idea to provide Patroni nodes with a restore_command? I'm afraid it can interfere with Patroni failover/switchover operations. -- Victor Sudakov VAS4-RIPE http://vas.tomsk.ru/ 2:5005/49@fidonet