Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow building the MySQL driver with MariaDB libraries. #506

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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