On 2021/03/16 12:24, Hao Wu wrote:
Yes, I have an extension/UDF that needs to know if the server is currently running as hot standby. For example, a UDF foo() wants to run on both the primary and secondary and runs different behaviors for different roles. Promoted secondary looks the same as the primary since it's no longer real hot standby. Does it make sense?
If UDF, using RecoveryInProgress() is enough? If RecoveryInProgress() returns false, UDF can determine that the server is working as a primary. If true is returned, UDF can determine that the server is working as a secondary and hot standby is active because you can connect to the server and UDF can be called. If hot standby is not active during recovery, you cannot conect to the server and cannot run UDF, so UDF doesn't need to handle the case where hot standby is not active during recovery. Thought? Regards, -- Fujii Masao Advanced Computing Technology Center Research and Development Headquarters NTT DATA CORPORATION