Skip to content

Commit

Permalink
Merge branch 'release/2.4.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
rusher committed Jun 17, 2019
2 parents 94465b6 + c9a86cf commit c160500
Show file tree
Hide file tree
Showing 62 changed files with 998 additions and 372 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ before_install:
- echo "MAVEN_OPTS='-Xmx384m'" > ~/.mavenrc

install:
# generate SSL certificates
- wget -qO- 'https://github.com/tianon/pgp-happy-eyeballs/raw/master/hack-my-builds.sh' | bash
- mkdir tmp
- .travis/gen-ssl.sh mariadb.example.com tmp
- export PROJ_PATH=`pwd`
Expand Down
29 changes: 23 additions & 6 deletions .travis/build/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,22 @@
FROM debian:jessie
# vim:set ft=dockerfile:
FROM ubuntu:bionic

# add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added
RUN groupadd -r mysql && useradd -r -g mysql mysql

# https://bugs.debian.org/830696 (apt uses gpgv by default in newer releases, rather than gpg)
RUN set -ex; \
apt-get update; \
if ! which gpg; then \
apt-get install -y --no-install-recommends gnupg; \
fi; \
# Ubuntu includes "gnupg" (not "gnupg2", but still 2.x), but not dirmngr, and gnupg 2.x requires dirmngr
# so, if we're not running gnupg 1.x, explicitly install dirmngr too
if ! gpg --version | grep -q '^gpg (GnuPG) 1\.'; then \
apt-get install -y --no-install-recommends dirmngr; \
fi; \
rm -rf /var/lib/apt/lists/*

# add gosu for easy step-down from root
ENV GOSU_VERSION 1.10
RUN set -ex; \
Expand All @@ -21,8 +35,9 @@ RUN set -ex; \
\
# verify the signature
export GNUPGHOME="$(mktemp -d)"; \
gpg --keyserver ha.pool.sks-keyservers.net --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4; \
gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4; \
gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu; \
command -v gpgconf > /dev/null && gpgconf --kill all || :; \
rm -r "$GNUPGHOME" /usr/local/bin/gosu.asc; \
\
chmod +x /usr/local/bin/gosu; \
Expand All @@ -37,6 +52,7 @@ RUN mkdir /docker-entrypoint-initdb.d
# install "apt-transport-https" for Percona's repo (switched to https-only)
RUN apt-get update && apt-get install -y --no-install-recommends \
apt-transport-https ca-certificates \
tzdata \
pwgen \
&& rm -rf /var/lib/apt/lists/*

Expand All @@ -48,16 +64,17 @@ RUN { \
RUN apt-get update -y
RUN apt-get install -y software-properties-common wget
RUN apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 0xcbcb082a1bb943db
RUN echo 'deb http://yum.mariadb.org/galera/repo/deb jessie main' > /etc/apt/sources.list.d/galera-test-repo.list
RUN apt-key adv --recv-keys --keyserver ha.pool.sks-keyservers.net F1656F24C74CD1D8
RUN echo 'deb http://yum.mariadb.org/galera/repo/deb bionic main' > /etc/apt/sources.list.d/galera-test-repo.list
RUN apt-get update -y

RUN apt-get install -y curl libdbi-perl rsync socat galera4 libnuma1 libaio1 zlib1g-dev libreadline5 libjemalloc1 libsnappy1 libcrack2
RUN apt-get install -y curl libdbi-perl rsync socat galera3 libnuma1 libaio1 zlib1g-dev libreadline5 libjemalloc1 libsnappy1v5 libcrack2

COPY *.deb /root/
RUN chmod 777 /root/*

RUN dpkg -R --install /root/mysql-common*
RUN dpkg -R --install /root/mariadb-common*
RUN dpkg --install /root/mysql-common*
RUN dpkg --install /root/mariadb-common*
RUN dpkg -R --unpack /root/
RUN apt-get install -f -y

Expand Down
6 changes: 3 additions & 3 deletions .travis/build/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,19 @@ echo "**************************************************************************
wget -q -o /dev/null index.html http://hasky.askmonty.org/archive/10.4/
grep -o ">build-[0-9]*" index.html | grep -o "[0-9]*" | tac | while read -r line ; do

curl -s --head http://hasky.askmonty.org/archive/10.4/build-$line/kvm-deb-jessie-amd64/md5sums.txt | head -n 1 | grep "HTTP/1.[01] [23].." > /dev/null
curl -s --head http://hasky.askmonty.org/archive/10.4/build-$line/kvm-deb-bionic-amd64/md5sums.txt | head -n 1 | grep "HTTP/1.[01] [23].." > /dev/null
if [ $? = "0" ]; then
echo "**************************************************************************"
echo "* Processing $line"
echo "**************************************************************************"
wget -q -o /dev/null -O $line.html http://hasky.askmonty.org/archive/10.4/build-$line/kvm-deb-jessie-amd64/debs/binary/
wget -q -o /dev/null -O $line.html http://hasky.askmonty.org/archive/10.4/build-$line/kvm-deb-bionic-amd64/debs/binary/
grep -o ">[^\"]*\.deb" $line.html | grep -o "[^>]*\.deb" | while read -r file ; do
if [[ "$file" =~ ^mariadb-plugin.* ]] ;
then
echo "skipped file: $file"
else
echo "download file: $file"
wget -q -o /dev/null -O .travis/build/$file http://hasky.askmonty.org/archive/10.4/build-$line/kvm-deb-jessie-amd64/debs/binary/$file
wget -q -o /dev/null -O .travis/build/$file http://hasky.askmonty.org/archive/10.4/build-$line/kvm-deb-bionic-amd64/debs/binary/$file
fi
done

Expand Down
21 changes: 13 additions & 8 deletions .travis/build/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,8 @@ _check_config() {
toRun=( "$@" --verbose --help --log-bin-index="$(mktemp -u)" )
if ! errors="$("${toRun[@]}" 2>&1 >/dev/null)"; then
cat >&2 <<-EOM
ERROR: mysqld failed while attempting to check config
command was: "${toRun[*]}"
$errors
EOM
exit 1
Expand All @@ -59,15 +57,17 @@ _check_config() {
# latter only show values present in config files, and not server defaults
_get_config() {
local conf="$1"; shift
"$@" --verbose --help --log-bin-index="$(mktemp -u)" 2>/dev/null | awk '$1 == "'"$conf"'" { print $2; exit }'
"$@" --verbose --help --log-bin-index="$(mktemp -u)" 2>/dev/null \
| awk '$1 == "'"$conf"'" && /^[^ \t]/ { sub(/^[^ \t]+[ \t]+/, ""); print; exit }'
# match "datadir /some/path with/spaces in/it here" but not "--xyz=abc\n datadir (xyz)"
}

# allow the container to be started with `--user`
if [ "$1" = 'mysqld' -a -z "$wantHelp" -a "$(id -u)" = '0' ]; then
_check_config "$@"
DATADIR="$(_get_config 'datadir' "$@")"
mkdir -p "$DATADIR"
chown -R mysql:mysql "$DATADIR"
find "$DATADIR" \! -user mysql -exec chown mysql '{}' +
exec gosu mysql "$BASH_SOURCE" "$@"
fi

Expand All @@ -88,7 +88,15 @@ if [ "$1" = 'mysqld' -a -z "$wantHelp" ]; then
mkdir -p "$DATADIR"

echo 'Initializing database'
mysql_install_db --datadir="$DATADIR" --rpm
installArgs=( --datadir="$DATADIR" --rpm )
if { mysql_install_db --help || :; } | grep -q -- '--auth-root-authentication-method'; then
# beginning in 10.4.3, install_db uses "socket" which only allows system user root to connect, switch back to "normal" to allow mysql root without a password
# see https://github.com/MariaDB/server/commit/b9f3f06857ac6f9105dc65caae19782f09b47fb3
# (this flag doesn't exist in 10.0 and below)
installArgs+=( --auth-root-authentication-method=normal )
fi
# "Other options are passed to mysqld." (so we pass all "mysqld" arguments directly here)
mysql_install_db "${installArgs[@]}" "${@:2}"
echo 'Database initialized'

SOCKET="$(_get_config 'socket' "$@")"
Expand Down Expand Up @@ -135,7 +143,6 @@ if [ "$1" = 'mysqld' -a -z "$wantHelp" ]; then
-- What's done in this file shouldn't be replicated
-- or products like mysql-fabric won't work
SET @@SESSION.SQL_LOG_BIN=0;
DELETE FROM mysql.user WHERE user NOT IN ('mysql.sys', 'mysqlxsys', 'root') OR host NOT IN ('localhost') ;
SET PASSWORD FOR 'root'@'localhost'=PASSWORD('${MYSQL_ROOT_PASSWORD}') ;
GRANT ALL ON *.* TO 'root'@'localhost' WITH GRANT OPTION ;
Expand All @@ -162,8 +169,6 @@ if [ "$1" = 'mysqld' -a -z "$wantHelp" ]; then
if [ "$MYSQL_DATABASE" ]; then
echo "GRANT ALL ON \`$MYSQL_DATABASE\`.* TO '$MYSQL_USER'@'%' ;" | "${mysql[@]}"
fi

echo 'FLUSH PRIVILEGES ;' | "${mysql[@]}"
fi

echo
Expand Down
2 changes: 1 addition & 1 deletion .travis/script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ else
export COMPOSE_FILE=.travis/galera-compose.yml

urlString='jdbc:mariadb://mariadb.example.com:3106/testj?user=bob&enablePacketDebug=true'
cmd+=( -DdefaultGaleraUrl="jdbc:mariadb:failover://mariadb.example.com:3106,mariadb.example.com:3107,mariadb.example.com:3108/testj?user=bob&enablePacketDebug=true" )
cmd+=( -DdefaultGaleraUrl="jdbc:mariadb:sequential://mariadb.example.com:3106,mariadb.example.com:3107,mariadb.example.com:3108/testj?user=bob&enablePacketDebug=true" -DdefaultSequentialUrl="jdbc:mariadb:sequential://mariadb.example.com:3106,mariadb.example.com:3107,mariadb.example.com:3108/testj?user=bob&enablePacketDebug=true" -DdefaultLoadbalanceUrl="jdbc:mariadb:loadbalance://mariadb.example.com:3106,mariadb.example.com:3107,mariadb.example.com:3108/testj?user=bob&enablePacketDebug=true" )
docker-compose -f ${COMPOSE_FILE} up -d
SLEEP 10
else
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Tracker link <a href="https://jira.mariadb.org/projects/CONJ/issues/">https://ji
|:------------:|:-------------------------:|
| 6 | 1.7.4 |
| 7 | 1.7.4 |
| 8+ | 2.4.1 |
| 8+ | 2.4.2 |

The driver (jar) can be downloaded from [mariadb connector download](https://mariadb.com/products/connectors-plugins)
or maven :
Expand Down
1 change: 1 addition & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
comment: off
15 changes: 15 additions & 0 deletions documentation/changelog.creole
Original file line number Diff line number Diff line change
@@ -1,4 +1,19 @@

== 2.4.2 - Released on 17 Jun. 2019

Security
* [CONJ-679] parse Query when receiving LOAD LOCAL INFILE
Bugs
* [CONJ-703] ClassNotFoundException when trying to connect using two-authentication in an OSGI environment.
* [CONJ-711] Xid format id is unsigned integer, currently sending as signed value.
* [CONJ-700] autoReconnect=true on Basic Failover doesn't reconnect
* [CONJ-707] failover might throw an unexpected exception with using "failover"/"sequential" configuration on socket error
* [CONJ-709] includeThreadDumpInDeadlockExceptions is thrown only if option includeInnodbStatusInDeadlockExceptions is set
* [CONJ-710] Throw complete stackTrace when having an exception on XA Commands
* [CONJ-714] Error on connection on galera server when in detached mode.
* [CONJ-701] typo in error message in SelectResultSet.java
== 2.4.1 - Released on 15 Mar. 2019

Evolutions
Expand Down
4 changes: 2 additions & 2 deletions documentation/use-mariadb-connector-j-driver.creole
Original file line number Diff line number Diff line change
Expand Up @@ -208,10 +208,10 @@ The fastest way to load lots of data is using [[https://mariadb.com/kb/en/mariad
* A "man in the middle" proxy server can change the actual file requested from the server so the client will send a local file to this proxy.
* if someone can execute a query from the client, he can have access to any file on the client (according to the rights of the user running the client process).
A specific option "allowLocalInfile" (default to true) can deactivate functionality on the client side.
A specific option "allowLocalInfile" (default to false) permit to enable functionality on the client side.
The global variable [[server-system-variables#local_infile|local_infile]] can disable LOAD DATA LOCAL INFILE on the server side.

A non-JDBC method can permit using this kind of query without this security issue: The application has to create an InputStream with the file to load. If MariaDbStatement.setLocalInfileInputStream(InputStream inputStream) is set, the inputStream will be sent to the server, replacing the file content (working even with the "allowLocalInfile" option disabled).
A non-JDBC method can permit using this kind of query without this security issue: The application has to create an InputStream with the file to load. If MariaDbStatement.setLocalInfileInputStream(InputStream inputStream) is set, the inputStream will be sent to the server, replacing the file content.

Code example:
{{{
Expand Down
37 changes: 7 additions & 30 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
<artifactId>mariadb-java-client</artifactId>
<packaging>jar</packaging>
<name>mariadb-java-client</name>
<version>2.4.1</version>
<version>2.4.2</version>
<description>JDBC driver for MariaDB and MySQL</description>
<url>https://mariadb.com/kb/en/mariadb/about-mariadb-connector-j/</url>

Expand All @@ -71,7 +71,7 @@
<checkstyle.plugin.version>2.17</checkstyle.plugin.version>
<driver.version.major>2</driver.version.major>
<driver.version.minor>4</driver.version.minor>
<driver.version.patch>1</driver.version.patch>
<driver.version.patch>2</driver.version.patch>
<driver.version.qualifier></driver.version.qualifier>
</properties>

Expand Down Expand Up @@ -149,6 +149,9 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.10.4</version>
<configuration>
<source>8</source>
</configuration>
<executions>
<execution>
<id>attach-javadocs</id>
Expand Down Expand Up @@ -255,35 +258,11 @@
<prefix>git</prefix>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.4.0</version>
<executions>
<execution>
<phase>install</phase>
<goals>
<goal>exec</goal>
</goals>
</execution>
</executions>
<configuration>
<executable>git</executable>
<arguments>
<argument>archive</argument>
<argument>--format</argument>
<argument>tar.gz</argument>
<argument>--output</argument>
<argument>${project.name}-${git.commit.id.describe}.tar.gz</argument>
<argument>${git.branch}</argument>
</arguments>
</configuration>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.0.2</version>
<version>3.1.2</version>
<configuration>
<archive>
<manifestFile>src/main/resources/META-INF/MANIFEST.MF</manifestFile>
Expand All @@ -294,9 +273,7 @@
<Bundle-SymbolicName>org.mariadb.jdbc</Bundle-SymbolicName>
<Automatic-Module-Name>org.mariadb.jdbc</Automatic-Module-Name>
<Export-Package>org.mariadb.jdbc</Export-Package>
<Import-Package>
javax.naming,javax.management,javax.net;resolution:=optional,javax.net.ssl;resolution:=optional,javax.sql,javax.transaction.xa;resolution:=optional,org.slf4j;resolution:=optional
</Import-Package>
<Import-Package>javax.naming, javax.management, javax.net;resolution:=optional, javax.net.ssl;resolution:=optional, javax.sql, javax.transaction.xa;resolution:=optional, waffle.windows.auth;resolution:=optional, waffle.windows.auth.impl;resolution:=optional, * </Import-Package>
</manifestEntries>
</archive>
</configuration>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ protected boolean executeInternal(int fetchSize) throws SQLException {
executeQueryPrologue(false);
results = new Results(this, fetchSize, false, 1, false, resultSetScrollType,
resultSetConcurrency, autoGeneratedKeys,
protocol.getAutoIncrementIncrement());
protocol.getAutoIncrementIncrement(), sqlQuery, parameters);
if (queryTimeout != 0 && canUseServerTimeout) {
//timer will not be used for timeout to avoid having threads
protocol.executeQuery(protocol.isMasterConnection(), results, prepareResult, parameters,
Expand Down Expand Up @@ -355,7 +355,7 @@ public long[] executeLargeBatch() throws SQLException {
private void executeInternalBatch(int size) throws SQLException {
executeQueryPrologue(true);
results = new Results(this, 0, true, size, false, resultSetScrollType,
resultSetConcurrency, autoGeneratedKeys, protocol.getAutoIncrementIncrement());
resultSetConcurrency, autoGeneratedKeys, protocol.getAutoIncrementIncrement(), null, null);
if (protocol
.executeBatchClient(protocol.isMasterConnection(), results, prepareResult, parameterList,
hasLongData)) {
Expand Down
11 changes: 4 additions & 7 deletions src/main/java/org/mariadb/jdbc/MariaDbConnection.java
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@
import java.util.concurrent.locks.ReentrantLock;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import org.mariadb.jdbc.internal.logging.Logger;
import org.mariadb.jdbc.internal.logging.LoggerFactory;
import org.mariadb.jdbc.internal.protocol.Protocol;
Expand Down Expand Up @@ -255,7 +256,7 @@ public Statement createStatement(final int resultSetType, final int resultSetCon

private void checkConnection() throws SQLException {
if (protocol.isExplicitClosed()) {
throw new SQLException("createStatement() is called on closed connection");
throw new SQLNonTransientConnectionException("createStatement() is called on closed connection");
}
if (protocol.isClosed() && protocol.getProxy() != null) {
lock.lock();
Expand Down Expand Up @@ -1673,11 +1674,7 @@ public void abort(Executor executor) throws SQLException {
* @throws SQLException if database socket error occur
*/
public int getNetworkTimeout() throws SQLException {
try {
return this.protocol.getTimeout();
} catch (SocketException se) {
throw ExceptionMapper.getSqlException("Cannot retrieve the network timeout", se);
}
return this.protocol.getTimeout();
}

public String getSchema() {
Expand Down Expand Up @@ -1790,6 +1787,6 @@ public boolean includeDeadLockInfo() {
}

public boolean includeThreadsTraces() {
return options.includeInnodbStatusInDeadlockExceptions;
return options.includeThreadDumpInDeadlockExceptions;
}
}
Loading

0 comments on commit c160500

Please sign in to comment.