diff --git a/include/proxysql_structs.h b/include/proxysql_structs.h index 0da273ef5d..d8ba71318b 100644 --- a/include/proxysql_structs.h +++ b/include/proxysql_structs.h @@ -173,11 +173,10 @@ enum mysql_variable_name { SQL_CHARACTER_SET_CONNECTION, SQL_CHARACTER_SET_CLIENT, SQL_CHARACTER_SET_DATABASE, - SQL_ISOLATION_LEVEL, - SQL_TRANSACTION_READ, SQL_COLLATION_CONNECTION, - SQL_WSREP_SYNC_WAIT, SQL_NAME_LAST_LOW_WM, + SQL_ISOLATION_LEVEL, + SQL_TRANSACTION_READ, SQL_AURORA_READ_REPLICA_READ_COMMITTED, SQL_AUTO_INCREMENT_INCREMENT, SQL_AUTO_INCREMENT_OFFSET, @@ -225,6 +224,7 @@ enum mysql_variable_name { SQL_NEXT_TRANSACTION_READ, SQL_UNIQUE_CHECKS, SQL_WSREP_OSU_METHOD, + SQL_WSREP_SYNC_WAIT, SQL_NAME_LAST_HIGH_WM, }; @@ -1139,13 +1139,12 @@ mysql_variable_st mysql_tracked_variables[] { { SQL_CHARACTER_SET_CONNECTION, SETTING_VARIABLE, false, false, false, false, (char *)"character_set_connection", (char *)"character_set_connection", (char *)"utf8", false } , { SQL_CHARACTER_SET_CLIENT, SETTING_VARIABLE, false, false, false, false, (char *)"character_set_client", (char *)"character_set_client", (char *)"utf8" , false} , { SQL_CHARACTER_SET_DATABASE, SETTING_VARIABLE, false, false, false, false, (char *)"character_set_database", (char *)"character_set_database", (char *)"utf8" , false} , - { SQL_ISOLATION_LEVEL, SETTING_ISOLATION_LEVEL, false, true, false, false, (char *)"SESSION TRANSACTION ISOLATION LEVEL", (char *)"isolation_level", (char *)"READ COMMITTED" , false} , - // NOTE: we also need support for transaction_read_only session variable - { SQL_TRANSACTION_READ, SETTING_TRANSACTION_READ, false, true, false, false, (char *)"SESSION TRANSACTION READ", (char *)"transaction_read", (char *)"WRITE" , false} , { SQL_COLLATION_CONNECTION, SETTING_VARIABLE, true, false, false, false, (char *)"collation_connection", (char *)"collation_connection", (char *)"utf8_general_ci" , true} , // { SQL_NET_WRITE_TIMEOUT, SETTING_VARIABLE, false, false, true, false, (char *)"net_write_timeout", (char *)"net_write_timeout", (char *)"60" , false} , - { SQL_WSREP_SYNC_WAIT, SETTING_VARIABLE, false, false, true, false, (char *)"wsrep_sync_wait", (char *)"wsrep_sync_wait", (char *)"0" , false} , { SQL_NAME_LAST_LOW_WM, SETTING_VARIABLE, false, false, true, false, (char *)"placeholder", (char *)"placeholder", (char *)"0" , false} , // this is just a placeholder to separate the previous index from the next block + { SQL_ISOLATION_LEVEL, SETTING_ISOLATION_LEVEL, false, true, false, false, (char *)"SESSION TRANSACTION ISOLATION LEVEL", (char *)"isolation_level", (char *)"READ COMMITTED" , false} , + // NOTE: we also need support for transaction_read_only session variable + { SQL_TRANSACTION_READ, SETTING_TRANSACTION_READ, false, true, false, false, (char *)"SESSION TRANSACTION READ", (char *)"transaction_read", (char *)"WRITE" , false} , { SQL_AURORA_READ_REPLICA_READ_COMMITTED, SETTING_VARIABLE, false, false, false, true, ( char *)"aurora_read_replica_read_committed", NULL, (char *)"" , false} , { SQL_AUTO_INCREMENT_INCREMENT, SETTING_VARIABLE, false, false, true, false, (char *)"auto_increment_increment", NULL, (char *)"" , false} , { SQL_AUTO_INCREMENT_OFFSET, SETTING_VARIABLE, false, false, true, false, (char *)"auto_increment_offset", NULL, (char *)"" , false} , @@ -1196,7 +1195,7 @@ mysql_variable_st mysql_tracked_variables[] { { SQL_NEXT_TRANSACTION_READ, SETTING_NEXT_TRANSACTION_READ, false, true, false, false, (char *)"transaction read", (char *)"next_transaction_read", (char *)"WRITE" , false} , { SQL_UNIQUE_CHECKS, SETTING_VARIABLE, true, false, false, true, (char *)"unique_checks", NULL, (char *)"" , false} , { SQL_WSREP_OSU_METHOD, SETTING_VARIABLE, true, false, false, false, (char *)"wsrep_osu_method", NULL, (char *)"" , false} , - + { SQL_WSREP_SYNC_WAIT, SETTING_VARIABLE, false, false, true, false, (char *)"wsrep_sync_wait", (char *)"wsrep_sync_wait", (char *)"0" , false} , /* variables that will need input validation: binlog_row_image diff --git a/lib/MySQL_Session.cpp b/lib/MySQL_Session.cpp index b722494c09..215cff61c1 100644 --- a/lib/MySQL_Session.cpp +++ b/lib/MySQL_Session.cpp @@ -2564,14 +2564,7 @@ bool MySQL_Session::handler_again___status_SETTING_GENERIC_VARIABLE(int *_rc, co // https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/AuroraMySQL.Reference.html#AuroraMySQL.Reference.IsolationLevels // Basically, to change isolation level you must first set // aurora_read_replica_read_committed , and then isolation level - MySQL_Connection *beconn = mybe->server_myds->myconn; - if (beconn->var_hash[SQL_ISOLATION_LEVEL] != 0) { - beconn->var_hash[SQL_ISOLATION_LEVEL] = 0; - if (beconn->variables[SQL_ISOLATION_LEVEL].value) { - free(beconn->variables[SQL_ISOLATION_LEVEL].value); - beconn->variables[SQL_ISOLATION_LEVEL].value = NULL; - } - } + mysql_variables.server_reset_value(this, SQL_ISOLATION_LEVEL); sprintf(query,q,var_name, var_value); } else { sprintf(query,q,var_name, var_value);