diff --git a/lib/MySQL_Variables.cpp b/lib/MySQL_Variables.cpp index 5b2cd406d..a370c297c 100644 --- a/lib/MySQL_Variables.cpp +++ b/lib/MySQL_Variables.cpp @@ -337,7 +337,9 @@ bool validate_charset(MySQL_Session* session, int idx, int &_rc) { unsigned int replace_collation_nr = 0; std::stringstream ss; int charset = atoi(mysql_variables.client_get_value(session, idx)); - if (charset >= 255 && myconn->mysql->server_version[0] != '8') { + // Pre-8.0 MySQL cannot handle collations with id >= 255. + // MySQL 8.x, 9.x and later can — match by numeric major version, not first character. + if (charset >= 255 && atoi(myconn->mysql->server_version) < 8) { switch(mysql_thread___handle_unknown_charset) { case HANDLE_UNKNOWN_CHARSET__DISCONNECT_CLIENT: snprintf(msg,sizeof(msg),"Can't initialize character set %s", mysql_variables.client_get_value(session, idx)); diff --git a/test/tap/tests/test_log_last_insert_id-t.cpp b/test/tap/tests/test_log_last_insert_id-t.cpp index 1e8596a11..b0ea8a31e 100644 --- a/test/tap/tests/test_log_last_insert_id-t.cpp +++ b/test/tap/tests/test_log_last_insert_id-t.cpp @@ -77,11 +77,10 @@ int main(int argc, char** argv) { MYSQL_QUERY(proxysql_mysql, "INSERT INTO test.test_insert_id VALUES (NULL)"); MYSQL_QUERY(proxysql_mysql, "DO 1"); - /* in 3.0.6 we added buffering for query log . So we either flush logs or set mysql-eventslog_flush_timeout = 0 */ - /* + /* in 3.0.6 we added buffering for query log; flush_timeout=0 alone leaves a race + * between query completion and the periodic flush thread, so force a flush here. */ MYSQL_QUERY(proxysql_admin, "PROXYSQL FLUSH LOGS"); sleep(1); - */ { const string f_path { get_env("REGULAR_INFRA_DATADIR") + "/loginsertid.log.00000001" }; diag("Trying to open file %s" , f_path.c_str());