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 1ljE7E-0002W0-NA for pgsql-hackers@arkaria.postgresql.org; Wed, 19 May 2021 04:47:28 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1ljE6h-0007RT-Vw for pgsql-hackers@arkaria.postgresql.org; Wed, 19 May 2021 04:46:55 +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 1ljE6h-0007RL-OD for pgsql-hackers@lists.postgresql.org; Wed, 19 May 2021 04:46:55 +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 1ljE6e-00061F-EX for pgsql-hackers@postgresql.org; Wed, 19 May 2021 04:46:55 +0000 Received: from hnk.local (sp49-98-213-158.msd.spmode.ne.jp [49.98.213.158]) by oss.nttdata.com (Postfix) with ESMTPSA id 290A960256; Wed, 19 May 2021 13:46:46 +0900 (JST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.2 at oss.nttdata.com Subject: Re: pg_get_wal_replay_pause_state() should not return 'paused' while a promotion is ongoing. To: Michael Paquier Cc: Kyotaro Horiguchi , pgsql-hackers@postgresql.org References: <20210518.095805.1634592437754592061.horikyota.ntt@gmail.com> From: Fujii Masao Message-ID: <34ecf08e-3f3b-0fd6-30e1-678208b618f2@oss.nttdata.com> Date: Wed, 19 May 2021 13:46:45 +0900 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:78.0) Gecko/20100101 Thunderbird/78.10.2 MIME-Version: 1.0 In-Reply-To: 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: Archived-At: Precedence: bulk On 2021/05/18 15:46, Michael Paquier wrote: > On Tue, May 18, 2021 at 12:48:38PM +0900, Fujii Masao wrote: >> Currently a promotion causes all available WAL to be replayed before >> a standby becomes a primary whether it was in paused state or not. >> OTOH, something like immediate promotion (i.e., standby becomes >> a primary without replaying outstanding WAL) might be useful for >> some cases. I don't object to that. > > Sounds like a "promotion immediate" mode. It does not sound difficult > nor expensive to add a small test for that in one of the existing > recovery tests triggerring a promotion. Could you add one based on > pg_get_wal_replay_pause_state()? You're thinking to add the test like the following? #1. Pause the recovery #2. Confirm that pg_get_wal_replay_pause_state() returns 'paused' #3. Trigger standby promotion #4. Confirm that pg_get_wal_replay_pause_state() returns 'not paused' It seems not easy to do the test #4 stably because pg_get_wal_replay_pause_state() needs to be executed before the promotion finishes. Regards, -- Fujii Masao Advanced Computing Technology Center Research and Development Headquarters NTT DATA CORPORATION