From e17ce0fa5970dacaa347c9613b1306014fc18c19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20van=20Eeden?= Date: Fri, 14 Jul 2023 14:27:03 +0200 Subject: [PATCH 1/3] Allow building the MySQL driver with MariaDB libraries. Closes #505 --- src/drivers/mysql/drv_mysql.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/drivers/mysql/drv_mysql.c b/src/drivers/mysql/drv_mysql.c index 5e9afba2..260e99da 100644 --- a/src/drivers/mysql/drv_mysql.c +++ b/src/drivers/mysql/drv_mysql.c @@ -109,7 +109,9 @@ typedef struct const char *ssl_ca; const char *ssl_cipher; unsigned char use_compression; +#ifdef MYSQL_OPT_COMPRESSION_ALGORITHMS const char *compression_alg; +#endif unsigned char debug; sb_list_t *ignored_errors; unsigned int dry_run; @@ -337,7 +339,9 @@ int mysql_drv_init(void) #endif args.use_compression = sb_get_value_flag("mysql-compression"); +#ifdef MYSQL_OPT_COMPRESSION_ALGORITHMS args.compression_alg = sb_get_value_string("mysql-compression-algorithms"); +#endif args.debug = sb_get_value_flag("mysql-debug"); if (args.debug) @@ -416,8 +420,10 @@ static int mysql_drv_real_connect(db_mysql_conn_t *db_mysql_con) DEBUG("mysql_options(%p, %s, %s)",con, "MYSQL_OPT_COMPRESS", "NULL"); mysql_options(con, MYSQL_OPT_COMPRESS, NULL); +#ifdef MYSQL_OPT_COMPRESSION_ALGORITHMS DEBUG("mysql_options(%p, %s, %s)",con, "MYSQL_OPT_COMPRESSION_ALGORITHMS", args.compression_alg); mysql_options(con, MYSQL_OPT_COMPRESSION_ALGORITHMS, args.compression_alg); +#endif } DEBUG("mysql_real_connect(%p, \"%s\", \"%s\", \"%s\", \"%s\", %u, \"%s\", %s)", From fae19ba27cb84efbe8c07c7eca0bc2434aff907e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20van=20Eeden?= Date: Fri, 14 Jul 2023 14:45:08 +0200 Subject: [PATCH 2/3] CI: Test also with MariaDB --- .github/workflows/ci.yml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 37a0c3cc..ffd23548 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -24,3 +24,28 @@ jobs: - name: Test run: make test + build_mariadb: + runs-on: ubuntu-22.04 + name: Build with MariaDB + steps: + - name: Setup MariaDB Repo + run: | + sudo apt-get install software-properties-common + sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8 + sudo add-apt-repository 'deb [arch=amd64] https://ftp.nluug.nl/db/mariadb/repo/11.0/ubuntu jammy main' + - name: Setup MariaDB Libs + run: sudo apt install libmariadb-dev libmariadb-dev-compat + - name: Checkout + uses: actions/checkout@v3 + - name: Autogen + run: ./autogen.sh + - name: Configure + run: ./configure --with-mysql --with-pgsql + - name: Build + run: make + - name: MariaDB version + run: mariadb_config --version + - name: Sysbench version + run: ./src/sysbench --version + - name: Test + run: make test From 0f27db3b8a2997d2fd3daf48f42a2d27e99ed957 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20van=20Eeden?= Date: Fri, 14 Jul 2023 15:15:51 +0200 Subject: [PATCH 3/3] Allow mysql-ssl option to differ --- tests/t/help_drv_mysql.t | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/t/help_drv_mysql.t b/tests/t/help_drv_mysql.t index da7d69de..7b2cfac7 100644 --- a/tests/t/help_drv_mysql.t +++ b/tests/t/help_drv_mysql.t @@ -8,7 +8,7 @@ Skip test if the MySQL driver is not available. $ sysbench --help | grep -- '--db-driver' --db-driver=STRING specifies database driver to use ('help' to get list of available drivers) [mysql] - $ sysbench --help | sed -n '/mysql options:/,/^$/p' + $ sysbench --help | sed -n '/mysql options:/,/^$/p' | grep -v 'mysql-ssl[=\[]' mysql options: --mysql-host=[LIST,...] MySQL server host [localhost] --mysql-port=[LIST,...] MySQL server port [3306] @@ -16,7 +16,6 @@ Skip test if the MySQL driver is not available. --mysql-user=STRING MySQL user [sbtest] --mysql-password=STRING MySQL password [] --mysql-db=STRING MySQL database name [sbtest] - --mysql-ssl=STRING SSL mode. This accepts the same values as the --ssl-mode option in the MySQL client utilities. Disabled by default [disabled] --mysql-ssl-key=STRING path name of the client private key file --mysql-ssl-ca=STRING path name of the CA file --mysql-ssl-cert=STRING path name of the client public key certificate file