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 1/4] 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); From 7eeaf0bb401e837773a1547dda2f31bc8bce9c5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Canna=C3=B2?= Date: Tue, 21 Nov 2023 09:28:53 +0000 Subject: [PATCH 2/4] Use right port on set_testing-240-t.cpp --- test/tap/tests/set_testing-240-t.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/tap/tests/set_testing-240-t.cpp b/test/tap/tests/set_testing-240-t.cpp index b88e231412..5dd893d237 100644 --- a/test/tap/tests/set_testing-240-t.cpp +++ b/test/tap/tests/set_testing-240-t.cpp @@ -114,7 +114,7 @@ void * my_conn_thread(void *arg) { if (mysql==NULL) { exit(EXIT_FAILURE); } - int port = local ? 0 : ( cl.mysql_port + rand()%multiport ); + int port = local ? 0 : ( cl.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) { From 873cb441a6625ef6d712b7c3adaa865e35ff3d81 Mon Sep 17 00:00:00 2001 From: Miro Stauder Date: Tue, 21 Nov 2023 14:17:33 +0100 Subject: [PATCH 3/4] Update set_testing-240-t.cpp fix connection creation for testuser --- test/tap/tests/set_testing-240-t.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/tap/tests/set_testing-240-t.cpp b/test/tap/tests/set_testing-240-t.cpp index 5dd893d237..64071becb0 100644 --- a/test/tap/tests/set_testing-240-t.cpp +++ b/test/tap/tests/set_testing-240-t.cpp @@ -115,10 +115,10 @@ void * my_conn_thread(void *arg) { exit(EXIT_FAILURE); } int port = local ? 0 : ( cl.port + rand()%multiport ); - MYSQL *rc=mysql_real_connect(mysql, cl.mysql_host, cl.mysql_username, cl.mysql_password, schema, port, NULL, 0); + MYSQL *rc=mysql_real_connect(mysql, cl.host, cl.username, cl.password, schema, port, NULL, 0); if (rc==NULL) { if (silent==0) { - fprintf(stderr,"Error while connecting on %s:%d : %s\n", cl.mysql_host , port , mysql_error(mysql)); + fprintf(stderr,"Error while connecting on %s:%d : %s\n", cl.host , port , mysql_error(mysql)); } return NULL; } From 02291df1311a3ce587347a4d3f4a7156a7635327 Mon Sep 17 00:00:00 2001 From: Miro Stauder Date: Wed, 22 Nov 2023 17:43:12 +0100 Subject: [PATCH 4/4] Update set_testing-240-t.cpp use only readers from the default infra for now --- test/tap/tests/set_testing-240-t.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/tap/tests/set_testing-240-t.cpp b/test/tap/tests/set_testing-240-t.cpp index 64071becb0..7ac4f17a2f 100644 --- a/test/tap/tests/set_testing-240-t.cpp +++ b/test/tap/tests/set_testing-240-t.cpp @@ -474,7 +474,7 @@ 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"); - 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'"; + 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 = '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");