fix: resolve 4 TAP test failures in multi-group runs

- set_testing-240-t: Fix crash (json type_error.302) when MySQL returns
  NULL variable values or fails the session_variables query. Add null
  guards in parseResult() and all implicit std::string conversions.
- Add show_compatibility_56=ON to MySQL 5.7 configs so querying
  performance_schema.session_variables works reliably.
- test_gtid_forwarding-t: Move from legacy-g5 to legacy-binlog-g1
  (requires infra with session_track_gtids=OWN_GTID configured).
- test_binlog_reader-t: Create own GTID query rules for sbtest8
  instead of relying on pre-existing infra rules that may be deleted.
- test_ffto_pgsql_error_stats-t: Remove from mysql84-g4 group
  (no PostgreSQL backend available in mysql84 infrastructure).
mariadb-rpl-helper
Rene Cannao 1 month ago
parent c678ae40d7
commit 98083cdf0f

@ -6,6 +6,7 @@ sync_binlog=0
server-id=111
gtid_mode=ON
enforce_gtid_consistency=true
show_compatibility_56=ON
log-bin
log-slave-updates
relay_log_info_repository=TABLE

@ -6,6 +6,7 @@ sync_binlog=0
server-id=222
gtid_mode=ON
enforce_gtid_consistency=true
show_compatibility_56=ON
log-bin
log-slave-updates
relay_log_info_repository=TABLE

@ -6,6 +6,7 @@ sync_binlog=0
server-id=333
gtid_mode=ON
enforce_gtid_consistency=true
show_compatibility_56=ON
log-bin
log-slave-updates
relay_log_info_repository=TABLE

@ -28,6 +28,7 @@ sync_binlog=0
server-id=111
gtid_mode=ON
enforce_gtid_consistency=true
show_compatibility_56=ON
log-bin
log-slave-updates
relay_log_info_repository=TABLE

@ -28,6 +28,7 @@ sync_binlog=0
server-id=222
gtid_mode=ON
enforce_gtid_consistency=true
show_compatibility_56=ON
log-bin
log-slave-updates
relay_log_info_repository=TABLE

@ -28,6 +28,7 @@ sync_binlog=0
server-id=333
gtid_mode=ON
enforce_gtid_consistency=true
show_compatibility_56=ON
log-bin
log-slave-updates
relay_log_info_repository=TABLE

File diff suppressed because it is too large Load Diff

@ -319,20 +319,26 @@ void * my_conn_thread(void *arg) {
if (el.key() == "long_query_time") {
// we remove the decimals
std::string tsnd = mysql_vars["long_query_time"];
auto it_lqt = mysql_vars.find("long_query_time");
if (it_lqt != mysql_vars.end() && it_lqt.value().is_string()) {
std::string tsnd = it_lqt.value().get<std::string>();
if (tsnd.find(".") != std::string::npos) {
tsnd = tsnd.substr(0, tsnd.find("."));
mysql_vars["long_query_time"]=tsnd;
}
}
}
if (el.key() == "timestamp") {
// we remove the decimals
std::string tsnd = mysql_vars["timestamp"];
auto it_ts = mysql_vars.find("timestamp");
if (it_ts != mysql_vars.end() && it_ts.value().is_string()) {
std::string tsnd = it_ts.value().get<std::string>();
if (tsnd.find(".") != std::string::npos) {
tsnd = tsnd.substr(0, tsnd.find("."));
mysql_vars["timestamp"]=tsnd;
}
}
}
if (el.key() == "max_join_size") {
if (el.value() == "DEFAULT") {
@ -345,6 +351,7 @@ void * my_conn_thread(void *arg) {
if (el.key() == "optimizer_switch") {
parsing_optimizer_switch = true;
std::string e_val { el.value() };
if (k != mysql_vars.end() && k.value().is_string() && s != proxysql_vars["conn"].end() && s.value().is_string()) {
std::string k_val { k.value() };
std::string s_val { s.value() };
if (e_val == s_val) { // it matches in proxysql
@ -352,6 +359,7 @@ void * my_conn_thread(void *arg) {
optimizer_switch_matches = true;
}
}
}
}
if (el.key() == "sql_mode") {
@ -360,10 +368,10 @@ void * my_conn_thread(void *arg) {
exit(EXIT_FAILURE);
}
if (k.value() != el.value()) { // different in mysql
if (k != mysql_vars.end() && k.value().is_string() && k.value() != el.value()) { // different in mysql
std::string e_val { el.value() };
std::string k_val { k.value() };
std::string s_val { s.value() };
std::string k_val { k.value().get<std::string>() };
std::string s_val { s.value().is_string() ? s.value().get<std::string>() : std::string("") };
if (el.value() == s.value()) { // but same in proxysql
std::string str_val { el.value() };
if (strcasecmp(str_val.c_str(), "TRADITIONAL")==0) {
@ -415,8 +423,8 @@ void * my_conn_thread(void *arg) {
(s == proxysql_vars["conn"].end()) ||
( (parsing_optimizer_switch == true) && (optimizer_switch_matches == false) ) ||
(special_sqlmode == false && parsing_optimizer_switch == false &&
(el.key() != "session_track_gtids" && (k.value() != el.value() || s.value() != el.value())) ||
(el.key() == "session_track_gtids" && !check_session_track_gtids(el.value(), s.value(), k.value()))
(el.key() != "session_track_gtids" && (!k.value().is_string() || !s.value().is_string() || k.value() != el.value() || s.value() != el.value())) ||
(el.key() == "session_track_gtids" && !check_session_track_gtids(el.value().is_string() ? el.value().get<std::string>() : std::string(""), s.value().is_string() ? s.value().get<std::string>() : std::string(""), k.value().is_string() ? k.value().get<std::string>() : std::string("")))
)
) {
if ( k != mysql_vars.end() && s != proxysql_vars["conn"].end()) {

@ -151,9 +151,9 @@ void parseResult(MYSQL_RES *result, json& j) {
assert(nr > 16);
while ((row = mysql_fetch_row(result))) {
if (j.find(row[0]) == j.end()) {
j[row[0]] = row[1];
j[row[0]] = row[1] ? row[1] : "";
} else {
if (strcmp(row[1],UNKNOWNVAR)!=0) {
if (row[1] && strcmp(row[1],UNKNOWNVAR)!=0) {
j[row[0]] = row[1]; // we override only if the new value it is not UNKNOWNVAR
}
}

@ -421,6 +421,34 @@ int main(int argc, char** argv) {
fprintf(stderr, "================================================================================\n");
fprintf(stderr, "\n");
// Create GTID-based query rules for sbtest8
{
string query;
query = "DELETE FROM mysql_query_rules WHERE username='sbtest8'";
MYSQL_QUERY(proxysql_admin, query.c_str());
mysql_free_result(mysql_store_result(proxysql_admin));
query = "INSERT INTO mysql_query_rules (rule_id,active,username,match_digest,destination_hostgroup,apply,gtid_from_hostgroup,comment) "
"VALUES (1,1,'sbtest8','^SELECT.*FOR UPDATE'," + std::to_string(WHG) + ",1,null,'test_binlog_reader-t')";
MYSQL_QUERY(proxysql_admin, query.c_str());
mysql_free_result(mysql_store_result(proxysql_admin));
query = "INSERT INTO mysql_query_rules (rule_id,active,username,match_digest,destination_hostgroup,apply,gtid_from_hostgroup,comment) "
"VALUES (2,1,'sbtest8','^SELECT'," + std::to_string(RHG) + ",1," + std::to_string(WHG) + ",'test_binlog_reader-t')";
MYSQL_QUERY(proxysql_admin, query.c_str());
mysql_free_result(mysql_store_result(proxysql_admin));
query = "INSERT INTO mysql_query_rules (rule_id,active,username,match_digest,destination_hostgroup,apply,gtid_from_hostgroup,comment) "
"VALUES (3,1,'sbtest8','.*'," + std::to_string(WHG) + ",1,null,'test_binlog_reader-t')";
MYSQL_QUERY(proxysql_admin, query.c_str());
mysql_free_result(mysql_store_result(proxysql_admin));
query = "LOAD MYSQL QUERY RULES TO RUNTIME";
MYSQL_QUERY(proxysql_admin, query.c_str());
mysql_free_result(mysql_store_result(proxysql_admin));
fprintf(stderr, "GTID query rules created for sbtest8 (WHG=%d, RHG=%d)\n", WHG, RHG);
}
vector<pair<uint32_t, mysql_res_row>> failed_rows {};
vector<mysql_res_row> reader_1_read {};
vector<mysql_res_row> reader_2_read {};

Loading…
Cancel
Save