Skip to content

Commit

Permalink
[CONJ-745] use pool reset only for corrected COM_RESET_CONNECTION
Browse files Browse the repository at this point in the history
  • Loading branch information
rusher committed Nov 21, 2019
1 parent 93167ab commit f6d27fa
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/main/java/org/mariadb/jdbc/MariaDbConnection.java
Expand Up @@ -1663,10 +1663,16 @@ public void setDefaultTransactionIsolation(int defaultTransactionIsolation) {
* @throws SQLException if resetting operation failed
*/
public void reset() throws SQLException {
// COM_RESET_CONNECTION exist since mysql 5.7.3 and mariadb 10.2.4
// but not possible to use it with mysql waiting for https://bugs.mysql.com/bug.php?id=97633 correction.
// and mariadb only since https://jira.mariadb.org/browse/MDEV-18281
boolean useComReset =
options.useResetConnection
&& ((protocol.isServerMariaDb() && protocol.versionGreaterOrEqual(10, 2, 4))
|| (!protocol.isServerMariaDb() && protocol.versionGreaterOrEqual(5, 7, 3)));
&& protocol.isServerMariaDb()
&& (protocol.versionGreaterOrEqual(10, 3, 13)
|| (protocol.getMajorServerVersion() == 10
&& protocol.getMinorServerVersion() == 2
&& protocol.versionGreaterOrEqual(10, 2, 22)));

if (useComReset) {
protocol.reset();
Expand Down

0 comments on commit f6d27fa

Please sign in to comment.