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 1g51ZA-0004WM-Do for pgsql-bugs@arkaria.postgresql.org; Wed, 26 Sep 2018 04:36:48 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1g51Z6-0007fC-4g for pgsql-bugs@arkaria.postgresql.org; Wed, 26 Sep 2018 04:36:44 +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 1g51Z5-0007f4-N3 for pgsql-bugs@lists.postgresql.org; Wed, 26 Sep 2018 04:36:43 +0000 Received: from sraihb2.sra.co.jp ([202.32.10.6]) by makus.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1g51Z1-0006PY-Vj for pgsql-bugs@lists.postgresql.org; Wed, 26 Sep 2018 04:36:41 +0000 Received: from srascf.sra.co.jp (srascf [133.137.8.80]) by sraihb2.sra.co.jp (Postfix) with ESMTP id F13D22A15B6 for ; Wed, 26 Sep 2018 13:36:37 +0900 (JST) Received: from srascb.sra.co.jp (unknown [133.137.8.65]) by srascf.sra.co.jp with smtp id 3e6c_0d0b_a08daebb_8e28_4a6c_b854_0c7d2df2a7de; Wed, 26 Sep 2018 13:36:37 +0900 Received: from sranhm.sra.co.jp (osspc25 [133.137.174.97]) by srascb.sra.co.jp (Postfix) with ESMTP id CFF822D6943 for ; Wed, 26 Sep 2018 13:36:37 +0900 (JST) Received: from harukat-PC (dhcp-175-150.sra.co.jp [133.137.175.150]) by sranhm.sra.co.jp (Postfix) with SMTP id A3C43A109D; Wed, 26 Sep 2018 13:36:37 +0900 (JST) Date: Wed, 26 Sep 2018 13:36:40 +0900 From: TAKATSUKA Haruka To: Michael Paquier Cc: pgsql-bugs@lists.postgresql.org Subject: Re: BUG #15402: Hot standby server with archive_mode=on keeps initial WAL segments Message-Id: <20180926133640.99bfbc7ea82f71aa91a02c11@sraoss.co.jp> In-Reply-To: <20180926035205.GJ1659@paquier.xyz> References: <15402-a453c90ed4cf88b2@postgresql.org> <20180926035205.GJ1659@paquier.xyz> Organization: SRA OSS, Inc. X-Mailer: Sylpheed 3.5.1 (GTK+ 2.24.23; i686-pc-mingw32) Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-2022-JP Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Hello Michael, Firstly, I will tell the reproduce steps. On Wed, 26 Sep 2018 12:52:05 +0900 Michael Paquier wrote: > On Wed, Sep 26, 2018 at 03:26:50AM +0000, PG Bug reporting form wrote: > > A hot standby server with “archive_mode = on” keeps initial WAL segment > > files that copied by pg_basebackup. It shows the following status. > > 000000010000000000000042 will be kept forever in this case. > > How did you find yourself in this situation? Did you take a base backup > from a primary which had .ready files in it, and those got copied to the > standby's data folder? We may want to study the possibility of > filtering things when taking a base backup instead. I can reproduce it by this steps. $ pg_basebackup -D data_standby -R -Xs $ pg_ctl start -D data_standby -o '-p 5433' $ pgbench -i ; pgbench -i ; pgbench -i $ psql -c 'checkpoint' ; psql -p 5433 -c 'checkpoint' $ ls data_standby/pg_wal ; ls data_standby/pg_wal/archive_status/ postgresql.conf: archive_mode = on archive_command = 'cp %p /tmp/arc/%f' max_wal_size = 160MB There are no .ready files right after pg_basebackup. It will be generated after the replication starts. Thnaks, Haruka Takatsuka > > Though I understand renaming the .ready to .done manually can clean it, > > I would like to fix the server code like the following patch. > > I'd appreciate if you would consider that. > > Your patch looks incorrect to me to begin with... What if archive_mode > is switched from "on" to "always" back-and-forth and there some of the > past segments which should be archived are not? > -- > Michael