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 1liqis-0007gH-UQ for pgsql-hackers@arkaria.postgresql.org; Tue, 18 May 2021 03:48:46 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1liqir-0006Vg-Qe for pgsql-hackers@arkaria.postgresql.org; Tue, 18 May 2021 03:48:45 +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 1liqir-0006UJ-Iy for pgsql-hackers@lists.postgresql.org; Tue, 18 May 2021 03:48:45 +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 1liqio-0000Kw-F9 for pgsql-hackers@postgresql.org; Tue, 18 May 2021 03:48:44 +0000 Received: from hnk.local (p2388012-ipbf1027funabasi.chiba.ocn.ne.jp [118.6.6.12]) by oss.nttdata.com (Postfix) with ESMTPSA id 073376033C; Tue, 18 May 2021 12:48:39 +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: Kyotaro Horiguchi Cc: pgsql-hackers@postgresql.org References: <20210518.095805.1634592437754592061.horikyota.ntt@gmail.com> From: Fujii Masao Message-ID: Date: Tue, 18 May 2021 12:48:38 +0900 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 MIME-Version: 1.0 In-Reply-To: <20210518.095805.1634592437754592061.horikyota.ntt@gmail.com> 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: Archived-At: Precedence: bulk On 2021/05/18 9:58, Kyotaro Horiguchi wrote: > At Mon, 17 May 2021 23:29:18 +0900, Fujii Masao wrote in >> If a promotion is triggered while recovery is paused, the paused state >> ends >> and promotion continues. But currently pg_get_wal_replay_pause_state() >> returns 'paused' in that case. Isn't this a bug? >> >> Attached patch fixes this issue by resetting the recovery pause state >> to >> 'not paused' when standby promotion is triggered. >> >> Thought? > > Nice catch! > > Once the state enteres "paused" state no more WAL record is expected > to be replayed until exiting the state. I'm not sure but maybe we are > also expecting that the server promotes whthout a record replayed when > triggered while pausing. 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. Regards, -- Fujii Masao Advanced Computing Technology Center Research and Development Headquarters NTT DATA CORPORATION