Fix failover() to deal with the case when no former primary node exists.
authorTatsuo Ishii <ishii@sraoss.co.jp>
Sun, 6 Feb 2022 08:11:52 +0000 (17:11 +0900)
committerTatsuo Ishii <ishii@sraoss.co.jp>
Sun, 6 Feb 2022 08:11:52 +0000 (17:11 +0900)
commit9be4d1fd665b4a726fd21671c25ea8c112d134c4
treec0d03e2468331fa0ed284d752809ada1b79ccbe8
parenteba406d9304693c225739a8a7016950fb5a495dc
Fix failover() to deal with the case when no former primary node exists.

Consider a case when no primary node exists when Pgpool-II starts
up. In this case Req_info->primary_node_id is -1. failover() did not
consider this and skipped to call find_primary_node_repeatedly().
Also follow_master_command was not executed if
Req_info->primary_node_id is -1.

This commit fixes the bug above.

Discussion: https://www.pgpool.net/pipermail/pgpool-hackers/2022-February/004114.html
src/main/pgpool_main.c