Revert "Add test for conn matching based on 'DEPRECATE_EOF' capability"

This reverts commit 71730f5c1c.
pull/4812/head
René Cannaò 1 year ago
parent 08e7d44fc4
commit 49bf034d52

@ -239,7 +239,7 @@ std::size_t count_matches(const string& str, const string& substr) {
}
int mysql_query_t__(MYSQL* mysql, const char* query, const char* f, int ln, const char* fn) {
diag("%s:%d:%s(): Issuing query \"%s\" to ('%s':%d)", f, ln, fn, query, mysql->host, mysql->port);
diag("%s:%d:%s(): Issuing query '%s' to ('%s':%d)", f, ln, fn, query, mysql->host, mysql->port);
return mysql_query(mysql, query);
}
@ -582,9 +582,9 @@ ext_val_t<int32_t> ext_single_row_val(const mysql_res_row& row, const int32_t& d
if (row.empty() || row.front().empty()) {
return { -1, def_val, {} };
} else {
errno = 0;
char* p_end {};
const int32_t val = std::strtol(row.front().c_str(), &p_end, 10);
errno = 0;
char* p_end {};
const int32_t val = std::strtol(row.front().c_str(), &p_end, 10);
if (row[0] == p_end || errno == ERANGE) {
return { -2, def_val, string { row[0] } };
@ -598,9 +598,9 @@ ext_val_t<uint32_t> ext_single_row_val(const mysql_res_row& row, const uint32_t&
if (row.empty() || row.front().empty()) {
return { -1, def_val, {} };
} else {
errno = 0;
char* p_end {};
const uint32_t val = std::strtoul(row.front().c_str(), &p_end, 10);
errno = 0;
char* p_end {};
const uint32_t val = std::strtoul(row.front().c_str(), &p_end, 10);
if (row[0] == p_end || errno == ERANGE) {
return { -2, def_val, string { row[0] } };
@ -615,9 +615,9 @@ ext_val_t<int64_t> ext_single_row_val(const mysql_res_row& row, const int64_t& d
if (row.empty() || row.front().empty()) {
return { -1, def_val, {} };
} else {
errno = 0;
char* p_end {};
const int64_t val = std::strtoll(row.front().c_str(), &p_end, 10);
errno = 0;
char* p_end {};
const int64_t val = std::strtoll(row.front().c_str(), &p_end, 10);
if (row[0] == p_end || errno == ERANGE) {
return { -2, def_val, string { row[0] } };
@ -631,9 +631,9 @@ ext_val_t<uint64_t> ext_single_row_val(const mysql_res_row& row, const uint64_t&
if (row.empty() || row.front().empty()) {
return { -1, def_val, {} };
} else {
errno = 0;
char* p_end {};
const uint64_t val = std::strtoull(row.front().c_str(), &p_end, 10);
errno = 0;
char* p_end {};
const uint64_t val = std::strtoull(row.front().c_str(), &p_end, 10);
if (row[0] == p_end || errno == ERANGE) {
return { -2, def_val, string { row[0] } };
@ -1789,61 +1789,6 @@ int dump_conn_stats(MYSQL* admin, const vector<uint32_t> hgs) {
return EXIT_SUCCESS;
}
string row_to_str(const mysql_res_row& row) {
string res { "[" };
for (const auto& e : row) {
res += "\"" + e + "\"";
if (&e != &row.back()) {
res += ",";
}
}
res += "]";
return res;
}
ext_val_t<hg_pool_st_t> ext_single_row_val(const mysql_res_row& row, const hg_pool_st_t& def_val) {
if (row.empty() || row.size() != sizeof(hg_pool_st_t)/sizeof(uint32_t)) {
return { -1, def_val, {} };
} else {
for (int i = 0; i < sizeof(hg_pool_st_t)/sizeof(uint32_t); i++) {
if (row[i].empty()) {
return { -1, def_val, {} };
}
}
errno = 0;
char* p_end { nullptr };
hg_pool_st_t res {};
const string row_str { row_to_str(row) };
res.hostgroup = std::strtoull(row.front().c_str(), &p_end, 10);
if (row[0].c_str() == p_end || errno == ERANGE) { return { -2, def_val, row_str }; }
res.conn_used = std::strtoull(row[1].c_str(), &p_end, 10);
if (row[1].c_str() == p_end || errno == ERANGE) { return { -2, def_val, row_str }; }
res.conn_free = std::strtoull(row[2].c_str(), &p_end, 10);
if (row[2].c_str() == p_end || errno == ERANGE) { return { -2, def_val, row_str }; }
res.conn_ok = std::strtoull(row[3].c_str(), &p_end, 10);
if (row[3].c_str() == p_end || errno == ERANGE) { return { -2, def_val, row_str }; }
res.conn_err = std::strtoull(row[4].c_str(), &p_end, 10);
if (row[4].c_str() == p_end || errno == ERANGE) { return { -2, def_val, row_str }; }
res.max_conn_used = std::strtoull(row[5].c_str(), &p_end, 10);
if (row[5].c_str() == p_end || errno == ERANGE) { return { -2, def_val, row_str }; }
res.max_conn_used = std::strtoull(row[6].c_str(), &p_end, 10);
if (row[6].c_str() == p_end || errno == ERANGE) { return { -2, def_val, row_str }; }
return { EXIT_SUCCESS, res, row_str };
}
}
ext_val_t<hg_pool_st_t> get_conn_pool_hg_stats(MYSQL* admin, uint32_t hg) {
const string HG_STATS_QUERY { gen_conn_stats_query({ hg }) };
return mysql_query_ext_val(admin, HG_STATS_QUERY, hg_pool_st_t {});
}
pair<int,pool_state_t> fetch_conn_stats(MYSQL* admin, const vector<uint32_t> hgs) {
const string stats_query { gen_conn_stats_query(hgs) };
const pair<int,vector<mysql_row_t>> conn_pool_stats { exec_dql_query(admin, stats_query, true) };
@ -1896,8 +1841,6 @@ int check_cond(MYSQL* mysql, const string& q) {
res = 0;
}
}
mysql_free_result(myres);
}
} else {
diag("Check failed with error '%s'", mysql_error(mysql));

@ -54,14 +54,6 @@ my_bool mysql_stmt_close_override(MYSQL_STMT* stmt, const char* file, int line);
}
static inline int mysql_query_override(MYSQL* mysql, const std::string& query, const char* file, int line) {
return mysql_query_override(mysql, query.c_str(), file, line);
}
#else
static inline int mysql_query(MYSQL* mysql, const std::string& query) {
return mysql_query(mysql, query.c_str());
}
#endif
/**
@ -94,9 +86,6 @@ inline std::string get_formatted_time() {
* @return Result of calling 'mysql_query'.
*/
int mysql_query_t__(MYSQL* mysql, const char* query, const char* f, int ln, const char* fn);
inline static int mysql_query_t__(MYSQL* mysql, const std::string& query, const char* f, int ln, const char* fn) {
return mysql_query_t__(mysql, query.c_str(), f, ln, fn);
}
/**
* @brief Convenience macro with query logging.
@ -123,7 +112,8 @@ inline static int mysql_query_t__(MYSQL* mysql, const std::string& query, const
#define MYSQL_QUERY_T(mysql, query) \
do { \
if (mysql_query_t(mysql, query)) { \
diag("Issuing query '%s' to ('%s':%d)", query, mysql->host, mysql->port); \
if (mysql_query(mysql, query)) { \
fprintf(stderr, "File %s, line %d, Error: %s\n", __FILE__, __LINE__, mysql_error(mysql)); \
return EXIT_FAILURE; \
} \
@ -192,7 +182,7 @@ struct ext_val_t {
};
/**
* @brief Specializations of function 'ext_single_row_val' for different types.
* @brief Specifications of function 'ext_single_row_val' for different types.
* @details These functions serve as the extension point for `mysql_query_ext_val`. A new specialization of
* the function is required for each type that `mysql_query_ext_val` should support for the default value.
* @param row The row from which the first value is going to be extracted and parsed.
@ -735,31 +725,6 @@ struct POOL_STATS_IDX {
};
};
struct hg_pool_st_t {
uint32_t hostgroup;
uint32_t conn_used;
uint32_t conn_free;
uint32_t conn_ok;
uint32_t conn_err;
uint32_t max_conn_used;
uint32_t queries;
};
/**
* @brief A more complex type specialization of 'ext_single_row_val'.
* @details For internal use of function 'get_conn_pool_hg_stats'.
* @param row The row from which the first value is going to be extracted and parsed.
* @param def_val The default value to use in case of failure to extract.
* @return An `ext_val_t<T>` where T is the type of the provided default value.
*/
ext_val_t<hg_pool_st_t> ext_single_row_val(const mysql_res_row& row, const hg_pool_st_t& def_val);
/**
* @brief Fetches the stats from a particular hostgroup.
* @param admin An already opened connection to MySQL admin.
* @return An `ext_val_t` wrapping the extracted values.
*/
ext_val_t<hg_pool_st_t> get_conn_pool_hg_stats(MYSQL* admin, uint32_t hg);
/**
* @brief Dumps a resultset with fields from the supplied hgs from 'stats_mysql_connection_pool'.
* @details The fetched fields are 'hostgroup,ConnUsed,ConnFree,ConnOk,ConnERR,MaxConnUsed,Queries'.
@ -776,7 +741,6 @@ using pool_state_t = std::map<uint32_t,mysql_row_t>;
* @return A pair of the shape {err_code, pool_state_t}.
*/
std::pair<int,pool_state_t> fetch_conn_stats(MYSQL* admin, const std::vector<uint32_t> hgs);
/**
* @brief Waits until the condition specified by the 'query' holds, or 'timeout' is reached.
* @details Several details about the function impl:

@ -213,14 +213,6 @@ tests: tests-cpp \
reg_test_3504-change_user_libmysql_helper \
mysql_reconnect_libmariadb-t \
mysql_reconnect_libmysql-t \
test_match_eof_conn_cap_libmysql-t \
test_match_eof_conn_cap_libmariadb-t \
test_sqlite3_special_queries_libmariadb-t \
test_sqlite3_special_queries_libmysql-t \
test_ssl_fast_forward-2_libmariadb-t \
test_ssl_fast_forward-2_libmysql-t \
test_ssl_fast_forward-3_libmariadb-t \
test_ssl_fast_forward-3_libmysql-t \
setparser_test2 setparser_test2-t \
setparser_test3 setparser_test3-t \
set_testing-240.csv \

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save