Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
None
-
None
Description
The current implementation of option "allowMasterDownConnection" permit using the read-only connection when the master connection is down.
There is 2 limitations :
- Connection.isValid() that test if connection is valid. Pools make intensive use of that method on connection creation / before borrowing / periodic validation. Differents pools use Connection.setReadOnly(false) before calling Connection.isValid(), to test master connection, even when pool is configure to use by default read only connection. That goes against the expected behaviour of "allowMasterDownConnection" option => then no Connection can be created / borrowed from pool until master is up again
- any operation on master connection result in throwing a connection exception if master is down.
Correction proposal :
- When "allowMasterDownConnection" is enable, Connection.isValid() must return that connection is valid when master is down but read-only connection is valid.
- any operation on the master connection that doesn't need database operation must not throw an exception if the master is down.
- any operation on the master connection that required database when master if down must try to reconnect master, succeed or throw the appropriate exception.