Add list of special permitted variables tracking errors - Closes #4591

This list hold tracking errors that in practice are equivalent to
ER_UNKNOWN_SYSTEM_VARIABLE and that we want to handle in the same way.
pull/4588/head
Javier Jaramago Fernández 2 years ago
parent 7f441ecf0e
commit b91b6b8f9f

@ -20,6 +20,7 @@ bool update_server_variable(MySQL_Session* session, int idx, int &_rc);
bool verify_server_variable(MySQL_Session* session, int idx, uint32_t client_hash, uint32_t server_hash);
bool verify_set_names(MySQL_Session* session);
bool logbin_update_server_variable(MySQL_Session* session, int idx, int &_rc);
bool is_perm_track_err(int err, const char* varname);
class MySQL_Variables {
static verify_var verifiers[SQL_NAME_LAST_HIGH_WM];

@ -277,6 +277,11 @@ typedef struct {
char * default_value; // default value
bool is_global_variable; // is it a global variable?
} mysql_variable_st;
typedef struct {
int err;
const char* name;
} var_track_err_st;
#endif
enum mysql_data_stream_status {
@ -1218,10 +1223,9 @@ mysql_variable_st mysql_tracked_variables[] {
session_track_system_variables
session_track_transaction_info
*/
};
#else
extern mysql_variable_st mysql_tracked_variables[];
extern var_track_err_st perm_track_errs[];
#endif // PROXYSQL_EXTERN
#endif // MYSQL_TRACKED_VARIABLES

@ -2974,6 +2974,8 @@ bool MySQL_Session::handler_again___status_SETTING_GENERIC_VARIABLE(int *_rc, co
(myerr == 1193) // variable is not found
||
(myerr == 1651) // Query cache is disabled
||
(is_perm_track_err(myerr, var_name)) // Special permitted tracking errors (~= '1193')
) {
int idx = SQL_NAME_LAST_HIGH_WM;
for (int i=0; i<SQL_NAME_LAST_HIGH_WM; i++) {

@ -9,6 +9,7 @@
#endif
#include <sstream>
#include "mysql/mysqld_error.h"
static inline char is_digit(char c) {
@ -17,6 +18,23 @@ static inline char is_digit(char c) {
return 0;
}
var_track_err_st perm_track_errs[] {
// ERROR 1210 (HY000): Variable not supported in combination with Galera:
// - Changed by MySQL, previously 'ER_UNKNOWN_SYSTEM_VARIABLE'
{ ER_WRONG_ARGUMENTS, "sql_generate_invisible_primary_key" }
};
bool is_perm_track_err(int err, const char* varname) {
const size_t count = sizeof(perm_track_errs) / sizeof(var_track_err_st);
for (size_t i = 0; i < count; i++) {
if (perm_track_errs[i].err == err && (strcasecmp(varname, perm_track_errs[i].name) == 0)) {
return true;
}
}
return false;
}
#include "proxysql_find_charset.h"
verify_var MySQL_Variables::verifiers[SQL_NAME_LAST_HIGH_WM];

Loading…
Cancel
Save