From d499ff84af5bc746353de7e4bcd2fd0533d02e10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Fri, 20 Sep 2019 09:12:04 +0300 Subject: [PATCH] Speed up mxs1713_lots_of_databases The SHOW DATABASES greatly slows down the test. By doing that only from time to time, the test time drops from roughly 160 seconds to 15 seconds. There's also no point in continuing the test after a failure has been seen. Also added a missing sync_slaves to the database creation to make sure they are created on all servers before the test starts. --- .../mxs1713_lots_of_databases.cpp | 25 ++++++++++--------- 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/maxscale-system-test/mxs1713_lots_of_databases.cpp b/maxscale-system-test/mxs1713_lots_of_databases.cpp index c5cc9a6c5..52faeff23 100644 --- a/maxscale-system-test/mxs1713_lots_of_databases.cpp +++ b/maxscale-system-test/mxs1713_lots_of_databases.cpp @@ -25,10 +25,12 @@ int main(int argc, char** argv) { execute_query(test.repl->nodes[0], "CREATE DATABASE %s", db.c_str()); } + test.repl->sync_slaves(); test.tprintf("Done!"); test.tprintf("Opening a connection with each database as the default database...", db_list.size()); std::set errors; + int i = 0; for (auto db : db_list) { @@ -37,24 +39,23 @@ int main(int argc, char** argv) db, test.maxscales->user_name, test.maxscales->password); - if (execute_query_silent(conn, "SELECT 1") - || execute_query_silent(conn, "SHOW DATABASES")) + + test.expect(execute_query(conn, "SELECT 1") == 0, "Query should work: %s", mysql_error(conn)); + + if (i++ % 300 == 0) { - errors.insert(mysql_error(conn)); + test.expect(execute_query(conn, "SHOW DATABASES") == 0, "Query should work: %s", mysql_error(conn)); } + mysql_close(conn); + + if (test.global_result) + { + break; + } } test.tprintf("Done!"); - auto combiner = [](std::string& a, std::string b) { - a += b + " "; - return a; - }; - - std::string errstr; - std::accumulate(errors.begin(), errors.end(), errstr, combiner); - test.expect(errors.empty(), "None of the queries should fail: %s", errstr.c_str()); - test.tprintf("Dropping databases..."); for (auto db : db_list) {