From 1f351adb30ae601d220a85f13fcaded5b6b104be Mon Sep 17 00:00:00 2001 From: yuanyazhi Date: Wed, 27 Mar 2024 17:02:32 +0800 Subject: [PATCH] fix lock --- storage/tianchi/tse_ddl_rewriter_plugin.cc | 2 +- storage/tianchi/tse_mysql_proxy.cc | 2 +- storage/tianchi/tse_util.h | 2 ++ 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/storage/tianchi/tse_ddl_rewriter_plugin.cc b/storage/tianchi/tse_ddl_rewriter_plugin.cc index 82978d9..4519838 100644 --- a/storage/tianchi/tse_ddl_rewriter_plugin.cc +++ b/storage/tianchi/tse_ddl_rewriter_plugin.cc @@ -1219,7 +1219,7 @@ static int tse_ddl_rewrite(MYSQL_THD thd, mysql_event_class_t event_class, // for non-metadata-normalization's gate test DBUG_EXECUTE_IF("non_metadata_normalization", { check_metadata_switch_result = 1; }); // broadcast SET_OPTION query with subselect item - if (check_metadata_switch_result != 1 && !(need_forward && sql_cmd == SQLCOM_SET_OPTION)) { + if (check_metadata_switch_result != 1 && !(need_forward && g_rewrite_sqls.find(sql_cmd) != g_rewrite_sqls.end())) { return check_metadata_switch_result; } diff --git a/storage/tianchi/tse_mysql_proxy.cc b/storage/tianchi/tse_mysql_proxy.cc index 178f674..b9977a6 100644 --- a/storage/tianchi/tse_mysql_proxy.cc +++ b/storage/tianchi/tse_mysql_proxy.cc @@ -369,7 +369,7 @@ __attribute__((visibility("default"))) int tse_ddl_execute_update(uint32_t thd_i } bool is_meta_normalization = IS_METADATA_NORMALIZATION(); - if (is_meta_normalization && broadcast_req->sql_command != SQLCOM_SET_OPTION) { + if (is_meta_normalization && g_rewrite_sqls.find(broadcast_req->sql_command) == g_rewrite_sqls.end()) { return 0; } else if (is_meta_normalization && broadcast_req->sql_command == SQLCOM_SET_OPTION && (broadcast_req->options & TSE_SET_VARIABLE_WITH_SUBSELECT) == 0){ diff --git a/storage/tianchi/tse_util.h b/storage/tianchi/tse_util.h index 3cad7f2..a2c6adf 100644 --- a/storage/tianchi/tse_util.h +++ b/storage/tianchi/tse_util.h @@ -22,6 +22,7 @@ #include #include #include +#include #include "sql/table.h" #include "datatype_cnvrtr.h" #include "sql/item_timefunc.h" @@ -31,6 +32,7 @@ using namespace std; static unordered_set mysql_system_db{"information_schema", "mysql", "performance_schema", "sys"}; +static set g_rewrite_sqls {SQLCOM_SET_OPTION, SQLCOM_LOCK_TABLES, SQLCOM_UNLOCK_TABLES}; #define CM_IS_EMPTY_STR(str) (((str) == NULL) || ((str)[0] == 0)) -- Gitee