Skip to content

Commit

Permalink
Merge branch 'release/3.1.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
rusher committed Nov 9, 2022
2 parents a42cde1 + 8216832 commit 931f45e
Show file tree
Hide file tree
Showing 137 changed files with 9,257 additions and 3,619 deletions.
1 change: 1 addition & 0 deletions .mvn/jvm.config
@@ -0,0 +1 @@
--add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED
3 changes: 3 additions & 0 deletions .travis.yml
Expand Up @@ -110,3 +110,6 @@ script:

after_script:
- bash <(curl -s https://codecov.io/bash)

after_failure:
- if [ "$srv" == "maxscale" ] ; then docker-compose -f ${COMPOSE_FILE} exec -u root maxscale tail -500 /var/log/maxscale/maxscale.log; fi
16 changes: 16 additions & 0 deletions CHANGELOG.md
@@ -1,5 +1,21 @@
# Change Log

## [3.1.0](https://github.com/mariadb-corporation/mariadb-connector-j/tree/3.1.0) (Nov 2022)
[Full Changelog](https://github.com/mariadb-corporation/mariadb-connector-j/compare/3.0.9...3.1.0)

##### Notable Changes
* CONJ-899 Support UUID Object
* CONJ-916 when a failover occurs, log replayed transaction
* CONJ-917 deprecated options use must be logged
* CONJ-992 load balance distribution
* CONJ-1008 default value for socket option useReadAheadInput
* CONJ-1009 improve performance reading big result-set
* CONJ-1014 avoid creating array when receiving server packet
* CONJ-1015 pipelining sending multiple packet to socket

##### Bugs Fixed
* CONJ-1020 java 11 option setting ignored

## [3.0.9](https://github.com/mariadb-corporation/mariadb-connector-j/tree/3.0.9) (Nov 2022)
[Full Changelog](https://github.com/mariadb-corporation/mariadb-connector-j/compare/3.0.8...3.0.9)
* 2.7.7 merge
Expand Down
4 changes: 2 additions & 2 deletions README.md
Expand Up @@ -26,7 +26,7 @@ or maven :
<dependency>
<groupId>org.mariadb.jdbc</groupId>
<artifactId>mariadb-java-client</artifactId>
<version>3.0.8</version>
<version>3.1.0</version>
</dependency>
```

Expand All @@ -45,7 +45,7 @@ Development snapshot are available on sonatype nexus repository
<dependency>
<groupId>org.mariadb.jdbc</groupId>
<artifactId>mariadb-java-client</artifactId>
<version>3.0.9-SNAPSHOT</version>
<version>3.1.1-SNAPSHOT</version>
</dependency>
</dependencies>
```
Expand Down
36 changes: 20 additions & 16 deletions pom.xml
Expand Up @@ -7,7 +7,7 @@
<artifactId>mariadb-java-client</artifactId>
<packaging>jar</packaging>
<name>mariadb-java-client</name>
<version>3.0.9</version>
<version>3.1.0</version>
<description>JDBC driver for MariaDB and MySQL</description>
<url>https://mariadb.com/kb/en/mariadb/about-mariadb-connector-j/</url>

Expand All @@ -20,11 +20,11 @@
<osgi.version>6.0.0</osgi.version>
<osgi.compendium.version>5.0.0</osgi.compendium.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<logback.version>1.3.0-alpha12</logback.version>
<jacoco.version>0.8.7</jacoco.version>
<waffle-jna.version>3.1.1</waffle-jna.version>
<mysql-connector-java.version>8.0.30</mysql-connector-java.version>
<bnd-maven-plugin.version>6.2.0</bnd-maven-plugin.version>
<logback.version>1.4.4</logback.version>
<jacoco.version>0.8.8</jacoco.version>
<waffle-jna.version>3.2.0</waffle-jna.version>
<mysql-connector-java.version>8.0.31</mysql-connector-java.version>
<bnd-maven-plugin.version>6.3.1</bnd-maven-plugin.version>
</properties>

<licenses>
Expand Down Expand Up @@ -79,7 +79,7 @@
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>bom</artifactId>
<version>2.17.24</version>
<version>2.18.10</version>
<type>pom</type>
<scope>import</scope>
</dependency>
Expand All @@ -98,7 +98,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<version>3.10.1</version>
<configuration>
<showWarnings>true</showWarnings>
<compilerArgs>
Expand Down Expand Up @@ -152,7 +152,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.2.0</version>
<version>3.4.1</version>
<configuration>
<source>1.8</source>
<excludePackageNames>
Expand All @@ -172,7 +172,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.2.0</version>
<version>3.3.0</version>
<configuration>
<archive>
<manifestEntries>
Expand Down Expand Up @@ -203,7 +203,7 @@
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.6.8</version>
<version>1.6.13</version>
<extensions>true</extensions>
<executions>
<execution>
Expand All @@ -221,7 +221,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.6</version>
<version>3.0.1</version>
<executions>
<execution>
<phase>verify</phase>
Expand All @@ -235,7 +235,7 @@
<plugin>
<groupId>com.coveo</groupId>
<artifactId>fmt-maven-plugin</artifactId>
<version>2.9.1</version>
<version>2.13</version>
<executions>
<execution>
<goals>
Expand All @@ -248,7 +248,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M5</version>
<version>3.0.0-M7</version>
</plugin>

<plugin>
Expand Down Expand Up @@ -276,7 +276,6 @@
<groupId>com.github.waffle</groupId>
<artifactId>waffle-jna</artifactId>
<version>${waffle-jna.version}</version>
<optional>true</optional>
</dependency>

<dependency>
Expand All @@ -302,7 +301,7 @@
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>2.0.0-alpha5</version>
<version>2.0.3</version>
<optional>true</optional>
</dependency>

Expand Down Expand Up @@ -350,6 +349,11 @@
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>${jacoco.version}</version>
<configuration>
<excludes>
<exclude>META-INF/**</exclude>
</excludes>
</configuration>
<executions>
<execution>
<id>jacoco-initialize</id>
Expand Down
51 changes: 51 additions & 0 deletions src/benchmark/java/org/mariadb/jdbc/Common.java
Expand Up @@ -38,8 +38,14 @@ public static class MyState {

// connections
protected Connection connectionText;
protected Connection connectionTextRewrite;

protected Connection connectionBinary;

protected Connection connectionBinaryNoPipeline;
protected Connection connectionBinaryNoCache;


@Param({"mysql", "mariadb"})
String driver;
@Setup(Level.Trial)
Expand Down Expand Up @@ -70,9 +76,33 @@ public void createConnections() throws Exception {
connectionText =
((java.sql.Driver) Class.forName(className).getDeclaredConstructor().newInstance())
.connect(jdbcUrlText, new Properties());
String jdbcUrlTextRewrite =
String.format(
jdbcBase,
driver, host, port, database, username, password, false, false, "&rewriteBatchedStatements=true&useBulkStmts=false" + other);
connectionTextRewrite =
((java.sql.Driver) Class.forName(className).getDeclaredConstructor().newInstance())
.connect(jdbcUrlTextRewrite, new Properties());
connectionBinary =
((java.sql.Driver) Class.forName(className).getDeclaredConstructor().newInstance())
.connect(jdbcUrlBinary, new Properties());

String jdbcUrlBinaryNoCache =
String.format(
jdbcBase,
driver, host, port, database, username, password, true, false, "&prepStmtCacheSize=0" + other);

connectionBinaryNoCache =
((java.sql.Driver) Class.forName(className).getDeclaredConstructor().newInstance())
.connect(jdbcUrlBinaryNoCache, new Properties());

String jdbcUrlBinaryNoCacheNoPipeline =
String.format(
jdbcBase,
driver, host, port, database, username, password, true, true, "&prepStmtCacheSize=0&cachePrepStmts=false&disablePipeline=true" + other);
connectionBinaryNoPipeline =
((java.sql.Driver) Class.forName(className).getDeclaredConstructor().newInstance())
.connect(jdbcUrlBinaryNoCacheNoPipeline, new Properties());
} catch (SQLException e) {
e.printStackTrace();
throw new RuntimeException(e);
Expand All @@ -83,6 +113,9 @@ public void createConnections() throws Exception {
public void doTearDown() throws SQLException {
connectionText.close();
connectionBinary.close();
connectionTextRewrite.close();
connectionBinaryNoCache.close();
connectionBinaryNoPipeline.close();
}
}

Expand Down Expand Up @@ -119,11 +152,29 @@ public static class SetupData {
sb2.append(")");
stmt.executeUpdate(sb.toString());
stmt.executeUpdate(sb2.toString());

stmt.execute("DROP TABLE IF EXISTS perfTestTextBatch");
try {
stmt.execute("INSTALL SONAME 'ha_blackhole'");
} catch (SQLException e) { }

String createTable = "CREATE TABLE perfTestTextBatch (id MEDIUMINT NOT NULL AUTO_INCREMENT,t0 text, PRIMARY KEY (id)) COLLATE='utf8mb4_unicode_ci'";
try {
stmt.execute(createTable + " ENGINE = BLACKHOLE");
} catch (SQLException e){
stmt.execute(createTable);
}

}
} catch (SQLException e) {
e.printStackTrace();
}
}
}






}
8 changes: 4 additions & 4 deletions src/benchmark/java/org/mariadb/jdbc/Do_1000_params.java
Expand Up @@ -26,10 +26,10 @@ public int text(MyState state) throws Throwable {
return run(state.connectionText);
}

@Benchmark
public int binary(MyState state) throws Throwable {
return run(state.connectionBinary);
}
// @Benchmark
// public int binary(MyState state) throws Throwable {
// return run(state.connectionBinary);
// }

private int run(Connection con) throws Throwable {

Expand Down
54 changes: 54 additions & 0 deletions src/benchmark/java/org/mariadb/jdbc/Insert_batch.java
@@ -0,0 +1,54 @@
// SPDX-License-Identifier: LGPL-2.1-or-later
// Copyright (c) 2012-2014 Monty Program Ab
// Copyright (c) 2015-2021 MariaDB Corporation Ab

package org.mariadb.jdbc;

import org.openjdk.jmh.annotations.Benchmark;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class Insert_batch extends Common {

static final List<String> chars = new ArrayList<>();
static {
chars.addAll(Arrays.asList("123456789abcdefghijklmnop\\Z".split("")));
chars.add("😎");
chars.add("🌶");
chars.add("🎤");
chars.add("🥂");
}

static public String randomString(int length) {
StringBuilder result = new StringBuilder();
for (int i = length; i > 0; --i) result.append(chars.get(Math.round((int) Math.random() * (chars.size() - 1))));
return result.toString();
}

@Benchmark
public int[] binary(MyState state) throws Throwable {
return run(state.connectionBinary);
}

@Benchmark
public int[] rewrite(MyState state) throws Throwable {
return run(state.connectionTextRewrite);
}

private int[] run(Connection con) throws Throwable {
String s = randomString(100);
try (PreparedStatement prep = con.prepareStatement("INSERT INTO perfTestTextBatch(t0) VALUES (?)")) {
for (int i = 0; i < 100; i++) {
prep.setString(1, s);
prep.addBatch();
}
return prep.executeBatch();
}
}
}
11 changes: 11 additions & 0 deletions src/benchmark/java/org/mariadb/jdbc/Select_100_cols.java
Expand Up @@ -24,6 +24,17 @@ public int[] binary(MyState state) throws Throwable {
return run(state.connectionBinary);
}

@Benchmark
public int[] binaryNoCache(MyState state) throws Throwable {
return run(state.connectionBinaryNoCache);
}

@Benchmark
public int[] binaryNoPipeline(MyState state) throws Throwable {
return run(state.connectionBinaryNoPipeline);
}


private int[] run(Connection con) throws Throwable {

try (PreparedStatement prep = con.prepareStatement("select * FROM test100")) {
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/org/mariadb/jdbc/BasePreparedStatement.java
Expand Up @@ -13,7 +13,7 @@
import java.sql.ParameterMetaData;
import java.util.*;
import java.util.concurrent.locks.ReentrantLock;
import org.mariadb.jdbc.client.Column;
import org.mariadb.jdbc.client.ColumnDecoder;
import org.mariadb.jdbc.client.util.Parameters;
import org.mariadb.jdbc.codec.*;
import org.mariadb.jdbc.export.ExceptionFactory;
Expand Down Expand Up @@ -105,7 +105,7 @@ public void setPrepareResult(Prepare prepareResult) {
*
* @return metadata list
*/
public Column[] getMeta() {
public ColumnDecoder[] getMeta() {
return this.prepareResult.getColumns();
}

Expand All @@ -114,7 +114,7 @@ public Column[] getMeta() {
*
* @param ci metadata columns
*/
public void updateMeta(Column[] ci) {
public void updateMeta(ColumnDecoder[] ci) {
this.prepareResult.setColumns(ci);
}

Expand Down

0 comments on commit 931f45e

Please sign in to comment.