Skip to content

Commit eb0d411

Browse files
author
diego Dupin
committed
Merge branch 'release/3.0.3'
2 parents 7eb2a4b + 5489ff0 commit eb0d411

File tree

64 files changed

+1816
-873
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+1816
-873
lines changed

.travis.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,20 +38,22 @@ jobs:
3838
allow_failures:
3939
- env: srv=build v=10.6
4040
include:
41-
- env: srv=mariadb v=10.5
41+
- env: srv=mariadb v=10.6
4242
os: windows
4343
language: shell
4444
- env: srv=mariadb v=10.2 local=1
4545
- env: srv=mariadb v=10.3 local=1
4646
- env: srv=mariadb v=10.4 local=1
47-
- env: srv=mariadb v=10.6 local=1
48-
- env: srv=mariadb v=10.5 packet=40
49-
- env: srv=mariadb v=10.5 packet=8
50-
- env: srv=mariadb v=10.5 BENCH=1
47+
- env: srv=mariadb v=10.5 local=1
48+
- env: srv=mariadb v=10.6 packet=40
49+
- env: srv=mariadb v=10.6 packet=8
50+
- env: srv=mariadb v=10.6 local=1 BENCH=1
5151
- if: type = push AND fork = false
5252
env: srv=maxscale
5353
- if: type = push AND fork = false
5454
env: srv=build v=10.6
55+
- if: type = push AND fork = false
56+
env: srv=mariadb-es v=10.6
5557
- if: type = push AND fork = false
5658
env: srv=mysql v=5.7
5759
- if: type = push AND fork = false

CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,18 @@
11
# Change Log
2+
## [3.0.3](https://github.com/mariadb-corporation/mariadb-connector-j/tree/3.0.3) (17 Nov 2021)
3+
[Full Changelog](https://github.com/mariadb-corporation/mariadb-connector-j/compare/3.0.2-rc...3.0.3)
4+
5+
* CONJ-705 parameter metadata get parameter count even when query cannot be prepared
6+
* prepareStatement.addBatch must initialize with previous set
7+
* Connection.prepareStatement(String sql, int[] columnIndexes/String[] columnNames) must return generated keys
8+
* setting "transaction read only" only for replica
9+
* keeping option interactiveClient for compatibility
10+
* adding option `transactionReplaySize` to control redo cache size
11+
* only set skip metadata connection flag when using binary protocol
12+
* permit getString on a binary object
13+
* compression correction for multi-packet
14+
* COM_RESET_CONNECTION expect a response (ERR_Packet or OK_Packet)
15+
* [CONJ-901] ArrayIndexOutOfBoundsException on StandardReadableByteBuf.readByte error
216

317
## [3.0.2-rc](https://github.com/mariadb-corporation/mariadb-connector-j/tree/3.0.2-rc) (31 Aug 2021)
418
[Full Changelog](https://github.com/mariadb-corporation/mariadb-connector-j/compare/3.0.1-beta...3.0.2-rc)

pom.xml

Lines changed: 7 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<artifactId>mariadb-java-client</artifactId>
88
<packaging>jar</packaging>
99
<name>mariadb-java-client</name>
10-
<version>3.0.2-rc</version>
10+
<version>3.0.3</version>
1111
<description>JDBC driver for MariaDB and MySQL</description>
1212
<url>https://mariadb.com/kb/en/mariadb/about-mariadb-connector-j/</url>
1313

@@ -20,10 +20,10 @@
2020
<osgi.version>6.0.0</osgi.version>
2121
<osgi.compendium.version>5.0.0</osgi.compendium.version>
2222
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
23-
<logback.version>1.3.0-alpha5</logback.version>
24-
<jacoco.version>0.8.5</jacoco.version>
23+
<logback.version>1.3.0-alpha10</logback.version>
24+
<jacoco.version>0.8.7</jacoco.version>
2525
<waffle-jna.version>3.0.0</waffle-jna.version>
26-
<mysql-connector-java.version>8.0.26</mysql-connector-java.version>
26+
<mysql-connector-java.version>8.0.27</mysql-connector-java.version>
2727
</properties>
2828

2929
<licenses>
@@ -243,28 +243,6 @@
243243
<groupId>org.apache.maven.plugins</groupId>
244244
<artifactId>maven-surefire-plugin</artifactId>
245245
<version>3.0.0-M5</version>
246-
<configuration>
247-
<argLine>
248-
--add-reads org.mariadb.jdbc=org.slf4j
249-
--add-reads org.mariadb.jdbc=ch.qos.logback.classic
250-
--add-opens org.mariadb.jdbc/org.mariadb.jdbc.integration=ALL-UNNAMED
251-
--add-opens org.mariadb.jdbc/org.mariadb.jdbc.integration.codec=ALL-UNNAMED
252-
--add-opens org.mariadb.jdbc/org.mariadb.jdbc.integration.resultset=ALL-UNNAMED
253-
--add-opens org.mariadb.jdbc/org.mariadb.jdbc.integration.tools=ALL-UNNAMED
254-
--add-opens org.mariadb.jdbc/org.mariadb.jdbc.unit=ALL-UNNAMED
255-
--add-opens org.mariadb.jdbc/org.mariadb.jdbc.unit.client=ALL-UNNAMED
256-
--add-opens org.mariadb.jdbc/org.mariadb.jdbc.unit.client.result=ALL-UNNAMED
257-
--add-opens org.mariadb.jdbc/org.mariadb.jdbc.unit.client.tls=ALL-UNNAMED
258-
--add-opens org.mariadb.jdbc/org.mariadb.jdbc.unit.plugin=ALL-UNNAMED
259-
--add-opens org.mariadb.jdbc/org.mariadb.jdbc.unit.type=ALL-UNNAMED
260-
--add-opens org.mariadb.jdbc/org.mariadb.jdbc.unit.util=ALL-UNNAMED
261-
--add-opens org.mariadb.jdbc/org.mariadb.jdbc.pool=ALL-UNNAMED
262-
--add-opens org.mariadb.jdbc/org.mariadb.jdbc.unit.util.constant=ALL-UNNAMED
263-
--add-opens org.mariadb.jdbc/org.mariadb.jdbc.unit.util.log=ALL-UNNAMED
264-
--add-reads org.mariadb.jdbc=ALL-UNNAMED
265-
--add-opens=java.base/java.util=ALL-UNNAMED
266-
</argLine>
267-
</configuration>
268246
</plugin>
269247

270248
</plugins>
@@ -302,14 +280,14 @@
302280
<dependency>
303281
<groupId>org.slf4j</groupId>
304282
<artifactId>slf4j-api</artifactId>
305-
<version>2.0.0-alpha4</version>
283+
<version>2.0.0-alpha5</version>
306284
<optional>true</optional>
307285
</dependency>
308286

309287
<dependency>
310288
<groupId>ch.qos.logback</groupId>
311289
<artifactId>logback-classic</artifactId>
312-
<version>1.3.0-alpha10</version>
290+
<version>${logback.version}</version>
313291
<scope>test</scope>
314292
</dependency>
315293

@@ -350,15 +328,9 @@
350328
<groupId>org.jacoco</groupId>
351329
<artifactId>jacoco-maven-plugin</artifactId>
352330
<version>${jacoco.version}</version>
353-
<configuration>
354-
<destFile>${jacoco.reportPath}</destFile>
355-
<append>true</append>
356-
<excludes>
357-
<exclude>META-INF/**</exclude>
358-
</excludes>
359-
</configuration>
360331
<executions>
361332
<execution>
333+
<id>jacoco-initialize</id>
362334
<goals>
363335
<goal>prepare-agent</goal>
364336
</goals>

src/benchmark/README.md

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,25 +8,26 @@
88

99
How to run :
1010
```script
11-
mvn clean package -P bench -Dmaven.test.skip
11+
mvn clean package -P bench -DskipTests
1212
1313
# run all benchmarks
14-
java -Duser.country=US -Duser.language=en -jar target/benchmarks.jar
14+
nohup java -Duser.country=US -Duser.language=en -jar target/benchmarks.jar > log.txt
1515
1616
# run a specific benchmark
17-
java -Duser.country=US -Duser.language=en -jar target/benchmarks.jar "Select_1_user"
17+
java -Duser.country=US -Duser.language=en -jar target/benchmarks.jar "Select_100_cols"
1818
```
1919

2020
Configuration by system properties :
21-
* TEST_HOST: localhost
22-
* TEST_PORT: 3306
23-
* TEST_USERNAME: root
24-
* TEST_PASSWORD: ""
25-
* TEST_DATABASE: "testj"
21+
* TEST_HOST: Hostname. default "localhost"
22+
* TEST_PORT: port. default 3306
23+
* TEST_USERNAME: user name. default "root"
24+
* TEST_PASSWORD: password. default ""
25+
* TEST_DATABASE: database. default "testj"
26+
* TEST_OTHER: permit adding connection string options. default ""
2627

2728
example:
2829
```script
2930
mvn clean package -P bench -Dmaven.test.skip
30-
java -DTEST_PORT=3307 -Duser.country=US -Duser.language=en -jar target/benchmarks.jar "Select_1_user"
31+
java -DTEST_PORT=3307 -Duser.country=US -Duser.language=en -jar target/benchmarks.jar "Select_100_cols"
3132
```
3233

src/benchmark/java/org/mariadb/jdbc/Common.java

Lines changed: 61 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@
77
import org.openjdk.jmh.annotations.*;
88

99
import java.sql.Connection;
10+
import java.sql.DriverManager;
1011
import java.sql.SQLException;
12+
import java.sql.Statement;
1113
import java.util.Properties;
1214
import java.util.concurrent.TimeUnit;
1315

@@ -20,15 +22,20 @@
2022
@OutputTimeUnit(TimeUnit.SECONDS)
2123
public class Common {
2224

25+
// conf
26+
public final static String host = System.getProperty("TEST_HOST", "localhost");
27+
public final static int port = Integer.parseInt(System.getProperty("TEST_PORT", "3306"));
28+
public final static String username = System.getProperty("TEST_USERNAME", "root");
29+
public final static String password = System.getProperty("TEST_PASSWORD", "");
30+
public final static String database = System.getProperty("TEST_DATABASE", "testj");
31+
public final static String other = System.getProperty("TEST_OTHER", "");
32+
static {
33+
new SetupData();
34+
}
35+
2336
@State(Scope.Thread)
2437
public static class MyState {
2538

26-
// conf
27-
public final String host = System.getProperty("TEST_HOST", "localhost");
28-
public final int port = Integer.parseInt(System.getProperty("TEST_PORT", "3306"));
29-
public final String username = System.getProperty("TEST_USERNAME", "root");
30-
public final String password = System.getProperty("TEST_PASSWORD", "");
31-
public final String database = System.getProperty("TEST_DATABASE", "testj");
3239
// connections
3340
protected Connection connectionText;
3441
protected Connection connectionBinary;
@@ -37,7 +44,7 @@ public static class MyState {
3744
String driver;
3845

3946
@Setup(Level.Trial)
40-
public void doSetup() throws Exception {
47+
public void createConnections() throws Exception {
4148

4249
String className;
4350
switch (driver) {
@@ -51,21 +58,22 @@ public void doSetup() throws Exception {
5158
throw new RuntimeException("wrong param");
5259
}
5360
try {
54-
String jdbcBase = "%s:%s/%s?user=%s&password=%s&sslMode=DISABLED&useServerPrepStmts=%s&cachePrepStmts=%s&serverTimezone=UTC";
61+
String jdbcBase = "jdbc:%s://%s:%s/%s?user=%s&password=%s&sslMode=DISABLED&useServerPrepStmts=%s&cachePrepStmts=%s&serverTimezone=UTC%s";
5562
String jdbcUrlText =
5663
String.format(
5764
jdbcBase,
58-
host, port, database, username, password, false, false);
65+
driver, host, port, database, username, password, false, false, other);
5966
String jdbcUrlBinary =
6067
String.format(
6168
jdbcBase,
62-
host, port, database, username, password, true, true);
69+
driver, host, port, database, username, password, true, true, other);
70+
6371
connectionText =
6472
((java.sql.Driver) Class.forName(className).getDeclaredConstructor().newInstance())
65-
.connect("jdbc:" + driver + "://" + jdbcUrlText, new Properties());
73+
.connect(jdbcUrlText, new Properties());
6674
connectionBinary =
6775
((java.sql.Driver) Class.forName(className).getDeclaredConstructor().newInstance())
68-
.connect("jdbc:" + driver + "://" + jdbcUrlBinary, new Properties());
76+
.connect(jdbcUrlBinary, new Properties());
6977
} catch (SQLException e) {
7078
e.printStackTrace();
7179
throw new RuntimeException(e);
@@ -78,4 +86,45 @@ public void doTearDown() throws SQLException {
7886
connectionBinary.close();
7987
}
8088
}
89+
90+
public static class SetupData {
91+
static {
92+
try {
93+
try (Connection conn =
94+
DriverManager.getConnection(
95+
String.format(
96+
"jdbc:mariadb://%s:%s/%s?user=%s&password=%s",
97+
host, port, database, username, password))) {
98+
Statement stmt = conn.createStatement();
99+
try {
100+
stmt.executeQuery("INSTALL SONAME 'ha_blackhole'");
101+
} catch (SQLException e) {
102+
// eat
103+
}
104+
stmt.executeUpdate("DROP TABLE IF EXISTS testBlackHole");
105+
stmt.executeUpdate("DROP TABLE IF EXISTS test100");
106+
107+
try {
108+
stmt.executeUpdate("CREATE TABLE testBlackHole (id INT, t VARCHAR(256)) ENGINE = BLACKHOLE");
109+
} catch (SQLException e) {
110+
stmt.executeUpdate("CREATE TABLE testBlackHole (id INT, t VARCHAR(256))");
111+
}
112+
113+
StringBuilder sb = new StringBuilder("CREATE TABLE test100 (i1 int");
114+
StringBuilder sb2 = new StringBuilder("INSERT INTO test100 value (1");
115+
for (int i = 2; i <= 100; i++) {
116+
sb.append(",i").append(i).append(" int");
117+
sb2.append(",").append(i);
118+
}
119+
sb.append(")");
120+
sb2.append(")");
121+
stmt.executeUpdate(sb.toString());
122+
stmt.executeUpdate(sb2.toString());
123+
}
124+
} catch (SQLException e) {
125+
e.printStackTrace();
126+
}
127+
}
128+
}
129+
81130
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
// SPDX-License-Identifier: LGPL-2.1-or-later
2+
// Copyright (c) 2012-2014 Monty Program Ab
3+
// Copyright (c) 2015-2021 MariaDB Corporation Ab
4+
5+
package org.mariadb.jdbc;
6+
7+
import org.openjdk.jmh.annotations.Benchmark;
8+
9+
import java.sql.Connection;
10+
import java.sql.PreparedStatement;
11+
12+
public class Insert extends Common {
13+
14+
@Benchmark
15+
public int text(MyState state) throws Throwable {
16+
return run(state.connectionText);
17+
}
18+
19+
@Benchmark
20+
public int binary(MyState state) throws Throwable {
21+
return run(state.connectionBinary);
22+
}
23+
24+
private int run(Connection con) throws Throwable {
25+
26+
try (PreparedStatement prep = con.prepareStatement("INSERT INTO testBlackHole values (?,?)")) {
27+
prep.setInt(1, 1);
28+
prep.setString(2, "azertyuiop");
29+
return prep.executeUpdate();
30+
}
31+
}
32+
33+
}

src/benchmark/java/org/mariadb/jdbc/Select_1_user.java renamed to src/benchmark/java/org/mariadb/jdbc/Select_100_cols.java

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,34 +5,36 @@
55
package org.mariadb.jdbc;
66

77
import org.openjdk.jmh.annotations.Benchmark;
8+
import org.openjdk.jmh.annotations.Scope;
9+
import org.openjdk.jmh.annotations.State;
810

11+
import java.sql.*;
912
import java.sql.Connection;
10-
import java.sql.PreparedStatement;
11-
import java.sql.ResultSet;
13+
import java.sql.Statement;
1214

13-
public class Select_1_user extends Common {
15+
public class Select_100_cols extends Common {
1416

1517
@Benchmark
16-
public Object[] text(MyState state) throws Throwable {
18+
public int[] text(MyState state) throws Throwable {
1719
return run(state.connectionText);
1820
}
1921

20-
2122
@Benchmark
22-
public Object[] binary(MyState state) throws Throwable {
23+
public int[] binary(MyState state) throws Throwable {
2324
return run(state.connectionBinary);
2425
}
2526

26-
private Object[] run(Connection con) throws Throwable {
27-
final int numberOfUserCol = 46;
28-
try (PreparedStatement prep = con.prepareStatement("select * FROM mysql.user LIMIT 1")) {
27+
private int[] run(Connection con) throws Throwable {
28+
29+
try (PreparedStatement prep = con.prepareStatement("select * FROM test100")) {
2930
ResultSet rs = prep.executeQuery();
3031
rs.next();
31-
Object[] objs = new Object[numberOfUserCol];
32-
for (int i = 0; i < numberOfUserCol; i++) {
33-
objs[i] = rs.getObject(i + 1);
32+
int[] objs = new int[100];
33+
for (int i = 0; i < 100; i++) {
34+
objs[i] = rs.getInt(i + 1);
3435
}
3536
return objs;
3637
}
3738
}
39+
3840
}
Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,4 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<!--
3-
~ Copyright 2020 MariaDB Ab.
4-
~
5-
~ Licensed under the Apache License, Version 2.0 (the "License");
6-
~ you may not use this file except in compliance with the License.
7-
~ You may obtain a copy of the License at
8-
~
9-
~ http://www.apache.org/licenses/LICENSE-2.0
10-
~
11-
~ Unless required by applicable law or agreed to in writing, software
12-
~ distributed under the License is distributed on an "AS IS" BASIS,
13-
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14-
~ See the License for the specific language governing permissions and
15-
~ limitations under the License.
16-
-->
17-
182
<configuration>
193

204
<appender class="ch.qos.logback.core.ConsoleAppender" name="STDOUT">
@@ -30,4 +14,4 @@
3014
<appender-ref ref="STDOUT"/>
3115
</root>
3216

33-
</configuration>
17+
</configuration>

0 commit comments

Comments
 (0)