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 1kE3jK-0007K1-V1 for pgsql-hackers@arkaria.postgresql.org; Fri, 04 Sep 2020 04:53:42 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kE3jH-00030R-Bw for pgsql-hackers@arkaria.postgresql.org; Fri, 04 Sep 2020 04:53:39 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kE3jH-0002zX-3y for pgsql-hackers@lists.postgresql.org; Fri, 04 Sep 2020 04:53:39 +0000 Received: from oss.nttdata.com ([49.212.34.109]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kE3j8-0007gI-U5 for pgsql-hackers@lists.postgresql.org; Fri, 04 Sep 2020 04:53:37 +0000 Received: from hnk.local (p12054-ipngn2901funabasi.chiba.ocn.ne.jp [153.212.171.54]) by oss.nttdata.com (Postfix) with ESMTPSA id A1EC1600E3; Fri, 4 Sep 2020 13:53:24 +0900 (JST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.102.3 at oss.nttdata.com Subject: Re: history file on replica and double switchover To: Anastasia Lubennikova , Grigory Smolkin , Postgres hackers References: <54b059d4-2b48-13a4-6f43-95a087c92367@postgrespro.ru> From: Fujii Masao Message-ID: <4f7379a6-b196-70fe-708d-84a2672b3c22@oss.nttdata.com> Date: Fri, 4 Sep 2020 13:53:24 +0900 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:68.0) Gecko/20100101 Thunderbird/68.12.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; 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/09/04 8:29, Anastasia Lubennikova wrote: > On 27.08.2020 16:02, Grigory Smolkin wrote: >> Hello! >> >> I`ve noticed, that when running switchover replica to master and back to replica, new history file is streamed to replica, but not archived, >> which is not great, because it breaks PITR if archiving is running on replica. The fix looks trivial. >> Bash script to reproduce the problem and patch are attached. >> > Thanks for the report. I agree that it looks like a bug. +1 + /* Mark history file as ready for archiving */ + if (XLogArchiveMode != ARCHIVE_MODE_OFF) + XLogArchiveNotify(fname); I agree that history file should be archived in the standby when archive_mode=always. But why do we need to do when archive_mode=on? I'm just concerned about the case where the primary and standby have the shared archive area, and archive_mode is on. > For some reason, patch failed to apply on current master, even though I don't see any difference in the code. > I'll attach this thread to the next commitfest, so it doesn't get lost. Thanks! Regards, -- Fujii Masao Advanced Computing Technology Center Research and Development Headquarters NTT DATA CORPORATION