Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.92) (envelope-from ) id 1jBU30-0005RC-UE for pgsql-hackers@arkaria.postgresql.org; Tue, 10 Mar 2020 01:51:07 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1jBU2y-0004eZ-V3 for pgsql-hackers@arkaria.postgresql.org; Tue, 10 Mar 2020 01:51:04 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1jBU2y-0004eS-Ef for pgsql-hackers@lists.postgresql.org; Tue, 10 Mar 2020 01:51:04 +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 1jBU2r-0002Wb-3r for pgsql-hackers@lists.postgresql.org; Tue, 10 Mar 2020 01:51:03 +0000 Received: from hnk.local (p2421237-ipbf2725funabasi.chiba.ocn.ne.jp [122.24.33.237]) by oss.nttdata.com (Postfix) with ESMTPSA id D1B6F600F7; Tue, 10 Mar 2020 10:50:52 +0900 (JST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.101.5 at oss.nttdata.com Subject: Re: Crash by targetted recovery From: Fujii Masao To: Kyotaro Horiguchi Cc: pgsql-hackers@lists.postgresql.org References: <0db8f83f-5b66-75e9-6d99-93f19fc33165@oss.nttdata.com> <20200306.102946.81443433484362211.horikyota.ntt@gmail.com> <00dac90c-c37d-0a99-6d4d-97acb48a06bf@oss.nttdata.com> <20200309.134927.754909343807949809.horikyota.ntt@gmail.com> <203fa5df-f98f-35ac-fea9-2aa2ffcdd31a@oss.nttdata.com> Message-ID: <0e356860-2c03-bfe6-5256-40ac8f0d6333@oss.nttdata.com> Date: Tue, 10 Mar 2020 10:50:52 +0900 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 MIME-Version: 1.0 In-Reply-To: <203fa5df-f98f-35ac-fea9-2aa2ffcdd31a@oss.nttdata.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 2020/03/09 15:46, Fujii Masao wrote: > > > On 2020/03/09 13:49, Kyotaro Horiguchi wrote: >> At Sat, 7 Mar 2020 01:46:16 +0900, Fujii Masao wrote in >>>> (It seems retroverting to the first patch when I started this...) >>>> The second place covers wider cases so I reverted the first place. >>> >>> Thanks for updating the patch that way. >>> Not sure which patch you're mentioning, though. >> >> That meant 0003. >> >>> Regarding 0003 patch, I added a bit more detail comments into >>> the patch so that we can understand the code more easily. >>> Updated version of 0003 patch attached. Barring any objection, >>> at first, I plan to commit this patch. >> >> Looks good to me. Thanks for writing the detailed comments. > > Thanks for the review! Pushed. > > I will review other two patches later. Pushed the v5-0001-Tidy-up-XLogSource-usage.patch! Regarding the remaining patch adding the regression test, +$result = + $node_standby->safe_psql('postgres', "SELECT pg_last_wal_replay_lsn()"); +my ($seg, $off) = split('/', $result); +my $target = sprintf("$seg/%08X", (hex($off) / $segsize + 1) * $segsize); What happens if "off" part gets the upper limit and "seg" part needs to be incremented? What happens if pg_last_wal_replay_lsn() advances very much (e.g., because of autovacuum) beyond the segment boundary until the standby restarts? Of course, these situations very rarely happen, but I'd like to avoid adding such not stable test if possible. Regards, -- Fujii Masao NTT DATA CORPORATION Advanced Platform Technology Group Research and Development Headquarters