From fa3a65d5bacaa7f70d52dc9de1416e088b49a06a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Canna=C3=B2?= Date: Fri, 17 Nov 2023 11:35:24 +0000 Subject: [PATCH] Updating set_testing-240-t - added again support for multiple parsers - use non-root --- test/tap/tests/set_testing-240-t.cpp | 48 +++++++++++++++++----------- 1 file changed, 29 insertions(+), 19 deletions(-) diff --git a/test/tap/tests/set_testing-240-t.cpp b/test/tap/tests/set_testing-240-t.cpp index 0576bc4b81..b88e231412 100644 --- a/test/tap/tests/set_testing-240-t.cpp +++ b/test/tap/tests/set_testing-240-t.cpp @@ -114,13 +114,13 @@ void * my_conn_thread(void *arg) { if (mysql==NULL) { exit(EXIT_FAILURE); } - MYSQL *rc=mysql_real_connect(mysql, cl.root_host, cl.root_username, cl.root_password, schema, (local ? 0 : ( port + rand()%multiport ) ), NULL, 0); -// MYSQL *rc=mysql_real_connect(mysql, cl.mysql_host, cl.mysql_username, cl.mysql_password, schema, (local ? 0 : ( cl.mysql_port + rand()%multiport ) ), NULL, 0); + int port = local ? 0 : ( cl.mysql_port + rand()%multiport ); + MYSQL *rc=mysql_real_connect(mysql, cl.mysql_host, cl.mysql_username, cl.mysql_password, schema, port, NULL, 0); if (rc==NULL) { if (silent==0) { - fprintf(stderr,"%s\n", mysql_error(mysql)); + fprintf(stderr,"Error while connecting on %s:%d : %s\n", cl.mysql_host , port , mysql_error(mysql)); } - exit(EXIT_FAILURE); + return NULL; } mysqlconns[i]=mysql; set_sql_mode[i]=false; @@ -474,10 +474,9 @@ int main(int argc, char *argv[]) { diag("Creating new hostgroup 101: DELETE FROM mysql_servers WHERE hostgroup_id = 101"); MYSQL_QUERY(proxysql_admin, "DELETE FROM mysql_servers WHERE hostgroup_id = 101"); -// diag("Creating new hostgroup 101: INSERT INTO mysql_servers (hostgroup_id, hostname, port, max_connections, max_replication_lag, comment) SELECT DISTINCT 101, hostname, port, 100, 0, comment FROM mysql_servers WHERE hostgroup_id IN (21)"); - diag("Creating new hostgroup 101: INSERT INTO mysql_servers (hostgroup_id, hostname, port, max_connections, max_replication_lag, comment) SELECT DISTINCT 101, hostname, port, 100, 0, comment FROM mysql_servers WHERE hostgroup_id IN (1501)"); -// MYSQL_QUERY(proxysql_admin, "INSERT INTO mysql_servers (hostgroup_id, hostname, port, max_connections, max_replication_lag, comment) SELECT DISTINCT 101, hostname, port, 100, 0, comment FROM mysql_servers WHERE hostgroup_id IN (21)"); - MYSQL_QUERY(proxysql_admin, "INSERT INTO mysql_servers (hostgroup_id, hostname, port, max_connections, max_replication_lag, comment) SELECT DISTINCT 101, hostname, port, 100, 0, comment FROM mysql_servers WHERE hostgroup_id IN (1501)"); + const std::string insert = "INSERT INTO mysql_servers (hostgroup_id, hostname, port, max_connections, max_replication_lag, comment) SELECT DISTINCT 101, hostname, port, 100, 0, comment FROM mysql_servers WHERE hostgroup_id LIKE '%1'"; + diag("Creating new hostgroup 101: %s" , insert.c_str()); + MYSQL_QUERY(proxysql_admin, insert.c_str()); MYSQL_QUERY(proxysql_admin, "LOAD MYSQL SERVERS TO RUNTIME"); diag("Changing read traffic to hostgroup 101: UPDATE mysql_query_rules SET destination_hostgroup=101 WHERE destination_hostgroup=1"); MYSQL_QUERY(proxysql_admin, "UPDATE mysql_query_rules SET destination_hostgroup=101 WHERE destination_hostgroup=1"); @@ -485,7 +484,9 @@ int main(int argc, char *argv[]) { //queries = 3000; //queries = testCases.size(); - plan(queries * num_threads); + unsigned int p = queries * num_threads; + p *= 2; // number of algorithms + plan(p); if (strcmp(host,"localhost")==0) { local = 1; @@ -497,16 +498,25 @@ int main(int argc, char *argv[]) { uniquequeries=(int)sqrt(uniquequeries); } - pthread_t *thi=(pthread_t *)malloc(sizeof(pthread_t)*num_threads); - if (thi==NULL) - return exit_status(); - - for (unsigned int i=0; i::iterator it = vars_counters.begin(); it!=vars_counters.end(); it++) { diag("Unknown variable %s:\t Count: %d , unknown: %d", it->first.c_str(), it->second.count, it->second.unknown);