diff --git a/Documentation/Getting-Started/Configuration-Guide.md b/Documentation/Getting-Started/Configuration-Guide.md index dd16a9995..b6f621a19 100644 --- a/Documentation/Getting-Started/Configuration-Guide.md +++ b/Documentation/Getting-Started/Configuration-Guide.md @@ -1528,20 +1528,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 `true` 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 `true` +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 @@ -1556,7 +1560,7 @@ value and is disabled by default. The parameter also accepts the special values `required` and `disabled` which were the only supported values before MaxScale 2.3.0. -If enabled, the three certificate files mentioned below must also be +If enabled, the certificate files mentioned above must also be supplied. MaxScale connections to will then be encrypted with TLS/SSL. #### `ssl_key` @@ -1578,10 +1582,14 @@ 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 both listeners -and servers. +and servers. 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 @@ -1590,16 +1598,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. The -default value is 9. If changed, the new value must be larger than zero. +default value is 9, same as the OpenSSL default. The configured value must be +larger than 0. #### `ssl_verify_peer_certificate` @@ -1607,9 +1612,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] @@ -1621,19 +1626,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 diff --git a/include/maxscale/session.h b/include/maxscale/session.h index 07b3614f8..e383f447b 100644 --- a/include/maxscale/session.h +++ b/include/maxscale/session.h @@ -196,6 +196,7 @@ typedef struct session GWBUF* buffer; /*< Buffer to deliver to up. */ } response; /*< Shortcircuited response */ session_close_t close_reason; /*< Reason why the session was closed */ + bool load_active; /*< Data streaming state (for LOAD DATA LOCAL INFILE) */ } MXS_SESSION; /** @@ -642,4 +643,14 @@ MXS_DOWNSTREAM router_as_downstream(MXS_SESSION* session); */ 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/maxscale-system-test/avro.cpp b/maxscale-system-test/avro.cpp index 0da4810bd..636f35bca 100644 --- a/maxscale-system-test/avro.cpp +++ b/maxscale-system-test/avro.cpp @@ -48,8 +48,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 046de532f..50b61723b 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 eb40980a3..1ca574b63 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/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 bf583cea5..9b085b74d 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++) @@ -32,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 3f0a22080..76b81c7bb 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"); diff --git a/maxscale-system-test/mariadb_func.cpp b/maxscale-system-test/mariadb_func.cpp index c80345692..1f8745e19 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 134aa6d48..8798c1950 100644 --- a/maxscale-system-test/mariadb_func.h +++ b/maxscale-system-test/mariadb_func.h @@ -77,7 +77,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 df73d0b33..5331925c0 100644 --- a/maxscale-system-test/mariadb_nodes.cpp +++ b/maxscale-system-test/mariadb_nodes.cpp @@ -230,9 +230,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_env.sh b/maxscale-system-test/mdbci/set_env.sh index 8461744c3..29ae8fe96 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,16 @@ 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_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/"} diff --git a/maxscale-system-test/mdbci/templates/default.json.template b/maxscale-system-test/mdbci/templates/default.json.template index 1523eb6c2..cb670b99d 100644 --- a/maxscale-system-test/mdbci/templates/default.json.template +++ b/maxscale-system-test/mdbci/templates/default.json.template @@ -104,11 +104,23 @@ } }, - "maxscale" : + "maxscale_000" : { "hostname" : "maxscale", "box" : "${box}", "memory_size" : "${vm_memory}", + "product" : { + "name" : "maxscale_ci", + "version" : "${target}" + } + + }, + + "maxscale_001" : + { + "hostname" : "maxscale2", + "box" : "${box}", + "memory_size" : "${vm_memory}", "product" : { "name" : "maxscale_ci", "version" : "${target}" diff --git a/maxscale-system-test/mdbci/templates/onemaxscale.json.template b/maxscale-system-test/mdbci/templates/onemaxscale.json.template new file mode 100644 index 000000000..8689a3906 --- /dev/null +++ b/maxscale-system-test/mdbci/templates/onemaxscale.json.template @@ -0,0 +1,118 @@ +{ + "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_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", + "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" : + { + "hostname" : "maxscale", + "box" : "${box}", + "memory_size" : "${vm_memory}", + "product" : { + "name" : "maxscale_ci", + "version" : "${target}" + } + + } +} 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 172d0cd6a..e8849f46f 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 acab544c8..2446b5020 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)); } diff --git a/maxscale-system-test/mxs1776_ps_exec_hang.cpp b/maxscale-system-test/mxs1776_ps_exec_hang.cpp index 607a3a4d4..cf64334c1 100644 --- a/maxscale-system-test/mxs1776_ps_exec_hang.cpp +++ b/maxscale-system-test/mxs1776_ps_exec_hang.cpp @@ -87,7 +87,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; } @@ -107,10 +107,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; } @@ -125,10 +125,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; } @@ -148,10 +148,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; } @@ -171,11 +171,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 97b93a7e0..98d897b74 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 0307cbf74..c756360c9 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], "%s", 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_rejoin_bad.cpp b/maxscale-system-test/mysqlmon_rejoin_bad.cpp index aea55c9c3..f156500c3 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 18c287937..4699f6449 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 4b883bd86..6e10a199b 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/rw_select_insert.cpp b/maxscale-system-test/rw_select_insert.cpp index 21d8f9140..109d1b117 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); 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 9862bff1d..6ba0b9ef5 100644 --- a/maxscale-system-test/test_binlog_fnc.cpp +++ b/maxscale-system-test/test_binlog_fnc.cpp @@ -161,7 +161,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"); @@ -175,11 +175,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"); @@ -193,11 +193,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 2acbf0d2b..a00623ae0 100644 --- a/maxscale-system-test/testconnections.cpp +++ b/maxscale-system-test/testconnections.cpp @@ -142,19 +142,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"); @@ -847,9 +847,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", @@ -1069,8 +1069,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; } @@ -1326,7 +1326,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; diff --git a/server/core/session.cc b/server/core/session.cc index 1ecdbbdbc..d35298e84 100644 --- a/server/core/session.cc +++ b/server/core/session.cc @@ -121,6 +121,7 @@ static MXS_SESSION* session_alloc_body(SERVICE* service, DCB* client_dcb, session->service = service; memset(&session->head, 0, sizeof(session->head)); memset(&session->tail, 0, sizeof(session->tail)); + session->load_active = false; /*< * Associate the session to the client DCB and set the reference count on diff --git a/server/modules/protocol/MySQL/mariadbclient/mysql_client.cc b/server/modules/protocol/MySQL/mariadbclient/mysql_client.cc index e40969f3c..fe672c798 100644 --- a/server/modules/protocol/MySQL/mariadbclient/mysql_client.cc +++ b/server/modules/protocol/MySQL/mariadbclient/mysql_client.cc @@ -1629,7 +1629,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); } @@ -1639,7 +1639,9 @@ static int route_by_statement(MXS_SESSION* session, uint64_t capabilities, GWBUF mxb_assert(GWBUF_IS_CONTIGUOUS(packetbuf)); SERVICE *service = session->client_dcb->service; - if (rcap_type_required(capabilities, RCAP_TYPE_TRANSACTION_TRACKING) && !service->session_track_trx_state) + if (rcap_type_required(capabilities, RCAP_TYPE_TRANSACTION_TRACKING) && + !service->session_track_trx_state && + !session_is_load_active(session)) { if (session_trx_is_ending(session)) { diff --git a/server/modules/routing/binlogrouter/blr_slave.cc b/server/modules/routing/binlogrouter/blr_slave.cc index 18366bf28..a4eaed900 100644 --- a/server/modules/routing/binlogrouter/blr_slave.cc +++ b/server/modules/routing/binlogrouter/blr_slave.cc @@ -4311,9 +4311,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)) @@ -4321,7 +4320,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; } } diff --git a/server/modules/routing/readwritesplit/rwsplit_route_stmt.cc b/server/modules/routing/readwritesplit/rwsplit_route_stmt.cc index e7e3b50d7..d402df90b 100644 --- a/server/modules/routing/readwritesplit/rwsplit_route_stmt.cc +++ b/server/modules/routing/readwritesplit/rwsplit_route_stmt.cc @@ -1133,6 +1133,7 @@ bool RWSplitSession::handle_got_target(GWBUF* querybuf, SRWBackend& target, bool * to which the server responds with an OK or an ERR packet */ mxb_assert(gwbuf_length(querybuf) == 4); m_qc.set_load_data_state(QueryClassifier::LOAD_DATA_INACTIVE); + session_set_load_active(m_pSession, false); } } } diff --git a/server/modules/routing/readwritesplit/rwsplitsession.cc b/server/modules/routing/readwritesplit/rwsplitsession.cc index be3529de3..6254d6ab0 100644 --- a/server/modules/routing/readwritesplit/rwsplitsession.cc +++ b/server/modules/routing/readwritesplit/rwsplitsession.cc @@ -550,6 +550,7 @@ void RWSplitSession::clientReply(GWBUF *writebuf, DCB *backend_dcb) { // Server requested a local file, go into data streaming mode m_qc.set_load_data_state(QueryClassifier::LOAD_DATA_ACTIVE); + session_set_load_active(m_pSession, true); } if (m_otrx_state == OTRX_ROLLBACK)