Problem:
The client has master and standby configuration and connections are managed by pgpool (version 4.1.5) in the PostgreSQL (version 11.5) production environment. Recently the client faced a switchover/failover when an “idle_in_transaction” session was killed using “pg_terminate_backend” after connecting via pgpoolvip.
Process:
Step 1 – Initial investigation:
The expert team gathered the information and started the troubleshooting:
Step 2 – Further investigation:
The expert team found that:
Solution:
After a detailed investigation of the information, the expert team provided to the client the next instruction:
Connect to the database via pgpool and terminate the session. As for the reason when pgpool sees that its connections are suddenly killed, it concludes that the master server is failing and performs a failover. (more information in the link: https://postgrespro.com/list/thread-id/2559842)
Conclusion:
The switchover/failover in the client’s PostgreSQL production environment occurred because terminating “idle_in_transaction” sessions directly through the master server caused pgpool to misinterpret these actions as server failure. The issue was resolved by adhering to recommended procedures for session management, ensuring all session terminations are handled through pgpool. Following this approach, as detailed in the solution provided by the expert team, prevented unnecessary failovers and stabilized the system.