Merge pull request #4276 from sysown/v2.x-test_digest_230627

Minor change in test_digest_umap_aux-t
pull/4283/head
René Cannaò 3 years ago committed by GitHub
commit 6044195b85
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -45,7 +45,7 @@ int create_connections(const conn_opts_t& conn_opts, uint32_t cons_num, std::vec
}
if (!mysql_real_connect(proxysql, host, user, pass, NULL, port, NULL, conn_opts.client_flags)) {
fprintf(stderr, "File %s, line %d, Error: %s\n", __FILE__, __LINE__, mysql_error(proxysql));
diag("File %s, line %d, Error: %s", __FILE__, __LINE__, mysql_error(proxysql));
return EXIT_FAILURE;
} else {
result.push_back(proxysql);
@ -65,7 +65,7 @@ int get_idle_conns_cpu_usage(CommandLine& cl, uint64_t mode, uint32_t& idle_cpu_
// get ProxySQL idle cpu usage
int idle_err = get_proxysql_cpu_usage(cl, REPORT_INTV_SEC, idle_cpu_ms);
if (idle_err) {
fprintf(stdout, "File %s, line %d, Error: '%s'\n", __FILE__, __LINE__, "Unable to get 'idle_cpu' usage.");
diag("File %s, line %d, Error: '%s'", __FILE__, __LINE__, "Unable to get 'idle_cpu' usage.");
return idle_err;
}
@ -76,18 +76,20 @@ int get_idle_conns_cpu_usage(CommandLine& cl, uint64_t mode, uint32_t& idle_cpu_
vector<MYSQL*> v_admin_conns {};
int admin_conns_res = create_connections(admin_conns_opts, ADMIN_CONN_NUM, v_admin_conns);
if (admin_conns_res != EXIT_SUCCESS) {
diag("File %s, line %d, Exiting...", __FILE__, __LINE__);
return EXIT_FAILURE;
}
vector<MYSQL*> v_proxy_conns {};
int mysql_conns_res = create_connections(proxy_conns_opts, MYSQL_CONN_NUM, v_proxy_conns);
if (admin_conns_res != EXIT_SUCCESS) {
if (mysql_conns_res != EXIT_SUCCESS) {
diag("File %s, line %d, Exiting...", __FILE__, __LINE__);
return EXIT_FAILURE;
}
int final_err = get_proxysql_cpu_usage(cl, REPORT_INTV_SEC, final_cpu_ms);
if (final_err) {
fprintf(stdout, "File %s, line %d, Error: '%s'\n", __FILE__, __LINE__, "Unable to get 'idle_cpu' usage.");
diag("File %s, line %d, Error: '%s'", __FILE__, __LINE__, "Unable to get 'idle_cpu' usage.");
return idle_err;
}
@ -102,7 +104,7 @@ int main(int argc, char** argv) {
if (cl.getEnv()) {
diag("Failed to get the required environmental variables.");
return -1;
return exit_status();
}
plan(3);

@ -44,14 +44,14 @@ struct digest_stats {
string client_address;
string digest;
string digest_text;
int count_star;
int first_seen;
int last_seen;
int sum_time;
int min_time;
int max_time;
int sum_rows_affected;
int sum_rows_sent;
long long count_star;
long long first_seen;
long long last_seen;
long long sum_time;
long long min_time;
long long max_time;
long long sum_rows_affected;
long long sum_rows_sent;
};
class timer {
@ -91,14 +91,14 @@ vector<digest_stats> get_digest_stats(MYSQL* proxy_admin) {
ds.client_address = row[3];
ds.digest = row[4];
ds.digest_text = row[5];
ds.count_star = atoi(row[6]);
ds.first_seen = atoi(row[7]);
ds.last_seen = atoi(row[8]);
ds.sum_time = atoi(row[9]);
ds.min_time = atoi(row[10]);
ds.max_time = atoi(row[11]);
ds.sum_rows_affected = atoi(row[12]);
ds.sum_rows_sent = atoi(row[13]);
ds.count_star = atoll(row[6]);
ds.first_seen = atoll(row[7]);
ds.last_seen = atoll(row[8]);
ds.sum_time = atoll(row[9]);
ds.min_time = atoll(row[10]);
ds.max_time = atoll(row[11]);
ds.sum_rows_affected = atoll(row[12]);
ds.sum_rows_sent = atoll(row[13]);
ds_vector.push_back(ds);
}
mysql_free_result(res);
@ -261,7 +261,7 @@ int main(int argc, char** argv) {
" Client_address -> before:`%s` - after:`%s`.\n"
" Digests -> before:`%s` - after:`%s`.\n"
" Digests_text -> before:`%s` - after:`%s`.\n"
" First_seen -> before:`%d` - after:`%d`.",
" First_seen -> before:`%lld` - after:`%lldd`.",
ds_vector_before[i].hostgroup, ds_vector_after[i].hostgroup,
ds_vector_before[i].schemaname.c_str(), ds_vector_after[i].schemaname.c_str(),
ds_vector_before[i].username.c_str(), ds_vector_after[i].username.c_str(),
@ -272,7 +272,7 @@ int main(int argc, char** argv) {
);
ok(
ds_vector_after[i].count_star - ds_vector_before[i].count_star == num_dummy_queries_executed,
"Query `%s` should be executed %d times. Act:'%d'",
"Query `%s` should be executed %lld times. Act:'%lld'",
ds_vector_after[i].digest_text.c_str(), num_dummy_queries_executed,
ds_vector_after[i].count_star - ds_vector_before[i].count_star
);
@ -280,8 +280,8 @@ int main(int argc, char** argv) {
ds_vector_before[i].last_seen < ds_vector_after[i].last_seen &&
ds_vector_before[i].sum_time < ds_vector_after[i].sum_time,
"Last_seen and sum_time must have increased.\n"
" Last_seen -> before:`%d` - after:`%d`.\n"
" Sum_time -> before:`%d` - after:`%d`.",
" Last_seen -> before:`%lld` - after:`%lld`.\n"
" Sum_time -> before:`%lld` - after:`%lld`.",
ds_vector_before[i].last_seen, ds_vector_after[i].last_seen,
ds_vector_before[i].sum_time, ds_vector_after[i].sum_time
);

Loading…
Cancel
Save