From 90ca096bc88e0f147c651390a04b6e372aa36eb9 Mon Sep 17 00:00:00 2001 From: Timofey Turenko Date: Mon, 27 Aug 2018 14:47:00 +0300 Subject: [PATCH 01/11] add twomaxscales_full template --- maxscale-system-test/mdbci/set_env.sh | 9 +- .../mdbci/set_run_test_variables.sh | 2 +- .../templates/twomaxscales_full.json.template | 116 ++++++++++++++++++ 3 files changed, 122 insertions(+), 5 deletions(-) create mode 100644 maxscale-system-test/mdbci/templates/twomaxscales_full.json.template diff --git a/maxscale-system-test/mdbci/set_env.sh b/maxscale-system-test/mdbci/set_env.sh index 8461744c3..a27c8dca6 100644 --- a/maxscale-system-test/mdbci/set_env.sh +++ b/maxscale-system-test/mdbci/set_env.sh @@ -24,9 +24,6 @@ export maxscale_N=`cat "$MDBCI_VM_PATH/$config_name"_network_config | grep maxsc sed "s/^/export /g" "$MDBCI_VM_PATH/$config_name"_network_config > "$curr_dir"/"$config_name"_network_config_export source "$curr_dir"/"$config_name"_network_config_export -# IP Of MaxScale machine -export maxscale_IP=$maxscale_network -export maxscale_sshkey=$maxscale_keyfile # User name and Password for Master/Slave replication setup (should have all PRIVILEGES) export node_user="skysql" @@ -83,9 +80,13 @@ do done done -export maxscale_access_user=$maxscale_whoami +export maxscale_access_user=$maxscale_000_whoami export maxscale_access_sudo="sudo " +# IP Of MaxScale machine +export maxscale_IP=$maxscale_000_IP +export maxscale_sshkey=$maxscale_000_keyfile + # Sysbench directory (should be sysbench >= 0.5) export sysbench_dir=${sysbench_dir:-"$HOME/sysbench_deb7/sysbench/"} diff --git a/maxscale-system-test/mdbci/set_run_test_variables.sh b/maxscale-system-test/mdbci/set_run_test_variables.sh index 152d4f229..4c515a04c 100644 --- a/maxscale-system-test/mdbci/set_run_test_variables.sh +++ b/maxscale-system-test/mdbci/set_run_test_variables.sh @@ -8,7 +8,7 @@ echo "MDBCI_VM_PATH=$MDBCI_VM_PATH" export box=${box:-"centos_7_libvirt"} echo "box=$box" -export template=${template:-"default"} +export template=${template:-"twomaxscales_full"} export curr_date=`date '+%Y-%m-%d_%H-%M'` diff --git a/maxscale-system-test/mdbci/templates/twomaxscales_full.json.template b/maxscale-system-test/mdbci/templates/twomaxscales_full.json.template new file mode 100644 index 000000000..368900fcc --- /dev/null +++ b/maxscale-system-test/mdbci/templates/twomaxscales_full.json.template @@ -0,0 +1,116 @@ +{ + "node_000" : + { + "hostname" : "node000", + "box" : "${backend_box}", + "memory_size" : "${vm_memory}", + "product" : { + "name": "${product}", + "version": "${version}", + "cnf_template" : "server1.cnf", + "cnf_template_path": "${cnf_path}" + } + + }, + + "node_001" : + { + "hostname" : "node001", + "box" : "${backend_box}", + "memory_size" : "${vm_memory}", + "product" : { + "name": "${product}", + "version": "${version}", + "cnf_template" : "server2.cnf", + "cnf_template_path": "${cnf_path}" + } + }, + + "node_002" : + { + "hostname" : "node002", + "box" : "${backend_box}", + "memory_size" : "${vm_memory}", + "product" : { + "name": "${product}", + "version": "${version}", + "cnf_template" : "server3.cnf", + "cnf_template_path": "${cnf_path}" + } + }, + + "node_003" : + { + "hostname" : "node003", + "box" : "${backend_box}", + "memory_size" : "${vm_memory}", + "product" : { + "name": "${product}", + "version": "${version}", + "cnf_template" : "server4.cnf", + "cnf_template_path": "${cnf_path}" + } + }, + "galera_001" : + { + "hostname" : "galera001", + "box" : "${backend_box}", + "memory_size" : "${vm_memory}", + "product" : { + "name": "galera", + "version": "${galera_version}", + "cnf_template" : "galera_server2.cnf", + "cnf_template_path": "${cnf_path}" + } + }, + + "galera_002" : + { + "hostname" : "galera002", + "box" : "${backend_box}", + "memory_size" : "${vm_memory}", + "product" : { + "name": "galera", + "version": "${galera_version}", + "cnf_template" : "galera_server3.cnf", + "cnf_template_path": "${cnf_path}" + } + }, + + "galera_003" : + { + "hostname" : "galera003", + "box" : "${backend_box}", + "memory_size" : "${vm_memory}", + "product" : { + "name": "galera", + "version": "${galera_version}", + "cnf_template" : "galera_server4.cnf", + "cnf_template_path": "${cnf_path}" + } + }, + + "maxscale_000" : + { + "hostname" : "maxscale", + "box" : "${box}", + "memory_size" : "${vm_memory}", + "product" : { + "name" : "maxscale_ci", + "version" : "${target}" + } + + }, + + "maxscale_001" : + { + "hostname" : "maxscale", + "box" : "${box}", + "memory_size" : "${vm_memory}", + "product" : { + "name" : "maxscale_ci", + "version" : "${target}" + } + + } +} From f4317121e1de3a52421f0a223d8bde562602a96d Mon Sep 17 00:00:00 2001 From: Timofey Turenko Date: Mon, 27 Aug 2018 22:37:45 +0300 Subject: [PATCH 02/11] fix galera nodes in twomaxscales_full template --- .../templates/twomaxscales_full.json.template | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/maxscale-system-test/mdbci/templates/twomaxscales_full.json.template b/maxscale-system-test/mdbci/templates/twomaxscales_full.json.template index 368900fcc..62a9c6224 100644 --- a/maxscale-system-test/mdbci/templates/twomaxscales_full.json.template +++ b/maxscale-system-test/mdbci/templates/twomaxscales_full.json.template @@ -51,6 +51,20 @@ "cnf_template_path": "${cnf_path}" } }, + + "galera_000" : + { + "hostname" : "galera000", + "box" : "${backend_box}", + "memory_size" : "${vm_memory}", + "product" : { + "name": "galera", + "version": "${galera_version}", + "cnf_template" : "galera_server1.cnf", + "cnf_template_path": "${cnf_path}" + } + }, + "galera_001" : { "hostname" : "galera001", From 7e5353dae82674b8f1513ae6f0b92b43c9e787fd Mon Sep 17 00:00:00 2001 From: Timofey Turenko Date: Tue, 28 Aug 2018 12:44:42 +0300 Subject: [PATCH 03/11] copy maxscale_000_XX to maxscale_XX variables in set_env.sh --- maxscale-system-test/mdbci/set_env.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/maxscale-system-test/mdbci/set_env.sh b/maxscale-system-test/mdbci/set_env.sh index a27c8dca6..29ae8fe96 100644 --- a/maxscale-system-test/mdbci/set_env.sh +++ b/maxscale-system-test/mdbci/set_env.sh @@ -84,9 +84,12 @@ export maxscale_access_user=$maxscale_000_whoami export maxscale_access_sudo="sudo " # IP Of MaxScale machine -export maxscale_IP=$maxscale_000_IP +export maxscale_network=$maxscale_000_network +export maxscale_keyfile=$maxscale_000_keyfile +export maxscale_IP=$maxscale_000_network export maxscale_sshkey=$maxscale_000_keyfile + # Sysbench directory (should be sysbench >= 0.5) export sysbench_dir=${sysbench_dir:-"$HOME/sysbench_deb7/sysbench/"} From 4887bce398882bae64e36baeac8879c1282994b0 Mon Sep 17 00:00:00 2001 From: Timofey Turenko Date: Tue, 28 Aug 2018 13:32:26 +0300 Subject: [PATCH 04/11] use different way to get own IP in keepalive tests --- maxscale-system-test/keepalived_func.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/maxscale-system-test/keepalived_func.cpp b/maxscale-system-test/keepalived_func.cpp index bf583cea5..33ed95305 100644 --- a/maxscale-system-test/keepalived_func.cpp +++ b/maxscale-system-test/keepalived_func.cpp @@ -1,4 +1,5 @@ #include "keepalived_func.h" +#include "get_my_ip.h" char * print_version_string(TestConnections * Test) { @@ -15,7 +16,8 @@ void configure_keepalived(TestConnections* Test, char * keepalived_file) int i; char client_ip[24]; char * last_dot; - Test->get_client_ip(0, client_ip); + //Test->get_client_ip(0, client_ip); + get_my_ip(Test->maxscales->IP[0], client_ip); last_dot = client_ip; Test->tprintf("My IP is %s\n", client_ip); for (i = 0; i < 3; i++) From 0ce183d7e3063e67e09dadd5f4863be491d005bb Mon Sep 17 00:00:00 2001 From: Timofey Turenko Date: Tue, 28 Aug 2018 16:00:53 +0300 Subject: [PATCH 05/11] stop monitor for all Maxscales in rw_slect_insert_test --- maxscale-system-test/rw_select_insert.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/maxscale-system-test/rw_select_insert.cpp b/maxscale-system-test/rw_select_insert.cpp index 1935c4499..f71de767b 100644 --- a/maxscale-system-test/rw_select_insert.cpp +++ b/maxscale-system-test/rw_select_insert.cpp @@ -129,7 +129,10 @@ int main(int argc, char *argv[]) Test->tprintf("Connecting to RWSplit %s\n", Test->maxscales->IP[0]); Test->maxscales->connect_rwsplit(0); - Test->maxscales->execute_maxadmin_command(0, (char *) "shutdown monitor MySQL-Monitor"); + for (i = 0; i < Test->maxscales->N; i++) + { + Test->maxscales->execute_maxadmin_command(i, (char *) "shutdown monitor MySQL-Monitor"); + } get_global_status_allnodes(&selects[0], &inserts[0], Test->repl, silent); From 4fd6d075cb03b898cf943093227846d48c0c47a0 Mon Sep 17 00:00:00 2001 From: Timofey Turenko Date: Wed, 29 Aug 2018 11:29:42 +0300 Subject: [PATCH 06/11] doc and astyle fixes --- maxscale-system-test/avro.cpp | 4 +-- maxscale-system-test/bug654.cpp | 2 +- .../connect_to_nonexisting_db.cpp | 6 ++-- maxscale-system-test/encrypted_passwords.cpp | 2 +- .../fail_switch_rejoin_common.cpp | 6 ++-- maxscale-system-test/failover_common.cpp | 8 ++--- maxscale-system-test/fwf.cpp | 2 +- maxscale-system-test/fwf2.cpp | 2 +- maxscale-system-test/fwf_reload.cpp | 2 +- maxscale-system-test/keepalived_func.cpp | 16 ++++----- .../keepalived_masterdown.cpp | 3 +- maxscale-system-test/kerberos_setup.cpp | 2 +- maxscale-system-test/mariadb_func.cpp | 5 +-- maxscale-system-test/mariadb_func.h | 2 +- maxscale-system-test/mariadb_nodes.cpp | 8 ++--- .../maxscale_process_user.cpp | 2 +- maxscale-system-test/mdbci/README.md | 3 +- .../mdbci/set_run_test_variables.sh | 2 +- .../mdbci/templates/default.json.template | 14 +++++++- ...son.template => onemaxscale.json.template} | 14 +------- maxscale-system-test/mxs1110_16mb.cpp | 8 ++--- maxscale-system-test/mxs1542.cpp | 4 +-- maxscale-system-test/mxs1583_fwf.cpp | 8 ++--- maxscale-system-test/mxs1585.cpp | 2 +- .../mxs1628_bad_handshake.cpp | 6 ++-- .../mxs1713_lots_of_databases.cpp | 6 ++-- maxscale-system-test/mxs1776_ps_exec_hang.cpp | 36 +++++++++---------- .../mxs1961_standalone_rejoin.cpp | 4 ++- maxscale-system-test/mxs729_maxadmin.cpp | 8 ++--- maxscale-system-test/mxs872_roles.cpp | 6 ++-- .../mxs874_slave_recovery.cpp | 2 +- .../mysqlmon_detect_standalone_master.cpp | 16 ++++----- .../mysqlmon_failover_no_slaves.cpp | 2 +- maxscale-system-test/mysqlmon_rejoin_bad.cpp | 10 +++--- maxscale-system-test/mysqlmon_rejoin_bad2.cpp | 4 +-- .../mysqlmon_rejoin_manual2.cpp | 10 +++--- maxscale-system-test/replication_manager.cpp | 2 +- maxscale-system-test/server_weight.cpp | 2 +- maxscale-system-test/slave_lag.cpp | 8 ++--- maxscale-system-test/test_binlog_fnc.cpp | 12 +++---- maxscale-system-test/testconnections.cpp | 34 +++++++++--------- 41 files changed, 153 insertions(+), 142 deletions(-) rename maxscale-system-test/mdbci/templates/{twomaxscales_full.json.template => onemaxscale.json.template} (91%) diff --git a/maxscale-system-test/avro.cpp b/maxscale-system-test/avro.cpp index 12daff13a..384ebe3d4 100644 --- a/maxscale-system-test/avro.cpp +++ b/maxscale-system-test/avro.cpp @@ -49,8 +49,8 @@ int main(int argc, char *argv[]) test.set_timeout(120); char * output = test.maxscales->ssh_node_output(0, - "maxavrocheck -d /var/lib/maxscale/avro/test.t1.000001.avro", - true, &exit_code); + "maxavrocheck -d /var/lib/maxscale/avro/test.t1.000001.avro", + true, &exit_code); std::istringstream iss; iss.str(output); diff --git a/maxscale-system-test/bug654.cpp b/maxscale-system-test/bug654.cpp index 30df767be..277d96861 100644 --- a/maxscale-system-test/bug654.cpp +++ b/maxscale-system-test/bug654.cpp @@ -63,7 +63,7 @@ int main(int argc, char *argv[]) char result[1024]; Test->maxscales->get_maxadmin_param(0, (char *) "show dbusers RW Split Router", (char *) "Incorrect number of arguments:", - result); + result); Test->tprintf("result %s\n", result); if (strstr(result, "show dbusers expects 1 argument") == NULL) diff --git a/maxscale-system-test/connect_to_nonexisting_db.cpp b/maxscale-system-test/connect_to_nonexisting_db.cpp index 44fcd1d1d..b671626a5 100644 --- a/maxscale-system-test/connect_to_nonexisting_db.cpp +++ b/maxscale-system-test/connect_to_nonexisting_db.cpp @@ -18,9 +18,9 @@ bool try_connect(TestConnections& test) bool rval = false; if (rwsplit && master && slave && - execute_query(rwsplit, "SELECT 1") == 0 && - execute_query(master, "SELECT 1") == 0 && - execute_query(slave, "SELECT 1") == 0) + execute_query(rwsplit, "SELECT 1") == 0 && + execute_query(master, "SELECT 1") == 0 && + execute_query(slave, "SELECT 1") == 0) { rval = true; diff --git a/maxscale-system-test/encrypted_passwords.cpp b/maxscale-system-test/encrypted_passwords.cpp index bd752038c..bd7b4ebeb 100644 --- a/maxscale-system-test/encrypted_passwords.cpp +++ b/maxscale-system-test/encrypted_passwords.cpp @@ -17,7 +17,7 @@ int create_key(TestConnections *test) true); test->maxscales->ssh_node(0, "maxkeys", true); char *result = test->maxscales->ssh_node_output(0, "sudo test -f /var/lib/maxscale/.secrets && echo SUCCESS", - false, &exit_code); + false, &exit_code); if (strncmp(result, "SUCCESS", 7) != 0) { diff --git a/maxscale-system-test/fail_switch_rejoin_common.cpp b/maxscale-system-test/fail_switch_rejoin_common.cpp index 765a39381..baf556d0d 100644 --- a/maxscale-system-test/fail_switch_rejoin_common.cpp +++ b/maxscale-system-test/fail_switch_rejoin_common.cpp @@ -23,11 +23,11 @@ void get_output(TestConnections& test) test.tprintf("MaxScale output:"); } output = test.maxscales->ssh_node_output(0, "cat /var/log/maxscale/maxscale.log && " - "sudo truncate -s 0 /var/log/maxscale/maxscale.log", - true, &ec); + "sudo truncate -s 0 /var/log/maxscale/maxscale.log", + true, &ec); if (test.verbose) { - test.tprintf("%s", output); + test.tprintf("%s", output); } free(output); } diff --git a/maxscale-system-test/failover_common.cpp b/maxscale-system-test/failover_common.cpp index 30d4c46fe..deb84be56 100644 --- a/maxscale-system-test/failover_common.cpp +++ b/maxscale-system-test/failover_common.cpp @@ -51,7 +51,7 @@ int prepare_test_1(TestConnections& test) { cout << LINE << endl; cout << "Part 1: Stopping master and waiting for failover. Check that another server is promoted." << - endl; + endl; cout << LINE << endl; int node0_id = test.repl->get_server_id(0); // Read master id now before shutdown. test.repl->stop_node(0); @@ -76,7 +76,7 @@ void prepare_test_2(TestConnections& test) { cout << LINE << endl; cout << "Part 2: Disable replication on server 2 and kill master, check that server 3 or 4 is promoted." - << endl; + << endl; cout << LINE << endl; test.repl->connect(); check(test); @@ -120,8 +120,8 @@ void prepare_test_3(TestConnections& test) { cout << LINE << "\n"; cout << "Part 3: Disable log_bin on server 2, making it invalid for promotion. Enable log-slave-updates " - " on servers 2 and 4. Disable log-slave-updates on server 3. Check that server 4 is promoted on" - " master failure." << "\n" << LINE << endl; + " on servers 2 and 4. Disable log-slave-updates on server 3. Check that server 4 is promoted on" + " master failure." << "\n" << LINE << endl; get_output(test); test.maxscales->stop_maxscale(0); test.repl->stop_node(1); diff --git a/maxscale-system-test/fwf.cpp b/maxscale-system-test/fwf.cpp index 487bd80ca..20b2ca23f 100644 --- a/maxscale-system-test/fwf.cpp +++ b/maxscale-system-test/fwf.cpp @@ -203,7 +203,7 @@ int main(int argc, char *argv[]) elapsedTime += (double) (t2.tv_usec - t1.tv_usec) / 1000000.0; } while ((execute_query_silent(Test->maxscales->conn_rwsplit[0], "SELECT * FROM t1") != 0) && - (elapsedTime < 10)); + (elapsedTime < 10)); Test->tprintf("Quries were blocked during %f (using clock_gettime())", elapsedTime); Test->tprintf("Quries were blocked during %lu (using time())", time(NULL) - start_time_clock); diff --git a/maxscale-system-test/fwf2.cpp b/maxscale-system-test/fwf2.cpp index bd0e1dbd9..06d88611c 100644 --- a/maxscale-system-test/fwf2.cpp +++ b/maxscale-system-test/fwf2.cpp @@ -34,7 +34,7 @@ int read_and_execute_queries(TestConnections *Test, const char* filename, int ex { Test->tprintf("%s", sql); if (execute_query(Test->maxscales->conn_rwsplit[0], sql) != expected && - (expected == 1 || mysql_errno(Test->maxscales->conn_rwsplit[0]) == 1141)) + (expected == 1 || mysql_errno(Test->maxscales->conn_rwsplit[0]) == 1141)) { Test->tprintf("Query %s, but %s expected, MySQL error: %d, %s\n", expected ? "succeeded" : "failed", diff --git a/maxscale-system-test/fwf_reload.cpp b/maxscale-system-test/fwf_reload.cpp index 0a36875a8..9d3bcb06b 100644 --- a/maxscale-system-test/fwf_reload.cpp +++ b/maxscale-system-test/fwf_reload.cpp @@ -101,7 +101,7 @@ int main(int argc, char *argv[]) copy_rules(Test, (char *) "rules_syntax_error", rules_dir); char *output = Test->maxscales->ssh_node_output(0, - "maxadmin call command dbfwfilter rules/reload Database-Firewall", true, &exit_code); + "maxadmin call command dbfwfilter rules/reload Database-Firewall", true, &exit_code); Test->add_result(strcasestr(output, "Failed") == NULL, "Reloading rules should fail with syntax errors"); Test->check_maxscale_processes(0, 1); diff --git a/maxscale-system-test/keepalived_func.cpp b/maxscale-system-test/keepalived_func.cpp index 33ed95305..9b085b74d 100644 --- a/maxscale-system-test/keepalived_func.cpp +++ b/maxscale-system-test/keepalived_func.cpp @@ -34,15 +34,15 @@ void configure_keepalived(TestConnections* Test, char * keepalived_file) for (i = 0; i < Test->maxscales->N; i++) { std::string src = std::string(test_dir) - + "/keepalived_cnf/" - + std::string(keepalived_file) - + std::to_string(i + 1) - + ".conf"; + + "/keepalived_cnf/" + + std::string(keepalived_file) + + std::to_string(i + 1) + + ".conf"; std::string cp_cmd = "cp " - + std::string(Test->maxscales->access_homedir[i]) - + std::string(keepalived_file) - + std::to_string(i + 1) + ".conf " - + " /etc/keepalived/keepalived.conf"; + + std::string(Test->maxscales->access_homedir[i]) + + std::string(keepalived_file) + + std::to_string(i + 1) + ".conf " + + " /etc/keepalived/keepalived.conf"; Test->tprintf("%s\n", src.c_str()); Test->tprintf("%s\n", cp_cmd.c_str()); Test->maxscales->ssh_node(i, "yum install -y keepalived", true); diff --git a/maxscale-system-test/keepalived_masterdown.cpp b/maxscale-system-test/keepalived_masterdown.cpp index 2bcbe62b1..e5314d93c 100644 --- a/maxscale-system-test/keepalived_masterdown.cpp +++ b/maxscale-system-test/keepalived_masterdown.cpp @@ -63,7 +63,8 @@ int main(int argc, char *argv[]) print_version_string(Test); - sleep(FAILOVER_WAIT_TIME);sleep(FAILOVER_WAIT_TIME); + sleep(FAILOVER_WAIT_TIME); + sleep(FAILOVER_WAIT_TIME); // initial state: 000 expected to be active, 001 - passive passive = check_maxscale_passive(Test, 0); diff --git a/maxscale-system-test/kerberos_setup.cpp b/maxscale-system-test/kerberos_setup.cpp index 5ba310888..3143cc133 100644 --- a/maxscale-system-test/kerberos_setup.cpp +++ b/maxscale-system-test/kerberos_setup.cpp @@ -61,7 +61,7 @@ int main(int argc, char *argv[]) Test->maxscales->ssh_node(0, (char *) "yum install rng-tools -y", true); Test->maxscales->ssh_node(0, (char *) "rngd -r /dev/urandom -o /dev/random", true); Test->maxscales->ssh_node(0, (char *) - "yum install -y MariaDB-gssapi-server MariaDB-gssapi-client krb5-server krb5-workstation pam_krb5", true); + "yum install -y MariaDB-gssapi-server MariaDB-gssapi-client krb5-server krb5-workstation pam_krb5", true); Test->maxscales->ssh_node_f(0, true, (char *) "yum install -y MariaDB-gssapi-server MariaDB-gssapi-client krb5-server krb5-workstation pam_krb5", true); diff --git a/maxscale-system-test/mariadb_func.cpp b/maxscale-system-test/mariadb_func.cpp index 1ef1842da..4bbb308cf 100644 --- a/maxscale-system-test/mariadb_func.cpp +++ b/maxscale-system-test/mariadb_func.cpp @@ -51,7 +51,7 @@ MYSQL* open_conn_db_flags(int port, std::string ip, std::string db, std::string } MYSQL* open_conn_db_timeout(int port, std::string ip, std::string db, std::string user, std::string password, - unsigned int timeout, bool ssl) + unsigned int timeout, bool ssl) { MYSQL* conn = mysql_init(NULL); @@ -542,7 +542,8 @@ Result get_result(MYSQL* conn, std::string sql) Row get_row(MYSQL* conn, std::string sql) { Result res = get_result(conn, sql); - return res.empty() ? Row{} : res[0]; + return res.empty() ? Row{} : + res[0]; } int get_int_version(std::string version) diff --git a/maxscale-system-test/mariadb_func.h b/maxscale-system-test/mariadb_func.h index e7157789c..bf020ba3d 100644 --- a/maxscale-system-test/mariadb_func.h +++ b/maxscale-system-test/mariadb_func.h @@ -75,7 +75,7 @@ MYSQL* open_conn_db_timeout(int port, std::string ip, std::string db, std::strin * @return MYSQL struct */ static MYSQL* open_conn_db(int port, std::string ip, std::string db, std::string user, std::string password, - bool ssl = false) + bool ssl = false) { return open_conn_db_flags(port, ip, db, user, password, CLIENT_MULTI_STATEMENTS, ssl); } diff --git a/maxscale-system-test/mariadb_nodes.cpp b/maxscale-system-test/mariadb_nodes.cpp index 8e677fd74..464fb4e1d 100644 --- a/maxscale-system-test/mariadb_nodes.cpp +++ b/maxscale-system-test/mariadb_nodes.cpp @@ -229,9 +229,9 @@ int Mariadb_nodes::find_master() while ((found == 0) && (i < N)) { if (find_field( - nodes[i], (char *) "show slave status;", - (char *) "Master_Host", &str[0] - ) == 0 ) + nodes[i], (char *) "show slave status;", + (char *) "Master_Host", &str[0] + ) == 0 ) { found = 1; strcpy(master_IP, str); @@ -714,7 +714,7 @@ static bool multi_source_replication(MYSQL *conn, int node) MYSQL_RES *res; if (mysql_query(conn, "SHOW ALL SLAVES STATUS") == 0 && - (res = mysql_store_result(conn))) + (res = mysql_store_result(conn))) { if (mysql_num_rows(res) == 1) { diff --git a/maxscale-system-test/maxscale_process_user.cpp b/maxscale-system-test/maxscale_process_user.cpp index 9170ca530..63ca67882 100644 --- a/maxscale-system-test/maxscale_process_user.cpp +++ b/maxscale-system-test/maxscale_process_user.cpp @@ -15,7 +15,7 @@ int main(int argc, char *argv[]) Test->set_timeout(50); char *user = Test->maxscales->ssh_node_output(0, "ps -FC maxscale|tail -n 1|cut -f 1 -d \" \"", false, - &exit_code); + &exit_code); char *nl = user ? strchr(user, '\n') : NULL; if (nl) diff --git a/maxscale-system-test/mdbci/README.md b/maxscale-system-test/mdbci/README.md index 42b0e7895..33437498a 100644 --- a/maxscale-system-test/mdbci/README.md +++ b/maxscale-system-test/mdbci/README.md @@ -22,7 +22,7 @@ Test setup is described in template. Templates are stored in Own template have to be put to the same directory. Default environment for tests consists of: -* one VM for Maxscale +* 2 VMs for Maxscales * 4 VMs for master/slave setup * 4 VMs for Galera cluster @@ -35,6 +35,7 @@ Template name|Description ---|--- ```nogalera``` |only 1 VM for Maxscale and 4 for Master/Slaves| ```twomaxscales``` |2 VMs for Maxscale and 4 for Master/Slaves| + ```onemaxscale``` |1 VM for Maxscale, 4 for Master/Slaves and 4 for Galera| ```big``` |1 VM for Maxscale, 8 for Master/Slaves and 4 for Galera| ```big15``` |1 VM for Maxscale, 15 for Master/Slaves and 4 for Galera| diff --git a/maxscale-system-test/mdbci/set_run_test_variables.sh b/maxscale-system-test/mdbci/set_run_test_variables.sh index 4c515a04c..152d4f229 100644 --- a/maxscale-system-test/mdbci/set_run_test_variables.sh +++ b/maxscale-system-test/mdbci/set_run_test_variables.sh @@ -8,7 +8,7 @@ echo "MDBCI_VM_PATH=$MDBCI_VM_PATH" export box=${box:-"centos_7_libvirt"} echo "box=$box" -export template=${template:-"twomaxscales_full"} +export template=${template:-"default"} export curr_date=`date '+%Y-%m-%d_%H-%M'` diff --git a/maxscale-system-test/mdbci/templates/default.json.template b/maxscale-system-test/mdbci/templates/default.json.template index 1523eb6c2..62a9c6224 100644 --- a/maxscale-system-test/mdbci/templates/default.json.template +++ b/maxscale-system-test/mdbci/templates/default.json.template @@ -104,7 +104,19 @@ } }, - "maxscale" : + "maxscale_000" : + { + "hostname" : "maxscale", + "box" : "${box}", + "memory_size" : "${vm_memory}", + "product" : { + "name" : "maxscale_ci", + "version" : "${target}" + } + + }, + + "maxscale_001" : { "hostname" : "maxscale", "box" : "${box}", diff --git a/maxscale-system-test/mdbci/templates/twomaxscales_full.json.template b/maxscale-system-test/mdbci/templates/onemaxscale.json.template similarity index 91% rename from maxscale-system-test/mdbci/templates/twomaxscales_full.json.template rename to maxscale-system-test/mdbci/templates/onemaxscale.json.template index 62a9c6224..1523eb6c2 100644 --- a/maxscale-system-test/mdbci/templates/twomaxscales_full.json.template +++ b/maxscale-system-test/mdbci/templates/onemaxscale.json.template @@ -104,19 +104,7 @@ } }, - "maxscale_000" : - { - "hostname" : "maxscale", - "box" : "${box}", - "memory_size" : "${vm_memory}", - "product" : { - "name" : "maxscale_ci", - "version" : "${target}" - } - - }, - - "maxscale_001" : + "maxscale" : { "hostname" : "maxscale", "box" : "${box}", diff --git a/maxscale-system-test/mxs1110_16mb.cpp b/maxscale-system-test/mxs1110_16mb.cpp index a487029ba..8ba23a8d5 100644 --- a/maxscale-system-test/mxs1110_16mb.cpp +++ b/maxscale-system-test/mxs1110_16mb.cpp @@ -27,10 +27,10 @@ int main(int argc, char *argv[]) Test->maxscales->copy_to_node_legacy(cache_rules.c_str(), "~/", 0); Test->maxscales->ssh_node_f(0, true, "cd %s;" - "rm -rf rules;" - "mkdir rules;" - "chown vagrant:vagrant rules", - Test->maxscales->access_homedir[0]); + "rm -rf rules;" + "mkdir rules;" + "chown vagrant:vagrant rules", + Test->maxscales->access_homedir[0]); copy_rules(Test, "rules2", fw_rules.c_str()); Test->maxscales->start_maxscale(0); diff --git a/maxscale-system-test/mxs1542.cpp b/maxscale-system-test/mxs1542.cpp index b5e3cde56..6e0787553 100644 --- a/maxscale-system-test/mxs1542.cpp +++ b/maxscale-system-test/mxs1542.cpp @@ -23,11 +23,11 @@ int main(int argc, char** argv) // Wait for the data to be processed const char* logmsg = "Waiting until more data is written"; test.maxscales->ssh_node_f(0, true, - "for ((i=0;i<15;i++)); do grep '%s' /var/log/maxscale/maxscale.log && break || sleep 1; done", logmsg); + "for ((i=0;i<15;i++)); do grep '%s' /var/log/maxscale/maxscale.log && break || sleep 1; done", logmsg); // Check if the Avro file contains the inserted value int rc = test.maxscales->ssh_node_f(0, true, - "maxavrocheck -d /var/lib/maxscale/avro/test.t1.000001.avro|grep 'Hello World'"); + "maxavrocheck -d /var/lib/maxscale/avro/test.t1.000001.avro|grep 'Hello World'"); test.add_result(rc == 0, "Data is converted when a failure to convert is expected"); printf("\n" diff --git a/maxscale-system-test/mxs1583_fwf.cpp b/maxscale-system-test/mxs1583_fwf.cpp index fa6c2e186..29b595b0f 100644 --- a/maxscale-system-test/mxs1583_fwf.cpp +++ b/maxscale-system-test/mxs1583_fwf.cpp @@ -36,22 +36,22 @@ int main(int argc, char** argv) test.tprintf("Trying query that matches one 'user' row, expecting failure\n"); test.set_timeout(30); test.add_result(!execute_query(test.maxscales->conn_rwsplit[0], "select concat(a) from t"), - "Query that matches one 'user' row should fail.\n"); + "Query that matches one 'user' row should fail.\n"); test.tprintf("Trying query that matches other 'user' row, expecting failure\n"); test.set_timeout(30); test.add_result(!execute_query(test.maxscales->conn_rwsplit[0], "select concat(b) from t"), - "Query that matches other 'user' row should fail.\n"); + "Query that matches other 'user' row should fail.\n"); test.tprintf("Trying query that matches both 'user' rows, expecting failure\n"); test.set_timeout(30); test.add_result(!execute_query_silent(test.maxscales->conn_rwsplit[0], "select concat(a), concat(b) from t"), - "Query that matches both 'user' rows should fail.\n"); + "Query that matches both 'user' rows should fail.\n"); test.tprintf("Trying non-matching query to blacklisted RWSplit, expecting success\n"); test.set_timeout(30); test.add_result(execute_query_silent(test.maxscales->conn_rwsplit[0], "show status"), - "Non-matching query to blacklist service should succeed.\n"); + "Non-matching query to blacklist service should succeed.\n"); test.stop_timeout(); test.tprintf("Checking if MaxScale is alive\n"); diff --git a/maxscale-system-test/mxs1585.cpp b/maxscale-system-test/mxs1585.cpp index 4351712db..a8f56bcdf 100644 --- a/maxscale-system-test/mxs1585.cpp +++ b/maxscale-system-test/mxs1585.cpp @@ -21,7 +21,7 @@ void* query_thr(void* data) while (running) { if (mysql_query(mysql, "INSERT INTO test.mxs1585 VALUES (1)") || - mysql_query(mysql, "DELETE FROM test.mxs1585 LIMIT 100")) + mysql_query(mysql, "DELETE FROM test.mxs1585 LIMIT 100")) { break; } diff --git a/maxscale-system-test/mxs1628_bad_handshake.cpp b/maxscale-system-test/mxs1628_bad_handshake.cpp index 72cf8a5f7..4e05349b7 100644 --- a/maxscale-system-test/mxs1628_bad_handshake.cpp +++ b/maxscale-system-test/mxs1628_bad_handshake.cpp @@ -19,9 +19,11 @@ int main(int argc, char *argv[]) std::vector wbuf; auto it = std::back_inserter(wbuf); - for (auto a: {(uint8_t)(caps), (uint8_t)(caps >> 8), (uint8_t)(caps >> 16), (uint8_t)(caps >> 24), + for (auto a: { + (uint8_t)(caps), (uint8_t)(caps >> 8), (uint8_t)(caps >> 16), (uint8_t)(caps >> 24), (uint8_t)(max_packet), (uint8_t)(max_packet >> 8), (uint8_t)(max_packet >> 16), (uint8_t)(max_packet >> 24), - charset}) + charset + }) { *it++ = a; } diff --git a/maxscale-system-test/mxs1713_lots_of_databases.cpp b/maxscale-system-test/mxs1713_lots_of_databases.cpp index 5e79c638c..cb20bdafb 100644 --- a/maxscale-system-test/mxs1713_lots_of_databases.cpp +++ b/maxscale-system-test/mxs1713_lots_of_databases.cpp @@ -35,7 +35,7 @@ int main(int argc, char** argv) MYSQL* conn = open_conn_db(test.maxscales->port(), test.maxscales->ip(), db, test.maxscales->user_name, test.maxscales->password); if (execute_query_silent(conn, "SELECT 1") || - execute_query_silent(conn, "SHOW DATABASES")) + execute_query_silent(conn, "SHOW DATABASES")) { errors.insert(mysql_error(conn)); } @@ -45,7 +45,9 @@ int main(int argc, char** argv) test.assert(errors.empty(), "None of the queries should fail: %s", std::accumulate(errors.begin(), errors.end(), std::string(), - [](const std::string &a, const std::string &b){return a + b + " ";})); + [](const std::string &a, const std::string &b) { + return a + b + " "; + })); test.tprintf("Dropping databases..."); for (auto db : db_list) diff --git a/maxscale-system-test/mxs1776_ps_exec_hang.cpp b/maxscale-system-test/mxs1776_ps_exec_hang.cpp index c99f7b098..2f1d241b5 100644 --- a/maxscale-system-test/mxs1776_ps_exec_hang.cpp +++ b/maxscale-system-test/mxs1776_ps_exec_hang.cpp @@ -86,7 +86,7 @@ int main(int argc, char* argv[]) bool rval = true; if (mysql_stmt_execute(stmt) || - mysql_stmt_bind_result(stmt, &bind.bind)) + mysql_stmt_bind_result(stmt, &bind.bind)) { rval = false; } @@ -106,10 +106,10 @@ int main(int argc, char* argv[]) bool rval = true; if (mysql_stmt_execute(stmt) || - mysql_stmt_execute(stmt) || - mysql_stmt_execute(stmt) || - mysql_stmt_execute(stmt) || - mysql_stmt_execute(stmt)) + mysql_stmt_execute(stmt) || + mysql_stmt_execute(stmt) || + mysql_stmt_execute(stmt) || + mysql_stmt_execute(stmt)) { rval = false; } @@ -124,10 +124,10 @@ int main(int argc, char* argv[]) bool rval = true; if (mysql_stmt_execute(stmt) || - mysql_stmt_execute(stmt) || - mysql_stmt_execute(stmt) || - mysql_stmt_execute(stmt) || - mysql_stmt_bind_result(stmt, &bind.bind)) + mysql_stmt_execute(stmt) || + mysql_stmt_execute(stmt) || + mysql_stmt_execute(stmt) || + mysql_stmt_bind_result(stmt, &bind.bind)) { rval = false; } @@ -147,10 +147,10 @@ int main(int argc, char* argv[]) bool rval = true; if (mysql_stmt_execute(stmt) || - mysql_stmt_execute(stmt) || - mysql_stmt_execute(stmt) || - mysql_stmt_execute(stmt) || - mysql_stmt_bind_result(stmt, &bind.bind)) + mysql_stmt_execute(stmt) || + mysql_stmt_execute(stmt) || + mysql_stmt_execute(stmt) || + mysql_stmt_bind_result(stmt, &bind.bind)) { rval = false; } @@ -170,11 +170,11 @@ int main(int argc, char* argv[]) bool rval = true; if (mysql_stmt_execute(stmt) || - mysql_stmt_execute(stmt) || - mysql_stmt_execute(stmt) || - mysql_stmt_execute(stmt) || - mysql_stmt_execute(stmt) || - mysql_query(conn, "SET @a = 1")) + mysql_stmt_execute(stmt) || + mysql_stmt_execute(stmt) || + mysql_stmt_execute(stmt) || + mysql_stmt_execute(stmt) || + mysql_query(conn, "SET @a = 1")) { rval = false; } diff --git a/maxscale-system-test/mxs1961_standalone_rejoin.cpp b/maxscale-system-test/mxs1961_standalone_rejoin.cpp index 1a06e8154..70b05779f 100644 --- a/maxscale-system-test/mxs1961_standalone_rejoin.cpp +++ b/maxscale-system-test/mxs1961_standalone_rejoin.cpp @@ -12,7 +12,9 @@ void checkpoint(TestConnections& test) const int v = 5; test.maxscales->wait_for_monitor(v); - for (auto&& s: {"server1", "server2", "server3"}) + for (auto&& s: { + "server1", "server2", "server3" + }) { auto status = test.get_server_status(s); cout << s << " { "; diff --git a/maxscale-system-test/mxs729_maxadmin.cpp b/maxscale-system-test/mxs729_maxadmin.cpp index edc4d2b3d..34f6a9f2a 100644 --- a/maxscale-system-test/mxs729_maxadmin.cpp +++ b/maxscale-system-test/mxs729_maxadmin.cpp @@ -31,7 +31,7 @@ void add_remove_maxadmin_user(TestConnections* Test) Test->tprintf("enable account %s to maxadmin:\n", Test->maxscales->access_user[0]); char * st3 = Test->maxscales->ssh_node_output_f(0, true, &exit_code, "maxadmin enable account %s", - Test->maxscales->access_user[0]); + Test->maxscales->access_user[0]); Test->tprintf("Result: %s\n", st3); sprintf(str, user_added, Test->maxscales->access_user[0]); if (strstr(st3, str) == NULL) @@ -85,7 +85,7 @@ void add_remove_maxadmin_user(TestConnections* Test) Test->tprintf("trying to remove user '%s'\n", Test->maxscales->access_user[0]); char * st8 = Test->maxscales->ssh_node_output_f(0, false, &exit_code, "maxadmin disable account %s", - Test->maxscales->access_user[0]); + Test->maxscales->access_user[0]); if (strstr(st8, remove_last_admin)) { @@ -138,8 +138,8 @@ int main(int argc, char *argv[]) Test->tprintf("trying long wierd user\n"); Test->maxscales->ssh_node_output(0, - "maxadmin enable account yygrgtrпрекури6н33имн756ККККЕН:УИГГГГ*?:*:*fj34oru34h275g23457g2v90590+u764gv56837fbv62381§SDFERGtrg45ergfergergefewfergt456ty", - true, &exit_code); + "maxadmin enable account yygrgtrпрекури6н33имн756ККККЕН:УИГГГГ*?:*:*fj34oru34h275g23457g2v90590+u764gv56837fbv62381§SDFERGtrg45ergfergergefewfergt456ty", + true, &exit_code); Test->check_maxscale_alive(0); Test->maxscales->ssh_node_f(0, true, "rm -rf /var/lib/maxscale/passwd"); diff --git a/maxscale-system-test/mxs872_roles.cpp b/maxscale-system-test/mxs872_roles.cpp index 23a583fea..1189f7f9b 100644 --- a/maxscale-system-test/mxs872_roles.cpp +++ b/maxscale-system-test/mxs872_roles.cpp @@ -25,7 +25,8 @@ int main(int argc, char** argv) "CREATE USER 'test2'@'%' IDENTIFIED BY 'test2'", "GRANT dba TO 'test'@'%'", "GRANT dba TO 'test2'@'%'", - "SET DEFAULT ROLE dba FOR 'test'@'%'"})) + "SET DEFAULT ROLE dba FOR 'test'@'%'" + })) { test.try_query(test.repl->nodes[0], "%s", a.c_str()); } @@ -50,7 +51,8 @@ int main(int argc, char** argv) for (auto a : vector({"DROP DATABASE IF EXISTS my_db", "DROP ROLE IF EXISTS dba", "DROP USER 'test'@'%'", - "DROP USER 'test2'@'%'"})) + "DROP USER 'test2'@'%'" + })) { execute_query_silent(test.repl->nodes[0], "%s", a.c_str()); } diff --git a/maxscale-system-test/mxs874_slave_recovery.cpp b/maxscale-system-test/mxs874_slave_recovery.cpp index f6d976093..0448ff344 100644 --- a/maxscale-system-test/mxs874_slave_recovery.cpp +++ b/maxscale-system-test/mxs874_slave_recovery.cpp @@ -66,7 +66,7 @@ int main(int argc, char *argv[]) int queried_id = atoi(server_id); test.add_result(queried_id != real_id, "The query server ID '%d' does not match the one from server '%d'. " - "Slave was not recovered.", queried_id, real_id); + "Slave was not recovered.", queried_id, real_id); char userval[200] = ""; find_field(test.maxscales->conn_rwsplit[0], "SELECT @a", "@a", userval); diff --git a/maxscale-system-test/mysqlmon_detect_standalone_master.cpp b/maxscale-system-test/mysqlmon_detect_standalone_master.cpp index a7927b2f1..1f370214c 100644 --- a/maxscale-system-test/mysqlmon_detect_standalone_master.cpp +++ b/maxscale-system-test/mysqlmon_detect_standalone_master.cpp @@ -33,12 +33,12 @@ void replicate_from(TestConnections& test, int server_ind, int target_ind) { stringstream change_master; change_master << "CHANGE MASTER TO MASTER_HOST = '" << test.repl->IP[target_ind] - << "', MASTER_PORT = " << test.repl->port[target_ind] << ", MASTER_USE_GTID = current_pos, " - "MASTER_USER='repl', MASTER_PASSWORD='repl';"; + << "', MASTER_PORT = " << test.repl->port[target_ind] << ", MASTER_USE_GTID = current_pos, " + "MASTER_USER='repl', MASTER_PASSWORD='repl';"; cout << "Server " << server_ind + 1 << " starting to replicate from server " << target_ind + 1 << endl; if (test.verbose) { - cout << "Query is '" << change_master.str() << "'" << endl; + cout << "Query is '" << change_master.str() << "'" << endl; } test.try_query(test.repl->nodes[server_ind], "STOP SLAVE;"); test.try_query(test.repl->nodes[server_ind], change_master.str().c_str()); @@ -65,7 +65,7 @@ void restore_servers(TestConnections& test, bool events_added) replicate_from(test, 2, 3); test.maxscales->wait_for_monitor(); o1 = test.maxscales->ssh_node_output(0, - "maxadmin call command mariadbmon switchover MySQL-Monitor server1 server4", true, &dummy); + "maxadmin call command mariadbmon switchover MySQL-Monitor server1 server4", true, &dummy); test.maxscales->wait_for_monitor(); int master_id = get_master_server_id(test); test.assert(master_id == 1, "Switchover failed to set server1 as master."); @@ -116,8 +116,8 @@ int main(int argc, char *argv[]) if (test.global_result != 0) { - restore_servers(test, false); - return test.global_result; + restore_servers(test, false); + return test.global_result; } test.maxscales->connect_maxscale(0); @@ -158,8 +158,8 @@ int main(int argc, char *argv[]) check_maxscale(test); if (test.global_result == 0) { - cout << "Test successful, restoring original state." << endl; - restore_servers(test, true); + cout << "Test successful, restoring original state." << endl; + restore_servers(test, true); } return test.global_result; } diff --git a/maxscale-system-test/mysqlmon_failover_no_slaves.cpp b/maxscale-system-test/mysqlmon_failover_no_slaves.cpp index edc5e4c24..7fffa7bc7 100644 --- a/maxscale-system-test/mysqlmon_failover_no_slaves.cpp +++ b/maxscale-system-test/mysqlmon_failover_no_slaves.cpp @@ -40,7 +40,7 @@ int main(int argc, char** argv) test.repl->start_node(2, (char *) ""); // Slave 3. Create a second slave connection to a non-existing server. const char CHANGE_CMD[] = "CHANGE MASTER 'dummy' TO MASTER_HOST = 'imagination_host.img', " - "MASTER_PORT = 1234, MASTER_USE_GTID = current_pos, MASTER_USER='repl', MASTER_PASSWORD='repl';"; + "MASTER_PORT = 1234, MASTER_USE_GTID = current_pos, MASTER_USER='repl', MASTER_PASSWORD='repl';"; test.try_query(nodes[3], CHANGE_CMD); test.try_query(nodes[3], "START SLAVE;"); diff --git a/maxscale-system-test/mysqlmon_rejoin_bad.cpp b/maxscale-system-test/mysqlmon_rejoin_bad.cpp index aabab85d9..b2c3dce9d 100644 --- a/maxscale-system-test/mysqlmon_rejoin_bad.cpp +++ b/maxscale-system-test/mysqlmon_rejoin_bad.cpp @@ -63,8 +63,8 @@ int main(int argc, char** argv) for (int i = FIRST_MOD_NODE; i < NODE_COUNT; i++) { if (mysql_query(nodes[i], STOP_SLAVE) != 0 || - mysql_query(nodes[i], RESET_SLAVE) != 0 || - mysql_query(nodes[i], READ_ONLY_OFF) != 0) + mysql_query(nodes[i], RESET_SLAVE) != 0 || + mysql_query(nodes[i], READ_ONLY_OFF) != 0) { test.assert(false, "Could not stop slave connections and/or disable read_only for node %d.", i); return test.global_result; @@ -114,7 +114,7 @@ int main(int argc, char** argv) // Finally, fix replication by telling the current master to replicate from server4 test.tprintf("Setting server 1 to replicate from server 4. Auto-rejoin should redirect servers 2 and 3."); const char CHANGE_CMD_FMT[] = "CHANGE MASTER TO MASTER_HOST = '%s', MASTER_PORT = %d, " - "MASTER_USE_GTID = current_pos, MASTER_USER='repl', MASTER_PASSWORD = 'repl';"; + "MASTER_USE_GTID = current_pos, MASTER_USER='repl', MASTER_PASSWORD = 'repl';"; char cmd[256]; snprintf(cmd, sizeof(cmd), CHANGE_CMD_FMT, test.repl->IP[3], test.repl->port[3]); mysql_query(nodes[0], cmd); @@ -125,13 +125,13 @@ int main(int argc, char** argv) test.assert(master_id == 4, "Server 4 should be the cluster master."); StringSet node0_states = test.get_server_status("server1"); bool states_n0_ok = (node0_states.find("Slave") != node0_states.end() && - node0_states.find("Relay Master") == node0_states.end()); + node0_states.find("Relay Master") == node0_states.end()); test.assert(states_n0_ok, "Server 1 is not a slave when it should be."); if (states_n0_ok) { int ec; test.maxscales->ssh_node_output(0, - "maxadmin call command mysqlmon switchover MySQL-Monitor server1 server4" , true, &ec); + "maxadmin call command mysqlmon switchover MySQL-Monitor server1 server4" , true, &ec); test.maxscales->wait_for_monitor(); master_id = get_master_server_id(test); test.assert(master_id == 1, "Server 1 should be the cluster master."); diff --git a/maxscale-system-test/mysqlmon_rejoin_bad2.cpp b/maxscale-system-test/mysqlmon_rejoin_bad2.cpp index 0a48aaadb..aa1f6cd8c 100644 --- a/maxscale-system-test/mysqlmon_rejoin_bad2.cpp +++ b/maxscale-system-test/mysqlmon_rejoin_bad2.cpp @@ -93,7 +93,7 @@ int main(int argc, char** argv) int master_id_new = get_master_server_id(test); cout << "Master server id is " << master_id_new << endl; test.assert(master_id_new > 0 && master_id_new != master_id_old, - "Failover did not promote a new master."); + "Failover did not promote a new master."); if (test.global_result != 0) { return test.global_result; @@ -132,7 +132,7 @@ int main(int argc, char** argv) cout << "Setting server " << master_id_new << " to replicate from server 1. Server " << master_id_new << " should remain as the master because server 1 doesn't have the latest event it has." << endl; const char CHANGE_CMD_FMT[] = "CHANGE MASTER TO MASTER_HOST = '%s', MASTER_PORT = %d, " - "MASTER_USE_GTID = current_pos, MASTER_USER='repl', MASTER_PASSWORD = 'repl';"; + "MASTER_USE_GTID = current_pos, MASTER_USER='repl', MASTER_PASSWORD = 'repl';"; char cmd[256]; int ind = master_id_new - 1; snprintf(cmd, sizeof(cmd), CHANGE_CMD_FMT, test.repl->IP[0], test.repl->port[0]); diff --git a/maxscale-system-test/mysqlmon_rejoin_manual2.cpp b/maxscale-system-test/mysqlmon_rejoin_manual2.cpp index 73835e023..adc4e53ec 100644 --- a/maxscale-system-test/mysqlmon_rejoin_manual2.cpp +++ b/maxscale-system-test/mysqlmon_rejoin_manual2.cpp @@ -59,8 +59,8 @@ int main(int argc, char** argv) for (int i = FIRST_MOD_NODE; i < NODE_COUNT; i++) { if (mysql_query(nodes[i], STOP_SLAVE) != 0 || - mysql_query(nodes[i], RESET_SLAVE) != 0 || - mysql_query(nodes[i], READ_ONLY_OFF) != 0) + mysql_query(nodes[i], RESET_SLAVE) != 0 || + mysql_query(nodes[i], READ_ONLY_OFF) != 0) { test.assert(false, "Could not stop slave connections and/or disable read_only for node %d.", i); return test.global_result; @@ -110,7 +110,7 @@ int main(int argc, char** argv) // Finally, fix replication by telling the current master to replicate from server4 test.tprintf("Setting server 1 to replicate from server 4. Manually rejoin servers 2 and 3."); const char CHANGE_CMD_FMT[] = "CHANGE MASTER TO MASTER_HOST = '%s', MASTER_PORT = %d, " - "MASTER_USE_GTID = current_pos, MASTER_USER='repl', MASTER_PASSWORD = 'repl';"; + "MASTER_USE_GTID = current_pos, MASTER_USER='repl', MASTER_PASSWORD = 'repl';"; char cmd[256]; snprintf(cmd, sizeof(cmd), CHANGE_CMD_FMT, test.repl->IP[3], test.repl->port[3]); mysql_query(nodes[0], cmd); @@ -125,13 +125,13 @@ int main(int argc, char** argv) test.assert(master_id == 4, "Server 4 should be the cluster master."); StringSet node0_states = test.get_server_status("server1"); bool states_n0_ok = (node0_states.find("Slave") != node0_states.end() && - node0_states.find("Relay Master") == node0_states.end()); + node0_states.find("Relay Master") == node0_states.end()); test.assert(states_n0_ok, "Server 1 is not a slave when it should be."); if (states_n0_ok) { int ec; test.maxscales->ssh_node_output(0, - "maxadmin call command mysqlmon switchover MySQL-Monitor server1 server4" , true, &ec); + "maxadmin call command mysqlmon switchover MySQL-Monitor server1 server4" , true, &ec); test.maxscales->wait_for_monitor(); master_id = get_master_server_id(test); test.assert(master_id == 1, "Server 1 should be the cluster master."); diff --git a/maxscale-system-test/replication_manager.cpp b/maxscale-system-test/replication_manager.cpp index 221c0f76c..fb6538676 100644 --- a/maxscale-system-test/replication_manager.cpp +++ b/maxscale-system-test/replication_manager.cpp @@ -23,7 +23,7 @@ void get_output(TestConnections& test) test.tprintf("replication-manager output:"); output = test.maxscales->ssh_node_f(0, true, - "cat /var/log/replication-manager.log && sudo truncate -s 0 /var/log/replication-manager.log"); + "cat /var/log/replication-manager.log && sudo truncate -s 0 /var/log/replication-manager.log"); test.tprintf("%s", output); free(output); } diff --git a/maxscale-system-test/server_weight.cpp b/maxscale-system-test/server_weight.cpp index cfc7fa4aa..54eacb30e 100644 --- a/maxscale-system-test/server_weight.cpp +++ b/maxscale-system-test/server_weight.cpp @@ -66,7 +66,7 @@ void check_conn_num(TestConnections* Test, int * Nc) for (int i = 0; i < 4; i++) { int conn_num = get_conn_num(Test->galera->nodes[i], Test->maxscales->IP[0], Test->maxscales->hostname[0], - (char *) "test"); + (char *) "test"); Test->tprintf("connections to node %d: %u (expected: %u)\n", i, conn_num, Nc[i]); if ((i < 4) && (Nc[i] != conn_num)) { diff --git a/maxscale-system-test/slave_lag.cpp b/maxscale-system-test/slave_lag.cpp index 7f0bfe2b3..680f1744d 100644 --- a/maxscale-system-test/slave_lag.cpp +++ b/maxscale-system-test/slave_lag.cpp @@ -39,7 +39,7 @@ int check_lag(int * min_lag) { sprintf(ma_cmd, "show server server%d", i + 1); maxscales->get_maxadmin_param(0, Test->maxscales->IP[0], (char *) "admin", Test->maxscales->maxadmin_password[0], ma_cmd, - (char *) "Slave delay:", result); + (char *) "Slave delay:", result); sscanf(result, "%d", &res_d); Test->tprintf("server%d lag: %d\n", i + 1, res_d); if (i == 1) @@ -181,13 +181,13 @@ void *checks_thread( void *ptr ) for (int i = 0; i < 1000; i++) { maxscales->get_maxadmin_param(0, Test->maxscales->IP[0], (char *) "admin", Test->maxscales->maxadmin_password[0], - (char *) "show server server2", (char *) "Slave delay:", result); + (char *) "show server server2", (char *) "Slave delay:", result); printf("server2: %s\n", result); maxscales->get_maxadmin_param(0, Test->maxscales->IP[0], (char *) "admin", Test->maxscales->maxadmin_password[0], - (char *) "show server server3", (char *) "Slave delay:", result); + (char *) "show server server3", (char *) "Slave delay:", result); printf("server3: %s\n", result); maxscales->get_maxadmin_param(0, Test->maxscales->IP[0], (char *) "admin", Test->maxscales->maxadmin_password[0], - (char *) "show server server4", (char *) "Slave delay:", result); + (char *) "show server server4", (char *) "Slave delay:", result); printf("server4: %s\n", result); } exit_flag = 1; diff --git a/maxscale-system-test/test_binlog_fnc.cpp b/maxscale-system-test/test_binlog_fnc.cpp index 566aaa806..6df791292 100644 --- a/maxscale-system-test/test_binlog_fnc.cpp +++ b/maxscale-system-test/test_binlog_fnc.cpp @@ -69,7 +69,7 @@ int check_sha1(TestConnections* Test) Test->tprintf("FILE: 000000%d", i); Test->set_timeout(50); s_maxscale = Test->maxscales->ssh_node_output_f(0, true, &exit_code, "sha1sum %s/mar-bin.00000%d", - Test->maxscales->maxscale_binlog_dir, i); + Test->maxscales->maxscale_binlog_dir, i); if (s_maxscale != NULL) { x = strchr(s_maxscale, ' '); @@ -153,7 +153,7 @@ void test_binlog(TestConnections* Test) Test->tprintf("SELECT * FROM t1 WHERE fl=10, checking inserted values"); Test->add_result(execute_query_check_one(Test->repl->nodes[0], (char *) "SELECT * FROM t1 WHERE fl=10", - "111"), "SELECT check failed"); + "111"), "SELECT check failed"); Test->tprintf("ROLLBACK"); @@ -167,11 +167,11 @@ void test_binlog(TestConnections* Test) Test->set_timeout(20); Test->tprintf("SELECT * FROM t1 WHERE fl=10, checking inserted values"); Test->add_result(execute_query_check_one(Test->repl->nodes[0], (char *) "SELECT * FROM t1 WHERE fl=10", - "112"), "SELECT check failed"); + "112"), "SELECT check failed"); Test->tprintf("SELECT * FROM t1 WHERE fl=10, checking inserted values from slave"); Test->add_result(execute_query_check_one(Test->repl->nodes[2], (char *) "SELECT * FROM t1 WHERE fl=10", - "112"), "SELECT check failed"); + "112"), "SELECT check failed"); Test->tprintf("DELETE FROM t1 WHERE fl=10"); Test->try_query(Test->repl->nodes[0], (char *) "DELETE FROM t1 WHERE fl=10"); Test->tprintf("Checking t1"); @@ -185,11 +185,11 @@ void test_binlog(TestConnections* Test) Test->tprintf("SELECT, checking inserted values"); Test->add_result(execute_query_check_one(Test->repl->nodes[0], (char *) "SELECT * FROM t1 WHERE fl=10", - "111"), "SELECT check failed"); + "111"), "SELECT check failed"); Test->tprintf("SELECT, checking inserted values from slave"); Test->add_result(execute_query_check_one(Test->repl->nodes[2], (char *) "SELECT * FROM t1 WHERE fl=10", - "111"), "SELECT check failed"); + "111"), "SELECT check failed"); Test->tprintf("DELETE FROM t1 WHERE fl=10"); Test->try_query(Test->repl->nodes[0], (char *) "DELETE FROM t1 WHERE fl=10"); diff --git a/maxscale-system-test/testconnections.cpp b/maxscale-system-test/testconnections.cpp index 1f31d8c68..31cf08291 100644 --- a/maxscale-system-test/testconnections.cpp +++ b/maxscale-system-test/testconnections.cpp @@ -141,19 +141,19 @@ TestConnections::TestConnections(int argc, char *argv[]): break; case 'h': + { + printf("Options:\n"); + + struct option *o = long_options; + + while (o->name) { - printf("Options:\n"); - - struct option *o = long_options; - - while (o->name) - { - printf("-%c, --%s\n", o->val, o->name); - ++o; - } - exit(0); + printf("-%c, --%s\n", o->val, o->name); + ++o; } - break; + exit(0); + } + break; case 's': printf("Maxscale won't be started\n"); @@ -835,9 +835,9 @@ int TestConnections::prepare_binlog(int m) tprintf("Master server version '%s'", version_str); if (*version_str && - strstr(version_str, "10.0") == NULL && - strstr(version_str, "10.1") == NULL && - strstr(version_str, "10.2") == NULL) + strstr(version_str, "10.0") == NULL && + strstr(version_str, "10.1") == NULL && + strstr(version_str, "10.2") == NULL) { add_result(maxscales->ssh_node_f(m, true, "sed -i \"s/,mariadb10-compatibility=1//\" %s", @@ -1061,8 +1061,8 @@ bool TestConnections::replicate_from_master(int m) conn = open_conn_no_db(maxscales->binlog_port[m], maxscales->IP[m], repl->user_name, repl->password, ssl); if (find_field(repl->nodes[0], "show master status", "File", log_file) || - repl->set_slave(conn, repl->IP[0], repl->port[0], log_file, log_pos) || - execute_query(conn, "start slave")) + repl->set_slave(conn, repl->IP[0], repl->port[0], log_file, log_pos) || + execute_query(conn, "start slave")) { rval = false; } @@ -1303,7 +1303,7 @@ int TestConnections::check_maxscale_processes(int m, int expected) { int exit_code; char* maxscale_num = maxscales->ssh_node_output(m, "ps -C maxscale | grep maxscale | wc -l", false, - &exit_code); + &exit_code); if ((maxscale_num == NULL) || (exit_code != 0)) { return -1; From 39016c410cc72fa4ec9539d1eaa90793215677dd Mon Sep 17 00:00:00 2001 From: Timofey Turenko Date: Wed, 29 Aug 2018 11:51:01 +0300 Subject: [PATCH 07/11] use different hostname for second Maxscale VM --- maxscale-system-test/mdbci/templates/default.json.template | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/maxscale-system-test/mdbci/templates/default.json.template b/maxscale-system-test/mdbci/templates/default.json.template index 62a9c6224..cb670b99d 100644 --- a/maxscale-system-test/mdbci/templates/default.json.template +++ b/maxscale-system-test/mdbci/templates/default.json.template @@ -118,7 +118,7 @@ "maxscale_001" : { - "hostname" : "maxscale", + "hostname" : "maxscale2", "box" : "${box}", "memory_size" : "${vm_memory}", "product" : { From e4fdaf0c504b49247cb53a143afb7ac554aa40f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Tue, 28 Aug 2018 08:48:36 +0300 Subject: [PATCH 08/11] MXS-1735: Clarify SSL documentation Explicitly state that servers only require `ssl_ca_cert` and that `ssl_cert` and `ssl_key` are optional in certain cases. Updated the wording of all parameters and removed obsolete or false documentation. --- .../Getting-Started/Configuration-Guide.md | 65 +++++++++---------- 1 file changed, 32 insertions(+), 33 deletions(-) diff --git a/Documentation/Getting-Started/Configuration-Guide.md b/Documentation/Getting-Started/Configuration-Guide.md index 22f0100d9..7d452e067 100644 --- a/Documentation/Getting-Started/Configuration-Guide.md +++ b/Documentation/Getting-Started/Configuration-Guide.md @@ -1384,20 +1384,24 @@ This section describes configuration parameters for both servers and listeners that control the TLS/SSL encryption method and the various certificate files involved in it. -To enable TLS/SSL for a listener or a server, you must set the `ssl` parameter -to `required` and provide the three files for `ssl_cert`, `ssl_key` and -`ssl_ca_cert`. +To enable TLS/SSL for a listener, you must set the `ssl` parameter to `required` +and provide the three files for `ssl_cert`, `ssl_key` and `ssl_ca_cert`. + +To enable TLS/SSL for a server, you must set the `ssl` parameter to `required` +and provide at least the `ssl_ca_cert` parameter. If the backend database server +has certificate verification enabled, the `ssl_cert` and `ssl_key` parameters +must also be defined. After this, MaxScale connections between the server and/or the client will be -encrypted. Note that the database must be configured to use TLS/SSL connections -if backend connection encryption is used. +encrypted. Note that the database must also be configured to use TLS/SSL +connections if backend connection encryption is used. **Note:** MaxScale does not allow mixed use of TLS/SSL and normal connections on the same port. If TLS encryption is enabled for a listener, any unencrypted connections to it will be rejected. MaxScale does this to improve security by preventing -accidental creation on unencrypted connections. +accidental creation of unencrypted connections. The separation of secure and insecure connections differs from the MariaDB server which allows both secure and insecure connections on the same port. As @@ -1407,33 +1411,34 @@ server does. #### `ssl` -This enables SSL connections when set to `required`. If enabled, the three -certificate files mentioned below must also be supplied. MaxScale connections -to will then be encrypted with TLS/SSL. +This enables SSL connections when set to `required`. If enabled, the certificate +files mentioned above must also be supplied. MaxScale connections to will then +be encrypted with TLS/SSL. #### `ssl_key` A string giving a file path that identifies an existing readable file. The file -must be the SSL client private key MaxScale should use. This is a required -parameter for SSL enabled configurations. +must be the SSL private key MaxScale should use. #### `ssl_cert` A string giving a file path that identifies an existing readable file. The file -must be the SSL client certificate MaxScale should use with the server. This is -a required parameter for SSL enabled configurations. The certificate must match -the key defined in `ssl_key`. +must be the SSL public certificate MaxScale should use. The certificate must +match the key defined in `ssl_key`. #### `ssl_ca_cert` A string giving a file path that identifies an existing readable file. The file -must be the Certificate Authority (CA) certificate for the CA that signed the -certificate referred to in the previous parameter. It will be used to verify -that the certificate is valid. This is a required parameter for SSL enabled -configurations. +must be the Certificate Authority (CA) certificate that will be used to validate +any public certificates. This is a required parameter for SSL enabled +configurations. The CA certificate can consist of a certificate chain. #### `ssl_version` +**Note:** It is highly recommended to leave this parameter to the default value + of _MAX_. This will guarantee that the strongest available encryption is used. + **Do not change this unless you know what you are doing**. + This parameter controls the level of encryption used. Accepted values are: * TLSv10 @@ -1442,18 +1447,13 @@ This parameter controls the level of encryption used. Accepted values are: * MAX The default is to use the highest level of encryption available. For OpenSSL 1.0 -and newer this is TLSv1.2. Older versions use TLSv1.0 as the default transport -layer encryption. - -**Note:** It is highly recommended to leave this parameter to the default value - of _MAX_. This will guarantee that the strongest available encryption is used. +and newer this is TLSv1.2. #### `ssl_cert_verify_depth` -The maximum length of the certificate authority chain that will be accepted. -Legal values are positive integers. Note that if the client is to submit an SSL -certificate, the `ssl_cert_verify_depth` parameter must not be 0. If no -value is specified, the default is 9. +The maximum length of the certificate authority chain that will be accepted. The +default value is 9, same as the OpenSSL default. The configured value must be +larger than 0. #### `ssl_verify_peer_certificate` @@ -1461,9 +1461,9 @@ Peer certificate verification. This functionality is enabled by default. When this feature is enabled, the certificate sent by the peer is verified against the configured Certificate Authority. If you are using self-signed -certificates, disable this feature. +certificates, set `ssl_verify_peer_certificate=false`. -**Example SSL enabled server configuration:** +#### Example SSL enabled server configuration ``` [server1] @@ -1475,19 +1475,18 @@ ssl=required ssl_cert=/usr/local/mariadb/maxscale/ssl/crt.max-client.pem ssl_key=/usr/local/mariadb/maxscale/ssl/key.max-client.pem ssl_ca_cert=/usr/local/mariadb/maxscale/ssl/crt.ca.maxscale.pem - ``` This example configuration requires all connections to this server to be encrypted with SSL. The paths to the certificate files and the Certificate Authority file are also provided. -**Example SSL enabled listener configuration:** +#### Example SSL enabled listener configuration ``` -[RW Split Listener] +[RW-Split-Listener] type=listener -service=RW Split Router +service=RW-Split-Router protocol=MariaDBClient port=3306 ssl=required From e38e08089a0b163f739360281b382e8443091789 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Tue, 28 Aug 2018 12:48:09 +0300 Subject: [PATCH 09/11] Skip parsing during LOAD DATA LOCAL INFILE The code parsed queries even when a LOAD DATA LOCAL INFILE was in progress. This caused the data to be misinterpreted as actual commands. --- server/modules/routing/readwritesplit/rwsplit_route_stmt.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/server/modules/routing/readwritesplit/rwsplit_route_stmt.cc b/server/modules/routing/readwritesplit/rwsplit_route_stmt.cc index 8f517c146..496318251 100644 --- a/server/modules/routing/readwritesplit/rwsplit_route_stmt.cc +++ b/server/modules/routing/readwritesplit/rwsplit_route_stmt.cc @@ -98,7 +98,7 @@ route_target_t get_target_type(RWSplitSession *rses, GWBUF *buffer, route_target_t route_target = TARGET_MASTER; bool in_read_only_trx = rses->target_node && session_trx_is_read_only(rses->client_dcb->session); - if (gwbuf_length(buffer) > MYSQL_HEADER_LEN) + if (gwbuf_length(buffer) > MYSQL_HEADER_LEN && rses->load_data_state != LOAD_DATA_ACTIVE) { *command = mxs_mysql_get_command(buffer); @@ -168,9 +168,10 @@ route_target_t get_target_type(RWSplitSession *rses, GWBUF *buffer, route_target = get_route_target(rses, *command, *type, buffer->hint); } } - else if (rses->load_data_state == LOAD_DATA_ACTIVE) + else if (gwbuf_length(buffer) == MYSQL_HEADER_LEN && rses->load_data_state == LOAD_DATA_ACTIVE) { /** Empty packet signals end of LOAD DATA LOCAL INFILE, send it to master*/ + ss_dassert(MYSQL_GET_PAYLOAD_LEN(GWBUF_DATA(buffer)) == 0); rses->load_data_state = LOAD_DATA_END; MXS_INFO("> LOAD DATA LOCAL INFILE finished: %lu bytes sent.", rses->rses_load_data_sent + gwbuf_length(buffer)); @@ -210,6 +211,7 @@ bool route_single_stmt(RWSplit *inst, RWSplitSession *rses, GWBUF *querybuf, con if (TARGET_IS_ALL(route_target)) { + ss_dassert(rses->load_data_state != LOAD_DATA_ACTIVE); // TODO: Handle payloads larger than (2^24 - 1) bytes that are routed to all servers succp = handle_target_is_all(route_target, inst, rses, querybuf, command, qtype); } From 5f4aa465522a5c4546f8aef405d9a8e3a3a79cee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Tue, 28 Aug 2018 14:19:06 +0300 Subject: [PATCH 10/11] MXS-2027: Store LOAD DATA state inside MXS_SESSION By storing the data gathere by readwritesplit inside the session, the protocol will be aware of the state of the LOAD DATA LOCAL INFILE execution. This prevents misinterpretation of the data which previously led to closed connections, effectively rendering LOAD DATA LOCAL INFILE unusable. This change is a temporary solution to a problem that needs to be solved at the protocol level. The changes required to implement this are too big to add into a bug fix release. --- include/maxscale/session.h | 11 +++++++++++ server/core/session.cc | 1 + .../protocol/MySQL/mariadbclient/mysql_client.cc | 5 +++-- .../modules/routing/readwritesplit/readwritesplit.cc | 1 + .../routing/readwritesplit/rwsplit_route_stmt.cc | 2 ++ 5 files changed, 18 insertions(+), 2 deletions(-) diff --git a/include/maxscale/session.h b/include/maxscale/session.h index 24255d42a..1f2e48628 100644 --- a/include/maxscale/session.h +++ b/include/maxscale/session.h @@ -181,6 +181,7 @@ typedef struct session bool qualifies_for_pooling; /**< Whether this session qualifies for the connection pool */ SessionStmtQueue* last_statements; /*< The N last statements by the client */ session_close_t close_reason; /**< Reason why the session was closed */ + bool load_active; /**< Data streaming state (for LOAD DATA LOCAL INFILE) */ skygw_chk_t ses_chk_tail; } MXS_SESSION; @@ -557,4 +558,14 @@ session_dump_statements_t session_get_dump_statements(); */ const char* session_get_close_reason(const MXS_SESSION* session); +static inline void session_set_load_active(MXS_SESSION* session, bool value) +{ + session->load_active = value; +} + +static inline bool session_is_load_active(const MXS_SESSION* session) +{ + return session->load_active; +} + MXS_END_DECLS diff --git a/server/core/session.cc b/server/core/session.cc index f546d2f1c..9ea030cc2 100644 --- a/server/core/session.cc +++ b/server/core/session.cc @@ -130,6 +130,7 @@ static MXS_SESSION* session_alloc_body(SERVICE* service, DCB* client_dcb, session->stmt.target = NULL; session->qualifies_for_pooling = false; session->close_reason = SESSION_CLOSE_NONE; + session->load_active = false; MXS_CONFIG *config = config_get_global_options(); // If MaxScale is running in Oracle mode, then autocommit needs to diff --git a/server/modules/protocol/MySQL/mariadbclient/mysql_client.cc b/server/modules/protocol/MySQL/mariadbclient/mysql_client.cc index 136eb4ac8..12d81dbd0 100644 --- a/server/modules/protocol/MySQL/mariadbclient/mysql_client.cc +++ b/server/modules/protocol/MySQL/mariadbclient/mysql_client.cc @@ -1622,7 +1622,7 @@ static int route_by_statement(MXS_SESSION* session, uint64_t capabilities, GWBUF /** * Update the currently command being executed. */ - if (!proto->changing_user) + if (!proto->changing_user && !session_is_load_active(session)) { update_current_command(session->client_dcb, packetbuf); } @@ -1631,7 +1631,8 @@ static int route_by_statement(MXS_SESSION* session, uint64_t capabilities, GWBUF { ss_dassert(GWBUF_IS_CONTIGUOUS(packetbuf)); - if (rcap_type_required(capabilities, RCAP_TYPE_TRANSACTION_TRACKING)) + if (rcap_type_required(capabilities, RCAP_TYPE_TRANSACTION_TRACKING) && + !session_is_load_active(session)) { if (session_trx_is_ending(session)) { diff --git a/server/modules/routing/readwritesplit/readwritesplit.cc b/server/modules/routing/readwritesplit/readwritesplit.cc index cb5de21bb..4d518f9a0 100644 --- a/server/modules/routing/readwritesplit/readwritesplit.cc +++ b/server/modules/routing/readwritesplit/readwritesplit.cc @@ -1204,6 +1204,7 @@ static void clientReply(MXS_ROUTER *instance, { // Server responded with an error to the LOAD DATA LOCAL INFILE rses->load_data_state = LOAD_DATA_INACTIVE; + session_set_load_active(backend_dcb->session, true); } if (backend->get_reply_state() == REPLY_STATE_DONE) diff --git a/server/modules/routing/readwritesplit/rwsplit_route_stmt.cc b/server/modules/routing/readwritesplit/rwsplit_route_stmt.cc index 496318251..cc5ed2e19 100644 --- a/server/modules/routing/readwritesplit/rwsplit_route_stmt.cc +++ b/server/modules/routing/readwritesplit/rwsplit_route_stmt.cc @@ -1220,6 +1220,7 @@ bool handle_got_target(RWSplit *inst, RWSplitSession *rses, /** The first packet contains the actual query and the server * will respond to it */ rses->load_data_state = LOAD_DATA_ACTIVE; + session_set_load_active(rses->client_dcb->session, true); } else if (rses->load_data_state == LOAD_DATA_END) { @@ -1227,6 +1228,7 @@ bool handle_got_target(RWSplit *inst, RWSplitSession *rses, * to which the server responds with an OK or an ERR packet */ ss_dassert(gwbuf_length(querybuf) == 4); rses->load_data_state = LOAD_DATA_INACTIVE; + session_set_load_active(rses->client_dcb->session, false); } } From 4c5e18b4f035166e0c0acf6779e44d32253b18bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Wed, 29 Aug 2018 18:33:04 +0300 Subject: [PATCH 11/11] MXS-2033: Require only MASTER_SSL_CA MASTER_SSL_CERT and MASTER_SSL_KEY are optional and should not be required. --- server/modules/routing/binlogrouter/blr_slave.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/server/modules/routing/binlogrouter/blr_slave.c b/server/modules/routing/binlogrouter/blr_slave.c index cc4460069..676026b0f 100644 --- a/server/modules/routing/binlogrouter/blr_slave.c +++ b/server/modules/routing/binlogrouter/blr_slave.c @@ -4377,9 +4377,8 @@ int blr_handle_change_master(ROUTER_INSTANCE* router, ssl_error = blr_set_master_ssl(router, change_master, error); if (ssl_error != -1 && - (!change_master.ssl_cert || - !change_master.ssl_ca || - !change_master.ssl_key)) + // No CA cert is defined or only one of CERT or KEY is defined + (!change_master.ssl_ca || (bool)change_master.ssl_cert != (bool)change_master.ssl_key)) { if (change_master.ssl_enabled && atoi(change_master.ssl_enabled)) @@ -4387,7 +4386,7 @@ int blr_handle_change_master(ROUTER_INSTANCE* router, snprintf(error, BINLOG_ERROR_MSG_LEN, "MASTER_SSL=1 but some required options are missing: " - "check MASTER_SSL_CERT, MASTER_SSL_KEY, MASTER_SSL_CA"); + "check that at least MASTER_SSL_CA is defined"); ssl_error = -1; } }