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.
This commit is contained in:
parent
9b0b152109
commit
d499ff84af
@ -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<std::string> 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)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user