Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fpEJp-0004VA-5o for pgsql-bugs@arkaria.postgresql.org; Mon, 13 Aug 2018 14:59:41 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fpEJl-00074U-Pp for pgsql-bugs@arkaria.postgresql.org; Mon, 13 Aug 2018 14:59:37 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fpEJl-00074N-GA for pgsql-bugs@lists.postgresql.org; Mon, 13 Aug 2018 14:59:37 +0000 Received: from tonga.chezphil.org ([163.172.168.227]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1fpEJi-0005IT-Hh for pgsql-bugs@lists.postgresql.org; Mon, 13 Aug 2018 14:59:36 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=chezphil.org; s=20171026; h=From:Content-Type:MIME-Version:References: In-Reply-To:Message-ID:Subject:Date:Cc:To:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=HoXZNPUm51w02IGQdKdSciF5jQQLlkgQL58bKG77oX4=; b=RsBdYbqlt4rgKK7UBf6K5cddd xd1WRqW5R8f0gKKFu0jHCywsxs5W1FBE1121O7OM5n4Cm8qnOZigPEn0yvZypCXv0LpMRwNHLe3Yg 1zaMNFjxPQYU98zH59fQ42CafnmI182asXZwtTUS4LBObTCN8Ts6nl1/YVOOVTHUneJEk=; Received: from localhost ([127.0.0.1] helo=chezphil.org) by tonga.chezphil.org with esmtp (Exim 4.89) (envelope-from ) id 1fpEJg-0005eg-8u for pgsql-bugs@lists.postgresql.org; Mon, 13 Aug 2018 15:59:32 +0100 Received: from localhost ([::ffff:127.0.0.1]) by tonga with smtp (dmsmtpd 0.00001); Mon, 13 Aug 2018 15:59:32 +0100 To: Cc: "Andres Freund" Date: Mon, 13 Aug 2018 15:59:32 +0100 Subject: Re: BUG #15323: wal_keep_segments must be >= 1 for WAL archiving + streaming to work Message-ID: <1534172372164@dmwebmail.dmwebmail.chezphil.org> In-Reply-To: <20180813144534.piruesukkjw6zl4b@alap3.anarazel.de> References: <20180813144534.piruesukkjw6zl4b@alap3.anarazel.de> X-Mailer: Decimail Webmail 3alpha16 MIME-Version: 1.0 Content-Type: text/plain; format="flowed"; charset="UTF-8" From: "Phil Endecott" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Hi Andres, Andres Freund wrote: > On 2018-08-13 14:37:00 +0000, PG Bug reporting form wrote: >> The following bug has been logged on the website: >> >> Bug reference: 15323 >> Logged by: Phil Endecott >> Email address: spam_from_pgsql_lists@chezphil.org >> PostgreSQL version: 9.6.10 >> Operating system: Debian Stretch >> Description: >> >> I have set up a replication system that uses a combination of WAL segment >> archiving and streaming. >> If the slave goes down for a period, when it restarts it will initially >> fetch WAL segment files from the archive using restore_command. After >> fetching the last of these it will start streaming directly from the >> master. >> It seems that the WAL segment files may have a small empty space at the end >> due presumably to the size of the records. In my case, the last archived >> WAL segment ended at offset 0xFFF088. The slave therefore tried to start >> streaming at that position. But the master had already archived that >> segment and recycled it, because I had not set wal_keep_segments and it >> defaults to 0. Streaming therefore failed to start. > > But it'll retry after failing back to archiving, no? It will retry and keep failing indefinitely if the master is idle. If the master is not idle, it will eventually archive the next segment which the slave will restore. In my case, poking it to make that happen did cause streaming to start successfully - but in general, I think it's still possible that the master will remove the segment that is needed to start streaming. Regards, Phil.