From f782a538cc99610c701802e70c5215738451b19c Mon Sep 17 00:00:00 2001 From: Johan Wikman Date: Fri, 19 Feb 2021 12:50:43 +0200 Subject: [PATCH] MXS-3410 Add Mariadb_nodes::prepare_for_test(MYSQL*) Needs to be a member function as the dropping of anonymous users must be done differently for Xpand. With current code, no anonymous users in Xpand will be dropped, and there will always be an error (so, should someone care about the return code, this would not work). --- system-test/maxtest/include/maxtest/mariadb_nodes.hh | 2 ++ system-test/maxtest/src/mariadb_nodes.cc | 7 ++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/system-test/maxtest/include/maxtest/mariadb_nodes.hh b/system-test/maxtest/include/maxtest/mariadb_nodes.hh index 6e9e2b258..e2337b81a 100644 --- a/system-test/maxtest/include/maxtest/mariadb_nodes.hh +++ b/system-test/maxtest/include/maxtest/mariadb_nodes.hh @@ -355,8 +355,10 @@ public: /** * @brief Flush hosts, adjust settings, remove anonymous users, etc. + * @param conn Valid handle to some node. * @return True in case of success, false otherwise. */ + bool prepare_for_test(MYSQL* conn); bool prepare_for_test(); /** diff --git a/system-test/maxtest/src/mariadb_nodes.cc b/system-test/maxtest/src/mariadb_nodes.cc index 05f8b9c12..93b67f865 100644 --- a/system-test/maxtest/src/mariadb_nodes.cc +++ b/system-test/maxtest/src/mariadb_nodes.cc @@ -1028,7 +1028,7 @@ std::vector Mariadb_nodes::get_all_server_ids() return rval; } -bool do_prepare_for_test(MYSQL* conn) +bool Mariadb_nodes::prepare_for_test(MYSQL* conn) { int local_result = 0; @@ -1100,9 +1100,10 @@ bool Mariadb_nodes::prepare_for_test() for (int i = 0; i < N; i++) { - std::packaged_task task(do_prepare_for_test); + bool (Mariadb_nodes::*function)(MYSQL*) = &Mariadb_nodes::prepare_for_test; + std::packaged_task task(function); futures.push_back(task.get_future()); - std::thread(std::move(task), nodes[i]).detach(); + std::thread(std::move(task), this, nodes[i]).detach(); } for (auto& f : futures)