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 1jKG5C-00021X-I9 for pgsql-bugs@arkaria.postgresql.org; Fri, 03 Apr 2020 06:45:38 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jKG5B-0007a3-El for pgsql-bugs@arkaria.postgresql.org; Fri, 03 Apr 2020 06:45:37 +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 1jKG5B-0007X0-8a for pgsql-bugs@lists.postgresql.org; Fri, 03 Apr 2020 06:45:37 +0000 Received: from oss.nttdata.com ([49.212.34.109]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jKG57-0008G8-Q8 for pgsql-bugs@lists.postgresql.org; Fri, 03 Apr 2020 06:45:35 +0000 Received: from hnk.local (p2421237-ipbf2725funabasi.chiba.ocn.ne.jp [122.24.33.237]) by oss.nttdata.com (Postfix) with ESMTPSA id 8F3D5602EC; Fri, 3 Apr 2020 15:45:31 +0900 (JST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.102.2 at oss.nttdata.com Subject: Re: [BUG] non archived WAL removed during production crash recovery To: Kyotaro Horiguchi , jgdr@dalibo.com Cc: pgsql-bugs@lists.postgresql.org, michael@paquier.xyz References: <20200402154915.4984cff2@firost> <3d543ef2-ae02-5e59-3bfe-b79d00dab360@oss.nttdata.com> <20200402174450.70de9ab5@firost> <20200403.101417.2239113628048167718.horikyota.ntt@gmail.com> From: Fujii Masao Message-ID: Date: Fri, 3 Apr 2020 15:45:31 +0900 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:68.0) Gecko/20100101 Thunderbird/68.6.0 MIME-Version: 1.0 In-Reply-To: <20200403.101417.2239113628048167718.horikyota.ntt@gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 2020/04/03 10:14, Kyotaro Horiguchi wrote: > At Thu, 2 Apr 2020 17:44:50 +0200, Jehan-Guillaume de Rorthais wrote in >> On Thu, 2 Apr 2020 23:55:46 +0900 >> Fujii Masao wrote: >> >> [...] >>>> Well, it seems to me that this is what you suggested few paragraph away: >>>> >>>> «.ready files are removed when either archive_mode!=always in standby >>>> mode» >>> >>> Yes, so I'm fine with that as the first consensus because the behavior >>> is obviously better than the current one. *If* the case where no WAL files >>> should be removed is found, I'd just like to propose the additional patch. >> >> Do you mean to want to produce the next patch yourself? > > No. Fujii-san is saying that he will address it, if the fix made in > this thread is found to be imperfect later. > > He suspects that WAL files should be preserved at least in certain > cases even if the file persists forever, but the consensus here is to > remove files under certain conditions so as not to no WAL file > persists in pg_wal directory. Yes. > Feel free to propose the next version! Yes! BTW, now I'm thinking that the flag in shmem should be updated when the startup process sets StandbyModeRequested to true at the beginning of the recovery. That is, - Add something like SharedStandbyModeRequested into XLogCtl. This field should be initialized with false; - Set XLogCtl->SharedStandbyModeRequested to true when the startup process detects the standby.signal file and sets the local variable StandbyModeRequested to true. - Make XLogArchiveCheckDone() use XLogCtl->SharedStandbyModeRequested to know whether the server is in standby mode or not. Thought? Regards, -- Fujii Masao Advanced Computing Technology Center Research and Development Headquarters NTT DATA CORPORATION