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 1lieFO-0004r1-8L for pgsql-hackers@arkaria.postgresql.org; Mon, 17 May 2021 14:29:30 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lieFN-0002h9-6E for pgsql-hackers@arkaria.postgresql.org; Mon, 17 May 2021 14:29:29 +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 1lieFM-0002h0-UX for pgsql-hackers@lists.postgresql.org; Mon, 17 May 2021 14:29:28 +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 1lieFG-0004e8-Ng for pgsql-hackers@postgresql.org; Mon, 17 May 2021 14:29:28 +0000 Received: from hnk.local (p2388012-ipbf1027funabasi.chiba.ocn.ne.jp [118.6.6.12]) by oss.nttdata.com (Postfix) with ESMTPSA id DF84260416 for ; Mon, 17 May 2021 23:29:18 +0900 (JST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.2 at oss.nttdata.com To: pgsql-hackers@postgresql.org From: Fujii Masao Subject: pg_get_wal_replay_pause_state() should not return 'paused' while a promotion is ongoing. Message-ID: Date: Mon, 17 May 2021 23:29:18 +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 Content-Type: multipart/mixed; boundary="------------15537CFA1FC8D0F7227F1794" Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk This is a multi-part message in MIME format. --------------15537CFA1FC8D0F7227F1794 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit 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? Regards, -- Fujii Masao Advanced Computing Technology Center Research and Development Headquarters NTT DATA CORPORATION --------------15537CFA1FC8D0F7227F1794 Content-Type: text/plain; charset=UTF-8; x-mac-type="0"; x-mac-creator="0"; name="reset_wal_pause_state_after_promotion_v1.patch" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="reset_wal_pause_state_after_promotion_v1.patch" ZGlmZiAtLWdpdCBhL3NyYy9iYWNrZW5kL2FjY2Vzcy90cmFuc2FtL3hsb2cuYyBiL3NyYy9i YWNrZW5kL2FjY2Vzcy90cmFuc2FtL3hsb2cuYwppbmRleCA4ZDE2M2YxOTBmLi40NDFhOTEy NGNkIDEwMDY0NAotLS0gYS9zcmMvYmFja2VuZC9hY2Nlc3MvdHJhbnNhbS94bG9nLmMKKysr IGIvc3JjL2JhY2tlbmQvYWNjZXNzL3RyYW5zYW0veGxvZy5jCkBAIC0xMjgyNSw2ICsxMjgy NSwxNCBAQCBTZXRQcm9tb3RlSXNUcmlnZ2VyZWQodm9pZCkKIAlYTG9nQ3RsLT5TaGFyZWRQ cm9tb3RlSXNUcmlnZ2VyZWQgPSB0cnVlOwogCVNwaW5Mb2NrUmVsZWFzZSgmWExvZ0N0bC0+ aW5mb19sY2spOwogCisJLyoKKwkgKiBNYXJrIHRoZSByZWNvdmVyeSBwYXVzZSBzdGF0ZSBh cyAnbm90IHBhdXNlZCcgYmVjYXVzZSB0aGUgcGF1c2VkIHN0YXRlCisJICogZW5kcyBhbmQg cHJvbW90aW9uIGNvbnRpbnVlcyBpZiBhIHByb21vdGlvbiBpcyB0cmlnZ2VyZWQgd2hpbGUg cmVjb3ZlcnkKKwkgKiBpcyBwYXVzZWQuIE90aGVyd2lzZSBwZ19nZXRfd2FsX3JlcGxheV9w YXVzZV9zdGF0ZSgpIGNhbiBtaXN0YWtlbmx5CisJICogcmV0dXJuICdwYXVzZWQnIHdoaWxl IGEgcHJvbW90aW9uIGlzIG9uZ29pbmcuCisJICovCisJU2V0UmVjb3ZlcnlQYXVzZShmYWxz ZSk7CisKIAlMb2NhbFByb21vdGVJc1RyaWdnZXJlZCA9IHRydWU7CiB9CiAK --------------15537CFA1FC8D0F7227F1794--