Affects Version/s: 4.5, 220.127.116.11
Fix Version/s: None
Environment:PG 8.3 on linux
Steps to reproduce:
- Configure any PostgreSQL 8.x server with valid creds and set the jdbcUrl to connect to a database (like template1) that the user configured can connect to.
- Once the agent connects and starts logging metrics, change the jdbcUrl to connect to a different database (or just /). It doesn't even matter if the agent has permissions for the database and in my case I had errors in the agent log as I intentionally set the url to something the agent shouldn't be able to connect to.
- Look at the open connections in postgres. A 'select datname from pg_stat_activity;' shows that the hq agent still has a connection open to the initial database.
The connection that is still open should be closed when the resource is configured for a different database. Restarting the agent is required to close the connection currently.
The connection should be closed