Skip to content

Commit

Permalink
Merge pull request #506 from dveeden/mysql__compression_alg__mariadb
Browse files Browse the repository at this point in the history
Allow building the MySQL driver with MariaDB libraries.
  • Loading branch information
akopytov authored Jul 28, 2024
2 parents 2ca9e3f + 0f27db3 commit de18a03
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 2 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 6 additions & 0 deletions src/drivers/mysql/drv_mysql.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)",
Expand Down
3 changes: 1 addition & 2 deletions tests/t/help_drv_mysql.t
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,14 @@ 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]
--mysql-socket=[LIST,...] MySQL socket
--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
Expand Down

0 comments on commit de18a03

Please sign in to comment.