Skip to content

Improvements for database handle and connection attributes #53

Improvements for database handle and connection attributes

Improvements for database handle and connection attributes #53

Workflow file for this run

name: CI
on:
push:
branches: '*'
pull_request:
branches: '*'
jobs:
build-matrix:
runs-on: ubuntu-latest
steps:
- uses: mikefarah/yq@master
- name: Build matrix
id: set-matrix
run: |
# For each perl-version, dbi-version, server-version and client-version from below list
# create build matrix with tupples filled up with default versions of other field. Plus
# include combinations specified in include list. Default version is the last specified
# in every field. This reduced number of jobs because full build matrix is too big.
{ printf "matrix="; yq -o=json '.' | jq -M -c '{ "include" : [ . as $top | del(.include) | map_values(last) as $defaults | ( $top | (keys | map(select(. != "include"))[] | { (.) : $top[.][] }) , .include[] ) | . = $defaults * . ] }'; } << EOF >> $GITHUB_OUTPUT
perl-version:
- 5.8.1
- 5.8.2
- 5.8.8
- 5.8.9
- 5.10.0
- 5.12.0
- 5.14.0
- 5.16.0
- 5.18.0
- 5.20.0
- 5.22.0
- 5.24.0
- 5.26.0
- 5.28.0
- 5.30.0
- 5.32.0
- 5.34.0
- 5.36.0
- system
dbi-version:
- 1.627
- 1.641
- latest
server-version:
- mysql-4.1.22
- mysql-5.0.15
- mysql-5.0.96
- mysql-5.1.30
- mysql-5.1.72
- mysql-5.5.8
- mysql-5.5.47
- mysql-5.5.49
- mysql-5.5.54
- mysql-5.5.55
- mysql-5.5.56
- mysql-5.5.57
- mysql-5.5.58
- mysql-5.5.60
- mysql-5.5.62
- mysql-5.6.10
- mysql-5.6.30
- mysql-5.6.35
- mysql-5.6.36
- mysql-5.6.37
- mysql-5.6.38
- mysql-5.6.39
- mysql-5.6.40
- mysql-5.6.41
- mysql-5.6.43
- mysql-5.6.45
- mysql-5.7.8-rc
- mysql-5.7.11
- mysql-5.7.12
- mysql-5.7.17
- mysql-5.7.18
- mysql-5.7.19
- mysql-5.7.20
- mysql-5.7.21
- mysql-5.7.22
- mysql-5.7.23
- mysql-5.7.25
- mysql-5.7.27
- mysql-8.0.0-dmr
- mysql-8.0.1-dmr
- mysql-8.0.2-dmr
- mysql-8.0.3-rc
- mysql-8.0.4-rc
- mysql-8.0.11
- mysql-8.0.12
- mysql-8.0.13
- mysql-8.0.14
- mysql-8.0.15
- mysql-8.0.16
- mysql-8.0.17
- mariadb-5.5.40
- mariadb-5.5.44
- mariadb-5.5.47
- mariadb-5.5.52
- mariadb-5.5.54
- mariadb-5.5.55
- mariadb-5.5.56
- mariadb-5.5.57
- mariadb-5.5.58
- mariadb-5.5.59
- mariadb-5.5.60
- mariadb-5.5.61
- mariadb-5.5.63
- mariadb-5.5.65
- mariadb-10.0.14
- mariadb-10.0.20
- mariadb-10.0.23
- mariadb-10.0.29
- mariadb-10.0.30
- mariadb-10.0.31
- mariadb-10.0.32
- mariadb-10.0.34
- mariadb-10.0.36
- mariadb-10.0.38
- mariadb-10.1.2
- mariadb-10.1.8
- mariadb-10.1.11
- mariadb-10.1.20
- mariadb-10.1.22
- mariadb-10.1.24
- mariadb-10.1.30
- mariadb-10.1.31
- mariadb-10.1.33
- mariadb-10.1.36
- mariadb-10.1.37
- mariadb-10.1.38
- mariadb-10.1.41
- mariadb-10.2.0
- mariadb-10.2.1
# Incompatible, broken mysql_config
# - mariadb-10.2.2
# - mariadb-10.2.3
- mariadb-10.2.4
- mariadb-10.2.5
- mariadb-10.2.6
- mariadb-10.2.7
- mariadb-10.2.8
- mariadb-10.2.9
- mariadb-10.2.10
- mariadb-10.2.11
- mariadb-10.2.12
- mariadb-10.2.13
- mariadb-10.2.15
- mariadb-10.2.18
- mariadb-10.2.19
- mariadb-10.2.20
- mariadb-10.2.21
- mariadb-10.2.22
- mariadb-10.2.26
- mariadb-10.3.0
- mariadb-10.3.1
- mariadb-10.3.2
- mariadb-10.3.3
- mariadb-10.3.4
- mariadb-10.3.6
- mariadb-10.3.7
- mariadb-10.3.8
- mariadb-10.3.10
- mariadb-10.3.11
- mariadb-10.3.12
- mariadb-10.3.17
- mariadb-10.4.0
- mariadb-10.4.1
- mariadb-10.4.2
# Incompatible, unsupported by MySQL::Sandbox
# - mariadb-10.4.3
# - mariadb-10.4.4
# - mariadb-10.4.5
# - mariadb-10.4.6
# - mariadb-10.4.7
- system
client-version:
- mysqlconc-6.0.0-beta
- mysqlconc-6.0.2
- mysqlconc-6.1.0
- mysqlconc-6.1.9
- mysqlconc-6.1.10
- mysqlconc-6.1.11
- mysqlconc-6.2.0-labs
# Incompatible, broken buffer for prepared statements
# - mariadbconc-2.2.0
# - mariadbconc-2.2.3
# - mariadbconc-2.3.0
- mariadbconc-2.3.1
- mariadbconc-2.3.2
- mariadbconc-2.3.3
- mariadbconc-2.3.4
- mariadbconc-2.3.5
- mariadbconc-2.3.6
- mariadbconc-2.3.7
# Incompatible, client library freeze
# - mariadbconc-3.0.0-alpha
# Incompatible, missing header files
# - mariadbconc-3.0.1-beta
- mariadbconc-3.0.2
# Incompatible, broken buffer for prepared statements
# - mariadbconc-3.0.3
- mariadbconc-3.0.4
- mariadbconc-3.0.5
- mariadbconc-3.0.6
- mariadbconc-3.0.7
- mariadbconc-3.0.8
- mariadbconc-3.0.9
- mariadbconc-3.0.10
- mariadbconc-3.1.0
- mariadbconc-3.1.1
- mariadbconc-3.1.2
- mariadbconc-3.1.3
- system
- same-as-server
include:
- server-version: mysql-5.0.96
client-version: mariadbconc-2.3.4
- server-version: mysql-5.1.72
client-version: mariadbconc-3.0.2
- server-version: mariadb-5.5.40
client-version: mysqlconc-6.1.11
- server-version: mysql-8.0.3-rc
client-version: mariadbconc-2.3.0
- server-version: mariadb-10.3.3
client-version: mysqlconc-6.0.0-beta
- server-version: mariadb-10.3.3
client-version: mysqlconc-6.1.11
- server-version: mysql-8.0.3-rc
client-version: mariadbconc-3.0.2
- server-version: mysql-5.6.38
client-version: mysqlconc-6.1.11
- server-version: mariadb-10.1.30
client-version: mariadbconc-3.0.2
- server-version: mysql-4.1.22
client-version: mariadbconc-3.0.6
- server-version: none
client-version: system
- perl-version: 5.12.0
dbi-version: 1.608
EOF
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
build-n-test:
name: perl-${{ matrix.perl-version }}/${{ matrix.server-version }}/${{ matrix.client-version }}/dbi-${{ matrix.dbi-version }}
needs: build-matrix
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.build-matrix.outputs.matrix) }}
steps:
- name: Checkout git commit ${{ github.sha }}
if: github.event_name != 'pull_request'
uses: actions/checkout@v3
with:
ref: ${{ github.sha }}
- name: Checkout git commit ${{ github.event.pull_request.head.sha }} (fixup for pull request)
if: github.event_name == 'pull_request'
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Setup cpan sources cache
uses: actions/cache@v3
with:
path: ~/.cpan/sources
key: cache-cpan
- name: Install client dependences (1)
if: ${{ matrix.client-version != 'system' && ( matrix.server-version != 'system' || matrix.client-version != 'same-as-server' ) }}
uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: libgnutls28-dev libncurses5 libncursesw5 libstdc++5
version: 1.0
- name: Install client dependences (2)
if: ${{ matrix.client-version != 'system' && ( matrix.server-version != 'system' || matrix.client-version != 'same-as-server' ) }}
run: |
wget --progress=bar:force http://security.ubuntu.com/ubuntu/pool/main/o/openssl1.0/libssl1.0.0_1.0.2n-1ubuntu5_amd64.deb -O /tmp/libssl1.0.0_1.0.2n-1ubuntu5_amd64.deb
wget --progress=bar:force http://security.ubuntu.com/ubuntu/pool/universe/j/jemalloc/libjemalloc1_3.6.0-11_amd64.deb -O /tmp/libjemalloc1_3.6.0-11_amd64.deb
sudo dpkg -i /tmp/libssl1.0.0_1.0.2n-1ubuntu5_amd64.deb /tmp/libjemalloc1_3.6.0-11_amd64.deb
- name: Install MariaDB client system
if: ${{ matrix.client-version == 'system' || ( matrix.server-version == 'system' && matrix.client-version == 'same-as-server' ) }}
uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: libmariadb-dev
version: 1.0
- name: Install MariaDB server system
if: ${{ matrix.server-version == 'system' }}
run: |
sudo apt install mariadb-server
sudo systemctl start mariadb.service
sudo mariadb -e "GRANT ALL PRIVILEGES ON test.* TO 'test'@'localhost' IDENTIFIED BY 'test'"
- name: Install Perl system
if: ${{ matrix.perl-version == 'system' }}
uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: perl cpanminus liblocal-lib-perl
version: 1.0
- name: Install Perl ${{ matrix.perl-version }}
if: ${{ matrix.perl-version != 'system' }}
uses: shogo82148/actions-setup-perl@v1
with:
perl-version: ${{ matrix.perl-version }}
- name: Download and Install MariaDB/MySQL server ${{ matrix.server-version }} and client ${{ matrix.client-version }}
run: |
if [ "${{ matrix.perl-version }}" = "system" ]; then
eval $(perl -I"$HOME/perl5/lib/perl5" -Mlocal::lib)
fi
mkdir -p "$HOME/cache"
case "${{ matrix.server-version }}" in
mysql*) DB=MySQL ;;
mariadb*) DB=MariaDB ;;
none) DB=""; ;;
system) DB=""; ;;
*) DB=unknown ;;
esac
case "${{ matrix.client-version }}" in
mysql*) CONC_DB=MySQL ;;
mariadb*) CONC_DB=MariaDB ;;
system) CONC_DB=""; ;;
system-pic) CONC_DB=""; ;;
same-as-server) CONC_DB=""; ;;
*) CONC_DB=unknown ;;
esac
VERSION=`echo "${{ matrix.server-version }}" | sed 's/^[^-]*-//'`
CONC_VERSION=`echo "${{ matrix.client-version }}" | sed 's/^[^-]*-//'`
if [ "$DB" = "MySQL" ]; then
case "$VERSION" in
4.1.*) SANDBOX_URL=https://mysql.linux.cz/Downloads/MySQL-4.1/mysql-standard-$VERSION-unknown-linux-gnu-x86_64-glibc23.tar.gz ;;
5.0.[012]*) SANDBOX_URL=https://downloads.mysql.com/archives/get/p/23/file/mysql-standard-$VERSION-linux-x86_64-glibc23.tar.gz ;;
5.[01].*) SANDBOX_URL=https://downloads.mysql.com/archives/get/p/23/file/mysql-$VERSION-linux-x86_64-glibc23.tar.gz ;;
5.5.?) SANDBOX_URL=https://dev.mysql.com/get/mysql-$VERSION-linux2.6-x86_64.tar.gz ;;
5.5.[1234]*) SANDBOX_URL=https://dev.mysql.com/get/mysql-$VERSION-linux2.6-x86_64.tar.gz ;;
5.5.5[012345]*) SANDBOX_URL=https://dev.mysql.com/get/mysql-$VERSION-linux2.6-x86_64.tar.gz ;;
5.5.56*) SANDBOX_URL=https://dev.mysql.com/get/mysql-$VERSION-linux-glibc2.5-x86_64.tar.gz ;;
5.5.*) SANDBOX_URL=https://dev.mysql.com/get/mysql-$VERSION-linux-glibc2.12-x86_64.tar.gz ;;
5.6.[12]*) SANDBOX_URL=https://dev.mysql.com/get/mysql-$VERSION-linux-glibc2.5-x86_64.tar.gz ;;
5.6.3[0123456]*) SANDBOX_URL=https://dev.mysql.com/get/mysql-$VERSION-linux-glibc2.5-x86_64.tar.gz ;;
5.6.*) SANDBOX_URL=https://dev.mysql.com/get/mysql-$VERSION-linux-glibc2.12-x86_64.tar.gz ;;
5.7.19*|5.7.[2]*) SANDBOX_URL=https://dev.mysql.com/get/mysql-$VERSION-linux-glibc2.12-x86_64.tar.gz ;;
5.7.*) SANDBOX_URL=https://dev.mysql.com/get/mysql-$VERSION-linux-glibc2.5-x86_64.tar.gz ;;
8.0.?-*|8.0.11) SANDBOX_URL=https://dev.mysql.com/get/mysql-$VERSION-linux-glibc2.12-x86_64.tar.gz ;;
8.0.*) SANDBOX_URL=https://dev.mysql.com/get/mysql-$VERSION-linux-glibc2.12-x86_64.tar.xz ;;
*) echo "Unsupported MySQL version '$VERSION'"; exit 1 ;;
esac
SANDBOX_CACHE_FILE="$HOME/cache/$(basename "$SANDBOX_URL")"
elif [ "$DB" = "MariaDB" ]; then
case "$VERSION" in
5.*|10.[012].*) SANDBOX_URL=https://downloads.mariadb.com/MariaDB/mariadb-$VERSION/bintar-linux-x86_64/mariadb-$VERSION-linux-x86_64.tar.gz ;;
10.[34].*) SANDBOX_URL=https://downloads.mariadb.com/MariaDB/mariadb-$VERSION/bintar-linux-glibc_214-x86_64/mariadb-$VERSION-linux-glibc_214-x86_64.tar.gz ;;
*) echo "Unsupported MariaDB version '$VERSION'"; exit 1 ;;
esac
SANDBOX_CACHE_FILE="$HOME/cache/$(basename "$SANDBOX_URL")"
elif [ -n "$DB" ]; then
echo "Unsupported DB '$DB'"; exit 1
fi
if [ -n "$DB" ]; then
export SANDBOX_HOME="$HOME/sandbox"
export SANDBOX_BINARY="$SANDBOX_HOME/binary"
export SANDBOX_FILE="$SANDBOX_HOME/$(basename "$SANDBOX_CACHE_FILE")"
if [ ! -f "$SANDBOX_CACHE_FILE" ]; then wget --progress=bar:force "$SANDBOX_URL" -O "$SANDBOX_CACHE_FILE" || exit 1; fi
mkdir -p "$SANDBOX_HOME" || exit 1
ln -s "$SANDBOX_CACHE_FILE" "$SANDBOX_FILE" || exit 1
if [ `echo "$VERSION" | sed 's/\.//;s/\..*//'` -ge 55 ]; then
SANDBOX_OPTIONS="$SANDBOX_OPTIONS --init_options=--innodb_use_native_aio=0 --my_clause=innodb_use_native_aio=0 --my_clause=performance_schema=ON"
fi
fi
if [ "$CONC_DB" = "MySQL" ]; then
case "$CONC_VERSION" in
*-labs) CONC_URL=https://downloads.mysql.com/snapshots/pb/mysql-connector-c-$CONC_VERSION/mysql-connector-c-$CONC_VERSION-linux-glibc2.5-x86_64.tar.gz ;;
6.0.*) CONC_URL=https://dev.mysql.com/get/mysql-connector-c-$CONC_VERSION-linux-glibc2.3-x86-64bit.tar.gz ;;
6.1.[0123456789]) CONC_URL=https://dev.mysql.com/get/mysql-connector-c-$CONC_VERSION-linux-glibc2.5-x86_64.tar.gz ;;
6.1.*) CONC_URL=https://dev.mysql.com/get/mysql-connector-c-$CONC_VERSION-linux-glibc2.12-x86_64.tar.gz ;;
*) echo "Unsupported MySQL Connector/C version '$CONC_VERSION'"; exit 1 ;;
esac
CONC_FILE="$HOME/cache/$(basename "$CONC_URL")"
elif [ "$CONC_DB" = "MariaDB" ]; then
CONC_URL=https://downloads.mariadb.com/Connectors/c/connector-c-${CONC_VERSION/-*/}/mariadb-connector-c-$CONC_VERSION-linux-x86_64.tar.gz
CONC_FILE="$HOME/cache/mariadb-connector-c-$CONC_VERSION-linux-x86_64.tar.gz"
elif [ -n "$CONC_DB" ]; then
echo "Unsupported Connector/C '$CONC_DB'"; exit 1
fi
if [ -n "$CONC_DB" ]; then
if [ ! -f "$CONC_FILE" ]; then wget --progress=bar:force "$CONC_URL" -O "$CONC_FILE" || exit 1; fi
fi
if [ "${{ matrix.client-version }}" = "system-pic" ]; then
sed 's/-L\$pkglibdir *-lmysqld/-L\/usr\/lib\/mysql -lmysqld_pic /' `which mysql_config_pic` > "$HOME/mysql_config_pic"
chmod +x $HOME/mysql_config_pic
apt download mysql-server-core-5.5
dpkg -x mysql-server-core-5.5_*.deb $HOME/mysql-server-core-5.5
fi
if [ -n "$DB" ]; then
cpanm --quiet --notest --skip-satisfied MySQL::Sandbox || exit 1
if [[ $SANDBOX_FILE =~ .xz$ ]]; then
unxz < "$SANDBOX_FILE" | gzip -1 > "${SANDBOX_FILE%.xz}.gz"
SANDBOX_FILE="${SANDBOX_FILE%.xz}.gz"
fi
make_sandbox --export_binaries "$SANDBOX_FILE" -- --sandbox_port 3310 --sandbox_directory msb --no_confirm --verbose $SANDBOX_OPTIONS || exit 1
sed 's/-lzlib //g' -i $SANDBOX_HOME/*/bin/mysql_config
rm -f $SANDBOX_HOME/*/bin/mariadb_config
printf '#!/bin/sh\nexec %s/msb/my sql_config "$@"\n' $SANDBOX_HOME > "$HOME/mysql_config"
chmod +x $HOME/mysql_config
fi
if [ -n "$CONC_DB" ]; then
mkdir -p "$HOME/conc"
tar --strip-components=1 --directory="$HOME/conc" -xf "$CONC_FILE" || exit 1
if $HOME/conc/bin/mysql_config 2>&1 | grep -q /usr/local; then
rm -f $HOME/conc/bin/mysql_config
fi
if [ -x $HOME/conc/bin/mysql_config ]; then
sed 's/-l "/-lmysqlclient "/g' -i "$HOME/conc/bin/mysql_config" || exit 1
fi
fi
- name: Install dependences
run: |
if [ "${{ matrix.perl-version }}" = "system" ]; then
eval $(perl -I"$HOME/perl5/lib/perl5" -Mlocal::lib)
fi
perl '-MExtUtils::MakeMaker 7.00' -e '' || cpanm --quiet --notest ExtUtils::[email protected]
perl '-MCPAN::Meta 2.112580' -e '' || cpanm --quiet --notest CPAN::[email protected]
perl '-Mv5.12' -e '' || cpanm --quiet --notest Test::[email protected]
if [ "${{ matrix.dbi-version }}" != "latest" ]; then cpanm --quiet --notest DBI@${{ matrix.dbi-version }}; fi
cpanm --quiet --notest --skip-satisfied DBI~1.608 Devel::CheckLib~1.12
cpanm --quiet --notest --skip-satisfied --installdeps --with-configure --with-develop --with-recommends --with-suggests .
- name: Configure
run: |
if [ "${{ matrix.perl-version }}" = "system" ]; then
eval $(perl -I"$HOME/perl5/lib/perl5" -Mlocal::lib)
fi
if [ "${{ matrix.server-version }}" = "system" ]; then
export DBD_MARIADB_TESTUSER=test
export DBD_MARIADB_TESTPASSWORD=test
export DBD_MARIADB_TESTHOST=127.0.0.1
export DBD_MARIADB_TESTPORT=3306
elif [ "${{ matrix.server-version }}" = "none" ]; then
export DBD_MARIADB_TESTHOST=0.0.0.0
export DBD_MARIADB_TESTPORT=0
else
export DBD_MARIADB_TESTUSER=msandbox
export DBD_MARIADB_TESTPASSWORD=msandbox
export DBD_MARIADB_TESTHOST=127.0.0.1
export DBD_MARIADB_TESTPORT=3310
fi
if [ "${{ matrix.client-version }}" != "system" ] && [ "${{ matrix.client-version }}" != "system-pic" ] && [ "${{ matrix.client-version }}" != "same-as-server" ]; then
if [ -x $HOME/conc/bin/mysql_config ]; then
export DBD_MARIADB_CONFIG="$HOME/conc/bin/mysql_config"
else
INCLUDE_PATH=`find "$HOME/conc" -name "mysql.h" | sort | head -1`
if [ -z "$INCLUDE_PATH" ]; then echo "File mysql.h was not found"; exit 1; fi
LIB_PATH=`find "$HOME/conc" -name "lib*.so" | sort | head -1`
if [ -z "$INCLUDE_PATH" ]; then echo "File lib*.so was not found"; exit 1; fi
export DBD_MARIADB_CFLAGS="-I`dirname $INCLUDE_PATH`"
export DBD_MARIADB_LIBS="-L`dirname $LIB_PATH` -l`echo $LIB_PATH | sed 's/.*\/lib//;s/\.so//'`"
export DBD_MARIADB_CONFIG="skip"
fi
elif [ "${{ matrix.client-version }}" = "same-as-server" ] && [ "${{ matrix.server-version }}" != "system" ]; then
export DBD_MARIADB_CONFIG="$HOME/mysql_config"
elif [ "${{ matrix.client-version }}" = "system-pic" ]; then
export DBD_MARIADB_CONFIG="$HOME/mysql_config_pic"
fi
make realclean || true
perl Makefile.PL
- name: Build
run: |
if [ "${{ matrix.perl-version }}" = "system" ]; then
eval $(perl -I"$HOME/perl5/lib/perl5" -Mlocal::lib)
fi
make
- name: Test
run: |
if [ "${{ matrix.perl-version }}" = "system" ]; then
eval $(perl -I"$HOME/perl5/lib/perl5" -Mlocal::lib)
fi
if [ "${{ matrix.client-version }}" = "system-pic" ]; then
export DBD_MARIADB_TESTLANGDIR="$HOME/mysql-server-core-5.5/usr/share/mysql/english"
elif [ "${{ matrix.server-version }}" != "none" ] && [ "${{ matrix.server-version }}" != "system" ]; then
export DBD_MARIADB_TESTLANGDIR=`find $HOME/sandbox/* -name english | head -1`
fi
export HARNESS_OPTIONS=j4
export RELEASE_TESTING=1
if [ "${{ matrix.server-version }}" != "none" ]; then
export CONNECTION_TESTING=1
fi
make test