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 1j7Bv4-0001de-0P for pgsql-hackers@arkaria.postgresql.org; Thu, 27 Feb 2020 05:41:10 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1j7Bv2-0004pB-5t for pgsql-hackers@arkaria.postgresql.org; Thu, 27 Feb 2020 05:41:08 +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 1j7Bv1-0004p4-QC for pgsql-hackers@lists.postgresql.org; Thu, 27 Feb 2020 05:41:07 +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 1j7Buu-0005dV-Oq for pgsql-hackers@lists.postgresql.org; Thu, 27 Feb 2020 05:41:06 +0000 Received: from hnk.local (sp49-97-94-11.msc.spmode.ne.jp [49.97.94.11]) by oss.nttdata.com (Postfix) with ESMTPSA id 65E0A6022C; Thu, 27 Feb 2020 14:40:56 +0900 (JST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.101.5 at oss.nttdata.com Subject: Re: Crash by targetted recovery To: Kyotaro Horiguchi , pgsql-hackers@lists.postgresql.org References: <20200227.124830.2197604521555566121.horikyota.ntt@gmail.com> From: Fujii Masao Message-ID: <899463ee-549c-3f30-5752-ae1988ddc066@oss.nttdata.com> Date: Thu, 27 Feb 2020 14:40:55 +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: <20200227.124830.2197604521555566121.horikyota.ntt@gmail.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/02/27 12:48, Kyotaro Horiguchi wrote: > Hello. > > We found that targetted promotion can cause an assertion failure. The > attached TAP test causes that. > >> TRAP: FailedAssertion("StandbyMode", File: "xlog.c", Line: 12078) > > After recovery target is reached, StartupXLOG turns off standby mode > then refetches the last record. If the last record starts from the > previous WAL segment, the assertion failure is triggered. Good catch! > The wrong point is that StartupXLOG does random access fetching while > WaitForWALToBecomeAvailable is thinking it is still in streaming. I > think if it is called with random access mode, > WaitForWALToBecomeAvailable should move to XLOG_FROM_ARCHIVE even > though it is thinking that it is still reading from stream. I failed to understand why random access while reading from stream is bad idea. Could you elaborate why? Isn't it sufficient to set currentSource to 0 when disabling StandbyMode? Regards, -- Fujii Masao NTT DATA CORPORATION Advanced Platform Technology Group Research and Development Headquarters