From 468503425892fa5aea7567c5bb61a576cec4d8dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Canna=C3=B2?= Date: Wed, 6 May 2020 17:54:09 +0200 Subject: [PATCH 1/2] Remove autocommit handling from set_testing Autocommit will need its own set of testing. --- test/tap/tests/set_testing-t.cpp | 18 ++++++++++++------ test/tap/tests/set_testing-t.csv | 1 - 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/test/tap/tests/set_testing-t.cpp b/test/tap/tests/set_testing-t.cpp index 8e1f5228d..1ebd0a1f0 100644 --- a/test/tap/tests/set_testing-t.cpp +++ b/test/tap/tests/set_testing-t.cpp @@ -159,21 +159,21 @@ void queryVariables(MYSQL *mysql, json& j) { std::stringstream query; if (is_mariadb) { query << "SELECT /* mysql " << mysql << " */ lower(variable_name), variable_value FROM information_schema.session_variables WHERE variable_name IN " - " ('hostname', 'sql_log_bin', 'sql_mode', 'init_connect', 'time_zone', 'autocommit', 'sql_auto_is_null', " + " ('hostname', 'sql_log_bin', 'sql_mode', 'init_connect', 'time_zone', 'sql_auto_is_null', " " 'sql_safe_updates', 'max_join_size', 'net_write_timeout', 'sql_select_limit', " " 'sql_select_limit', 'character_set_results', 'tx_isolation', 'tx_read_only', " " 'sql_auto_is_null', 'collation_connection', 'character_set_connection', 'character_set_client', 'character_set_database');"; } if (is_cluster) { query << "SELECT /* mysql " << mysql << " */ * FROM performance_schema.session_variables WHERE variable_name IN " - " ('hostname', 'sql_log_bin', 'sql_mode', 'init_connect', 'time_zone', 'autocommit', 'sql_auto_is_null', " + " ('hostname', 'sql_log_bin', 'sql_mode', 'init_connect', 'time_zone', 'sql_auto_is_null', " " 'sql_safe_updates', 'session_track_gtids', 'max_join_size', 'net_write_timeout', 'sql_select_limit', " " 'sql_select_limit', 'character_set_results', 'transaction_isolation', 'transaction_read_only', " " 'sql_auto_is_null', 'collation_connection', 'character_set_connection', 'character_set_client', 'character_set_database', 'wsrep_sync_wait');"; } if (!is_mariadb && !is_cluster) { query << "SELECT /* mysql " << mysql << " */ * FROM performance_schema.session_variables WHERE variable_name IN " - " ('hostname', 'sql_log_bin', 'sql_mode', 'init_connect', 'time_zone', 'autocommit', 'sql_auto_is_null', " + " ('hostname', 'sql_log_bin', 'sql_mode', 'init_connect', 'time_zone', 'sql_auto_is_null', " " 'sql_safe_updates', 'session_track_gtids', 'max_join_size', 'net_write_timeout', 'sql_select_limit', " " 'sql_select_limit', 'character_set_results', 'transaction_isolation', 'transaction_read_only', " " 'sql_auto_is_null', 'collation_connection', 'character_set_connection', 'character_set_client', 'character_set_database');"; @@ -224,7 +224,7 @@ void queryInternalStatus(MYSQL *mysql, json& j) { j["conn"]["sql_log_bin"] = "OFF"; } - // autocommit {true|false} + // sql_auto_is_null {true|false} if (!el.value()["sql_auto_is_null"].dump().compare("ON") || !el.value()["sql_auto_is_null"].dump().compare("1") || !el.value()["sql_auto_is_null"].dump().compare("on") || @@ -240,6 +240,8 @@ void queryInternalStatus(MYSQL *mysql, json& j) { j["conn"]["sql_auto_is_null"] = "OFF"; } + // completely remove autocommit test +/* // autocommit {true|false} if (!el.value()["autocommit"].dump().compare("ON") || !el.value()["autocommit"].dump().compare("1") || @@ -255,7 +257,7 @@ void queryInternalStatus(MYSQL *mysql, json& j) { el.value().erase("autocommit"); j["conn"]["autocommit"] = "OFF"; } - +*/ // sql_safe_updates if (!el.value()["sql_safe_updates"].dump().compare("\"ON\"") || !el.value()["sql_safe_updates"].dump().compare("\"1\"") || @@ -410,10 +412,12 @@ void * my_conn_thread(void *arg) { } if (strcmp(username,(char *)"root")) { if (strstr(testCases[r2].command.c_str(),"database")) { + std::lock_guard lock(mtx_); ok(true, "mysql connection [%p], thread_id [%lu], skipped test for command [%s]", mysql, mysql->thread_id, testCases[r2].command.c_str()); continue; } if (strstr(testCases[r2].command.c_str(),"sql_log_bin")) { + std::lock_guard lock(mtx_); ok(true, "mysql connection [%p], thread_id [%lu], skipped test for command [%s]", mysql, mysql->thread_id, testCases[r2].command.c_str()); continue; } @@ -527,6 +531,8 @@ int main(int argc, char *argv[]) { return exit_status(); std::string fileName(std::string(cl.workdir) + "/set_testing-t.csv"); +/* + // do not connect to admin at all MYSQL* mysqladmin = mysql_init(NULL); if (!mysqladmin) return exit_status(); @@ -547,7 +553,7 @@ int main(int argc, char *argv[]) { MYSQL_QUERY(mysqladmin, "load mysql variables to runtime"); mysql_close(mysqladmin); - +*/ MYSQL* mysql = mysql_init(NULL); if (!mysql) return exit_status(); diff --git a/test/tap/tests/set_testing-t.csv b/test/tap/tests/set_testing-t.csv index db8114f17..364f7a0d5 100644 --- a/test/tap/tests/set_testing-t.csv +++ b/test/tap/tests/set_testing-t.csv @@ -31,7 +31,6 @@ "SET sql_mode='PIPES_AS_CONCAT,NO_ENGINE_SUBSTITUTION'", "{'sql_mode':'PIPES_AS_CONCAT,NO_ENGINE_SUBSTITUTION'}" "SET time_zone='+01:00'","{'time_zone':'+01:00'}" "SET time_zone='-03:00', sql_mode='ALLOW_INVALID_DATES'","{'time_zone':'-03:00', 'sql_mode':'ALLOW_INVALID_DATES'}" -"SET autocommit=0","{'autocommit':'OFF'}" "SET time_zone='+04:00', sql_mode='NO_ENGINE_SUBSTITUTION'", "{'time_zone':'+04:00','sql_mode':'NO_ENGINE_SUBSTITUTION'}" "SET sql_safe_updates='OFF'", "{'sql_safe_updates':'OFF'}" "SET sql_safe_updates='ON'", "{'sql_safe_updates':'ON'}" From d6beb731c4d2b20dcd52fa5cf3d8c15ab3834201 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Canna=C3=B2?= Date: Wed, 6 May 2020 18:06:54 +0200 Subject: [PATCH 2/2] Use skip() instead of ok() in set_testing-t.cpp --- test/tap/tests/set_testing-t.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/tap/tests/set_testing-t.cpp b/test/tap/tests/set_testing-t.cpp index 1ebd0a1f0..1a79915c0 100644 --- a/test/tap/tests/set_testing-t.cpp +++ b/test/tap/tests/set_testing-t.cpp @@ -413,12 +413,12 @@ void * my_conn_thread(void *arg) { if (strcmp(username,(char *)"root")) { if (strstr(testCases[r2].command.c_str(),"database")) { std::lock_guard lock(mtx_); - ok(true, "mysql connection [%p], thread_id [%lu], skipped test for command [%s]", mysql, mysql->thread_id, testCases[r2].command.c_str()); + skip(1, "mysql connection [%p], command [%s]", mysql, testCases[r2].command.c_str()); continue; } if (strstr(testCases[r2].command.c_str(),"sql_log_bin")) { std::lock_guard lock(mtx_); - ok(true, "mysql connection [%p], thread_id [%lu], skipped test for command [%s]", mysql, mysql->thread_id, testCases[r2].command.c_str()); + skip(1, "mysql connection [%p], command [%s]", mysql, testCases[r2].command.c_str()); continue; } }