fix: MySQL 9.x charset handling and log_last_insert_id test race

- validate_charset: compare server_version as a numeric major
  version instead of testing the first character, so MySQL 9.x
  and later are treated like 8.x for collations with id >= 255
- test_log_last_insert_id-t: re-enable PROXYSQL FLUSH LOGS; with
  buffered query logging, eventslog_flush_timeout=0 alone still
  races the periodic flush thread
pull/5625/head
Rene Cannao 2 months ago
parent d212102ce5
commit 7c6f42bcd8

@ -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));

@ -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());

Loading…
Cancel
Save