回复:Queries that should be canceled will get stuck on secure_write function

suyu.cmj <mengjuan.cmj@alibaba-inc.com>

From: 蔡梦娟(玊于) <mengjuan.cmj@alibaba-inc.com>
To: "Robert Haas" <robertmhaas@gmail.com>, "Andres Freund" <andres@anarazel.de>, "alvherre" <alvherre@alvh.no-ip.org>, "masao.fujii" <masao.fujii@oss.nttdata.com>
Cc: "pgsql-hackers" <pgsql-hackers@lists.postgresql.org>
Date: 2021-09-09T09:38:06Z
Lists: pgsql-hackers

Attachments


I changed the implementation about this problem: 
a) if the cancel query interrupt is from db for some reason, such as recovery conflict, then handle it immediately, and cancel request is treated as terminate request;
b) if the cancel query interrupt is from client, then ignore as original way

In the attached patch, I also add a tap test to generate a recovery conflict on a standby during the backend process is stuck on client write, check whether it can handle the cancel query request due to recovery conflict.

what do you think of it, hope to get your reply

Thanks & Best Regards