From 8e51f1a9b28a74b3d574311dd6840d4010d751fe Mon Sep 17 00:00:00 2001 From: yuanyazhi Date: Thu, 14 Nov 2024 10:18:42 +0800 Subject: [PATCH 1/2] broadcast_global_var --- storage/ctc/ctc_ddl_rewriter_plugin.cc | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/storage/ctc/ctc_ddl_rewriter_plugin.cc b/storage/ctc/ctc_ddl_rewriter_plugin.cc index 45aa8d3..5da5639 100644 --- a/storage/ctc/ctc_ddl_rewriter_plugin.cc +++ b/storage/ctc/ctc_ddl_rewriter_plugin.cc @@ -210,22 +210,10 @@ int unsupport_tx_isolation_level(set_var *setvar, bool &need_forward MY_ATTRIBUT return -1; } -int ctc_check_opt_forward(set_var *setvar MY_ATTRIBUTE((unused)), bool &need_forward, - string user_val_str MY_ATTRIBUTE((unused))) { - need_forward = false; - push_warning_printf(current_thd, Sql_condition::SL_WARNING, ER_DISALLOWED_OPERATION, - "CTC: This parameter will not be broadcast to other nodes."); - return 0; -} - static std::unordered_map set_variable_rules_map = { {"default_storage_engine", check_default_engine}, {"max_connections", check_session_pool_volume}, - {"transaction_isolation", unsupport_tx_isolation_level}, - {"read_only", ctc_check_opt_forward}, - {"super_read_only", ctc_check_opt_forward}, - {"offline_mode", ctc_check_opt_forward}, - {"gtid_next", ctc_check_opt_forward} + {"transaction_isolation", unsupport_tx_isolation_level} }; static int ctc_get_user_var_string(MYSQL_THD thd, Item_func_get_user_var *itemFunc, string &user_val_str) { -- Gitee From 0753679499626c601bce13b32c7c65c988fb76f7 Mon Sep 17 00:00:00 2001 From: cnnblike Date: Mon, 18 Nov 2024 19:01:51 +0800 Subject: [PATCH 2/2] removing trailing space --- storage/ctc/ctc_cbo.cc | 14 ++--- storage/ctc/ctc_cbo.h | 4 +- storage/ctc/ctc_ddl_rewriter_plugin.cc | 22 +++---- storage/ctc/ctc_ddl_util.cc | 14 ++--- storage/ctc/ctc_error.cc | 6 +- storage/ctc/ctc_error.h | 2 +- storage/ctc/ctc_log.h | 6 +- storage/ctc/ctc_meta_data.cc | 6 +- storage/ctc/ctc_meta_data.h | 2 +- storage/ctc/ctc_mysql_proxy.cc | 16 ++--- storage/ctc/ctc_proxy_util.cc | 12 ++-- storage/ctc/ctc_proxy_util.h | 6 +- storage/ctc/ctc_srv.h | 4 +- storage/ctc/ctc_srv_mq_module.cc | 4 +- storage/ctc/ctc_srv_mq_module.h | 4 +- storage/ctc/ctc_srv_mq_stub.cc | 14 ++--- storage/ctc/ctc_stats.cc | 6 +- storage/ctc/ctc_stats.h | 4 +- storage/ctc/ctc_util.cc | 6 +- storage/ctc/ctc_util.h | 4 +- storage/ctc/datatype_cnvrt_4_index_search.cc | 6 +- storage/ctc/datatype_cnvrt_4_index_search.h | 6 +- storage/ctc/datatype_cnvrtr.cc | 22 +++---- storage/ctc/datatype_cnvrtr.h | 14 ++--- storage/ctc/decimal_convert.cc | 4 +- storage/ctc/decimal_convert.h | 2 +- storage/ctc/ha_ctc.cc | 64 +++++++++---------- storage/ctc/ha_ctc.h | 4 +- storage/ctc/ha_ctc_ddl.cc | 66 ++++++++++---------- storage/ctc/ha_ctc_ddl.h | 10 +-- storage/ctc/ha_ctcpart.cc | 31 +++++---- storage/ctc/ha_ctcpart.h | 12 ++-- storage/ctc/message_queue/dsw_list.h | 2 +- storage/ctc/message_queue/dsw_message.h | 4 +- storage/ctc/message_queue/dsw_shm.h | 4 +- storage/ctc/message_queue/dsw_typedef.h | 4 +- storage/ctc/mysql_cantian_plugin.cc | 10 +-- storage/ctc/protobuf/tc_db.pb-c.h | 4 +- storage/ctc/protobuf/tc_db.proto | 6 +- storage/ctc/srv_mq_msg.h | 4 +- 40 files changed, 217 insertions(+), 218 deletions(-) diff --git a/storage/ctc/ctc_cbo.cc b/storage/ctc/ctc_cbo.cc index 2687648..ba5a15c 100644 --- a/storage/ctc/ctc_cbo.cc +++ b/storage/ctc/ctc_cbo.cc @@ -12,7 +12,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Bon, MA 02110-1301 USA + Foundation, Inc., 51 Franklin St, Fifth Floor, Bon, MA 02110-1301 USA */ #include "ctc_cbo.h" #include "ha_ctc.h" @@ -117,7 +117,7 @@ void r_key2variant(ctc_key *rKey, KEY_PART_INFO *cur_index_part, cache_variant_t break; case MYSQL_TYPE_FLOAT: ret_val->v_real = *(float *)const_cast(key); - break; + break; case MYSQL_TYPE_DOUBLE: ret_val->v_real = *(double *)const_cast(key); break; @@ -244,15 +244,15 @@ static en_ctc_compare_type compare(cache_variant_t *right, cache_variant_t *left double eval_density_result(double density) { /* - * key range is beyond the actual index range, + * key range is beyond the actual index range, * don't have any records in this range */ if (density < 0) { return 0; } - /* - * key range is larger than the actual index range, - * any key with this range shoule be deemed as not selective + /* + * key range is larger than the actual index range, + * any key with this range shoule be deemed as not selective */ if (density > 1) { return 1; @@ -722,4 +722,4 @@ void ctc_index_stats_update(TABLE *table, ctc_cbo_stats_t *cbo_stats) sk.set_records_per_key(j, rec_per_key); } } -} +} \ No newline at end of file diff --git a/storage/ctc/ctc_cbo.h b/storage/ctc/ctc_cbo.h index 4006690..fea6ee7 100644 --- a/storage/ctc/ctc_cbo.h +++ b/storage/ctc/ctc_cbo.h @@ -12,7 +12,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef __CTC_CBO_H__ @@ -74,4 +74,4 @@ double calc_density_one_table(uint16_t idx_id, ctc_range_key *key, ctc_cbo_stats_table_t *cbo_stats, const TABLE &table); void calc_accumulate_gcol_num(uint num_fields, Field** field, uint32_t *acc_gcol_num); void ctc_index_stats_update(TABLE *table, ctc_cbo_stats_t *cbo_stats); -#endif +#endif \ No newline at end of file diff --git a/storage/ctc/ctc_ddl_rewriter_plugin.cc b/storage/ctc/ctc_ddl_rewriter_plugin.cc index 08cfb42..f7ff54b 100644 --- a/storage/ctc/ctc_ddl_rewriter_plugin.cc +++ b/storage/ctc/ctc_ddl_rewriter_plugin.cc @@ -12,7 +12,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include @@ -404,9 +404,9 @@ static int ctc_rewrite_setpasswd(MYSQL_THD thd, string &sql_str) { rw_query_sql = regex_replace(rw_query_sql, add_or_rewrite_for_pattern, user2host.c_str()); // 为当前用户设置密码,为不报错不加replace - if (user_for_setpasswd->uses_replace_clause && + if (user_for_setpasswd->uses_replace_clause && !strcmp(thd->m_main_security_ctx.priv_user().str, user_for_setpasswd->user.str)) { - // check replacing old password is correct or not + // check replacing old password is correct or not bool is_password_matched = false; if (ctc_verify_password4existed_user(thd, user_for_setpasswd, is_password_matched)) { return -1; @@ -1012,11 +1012,11 @@ bool is_ddl_sql_cmd(enum_sql_command sql_cmd) { bool is_dcl_sql_cmd(enum_sql_command sql_cmd) { if (sql_cmd == SQLCOM_GRANT || sql_cmd == SQLCOM_REVOKE || - sql_cmd == SQLCOM_CREATE_USER || sql_cmd == SQLCOM_DROP_USER || - sql_cmd == SQLCOM_RENAME_USER || sql_cmd == SQLCOM_REVOKE_ALL || - sql_cmd == SQLCOM_ALTER_USER || sql_cmd == SQLCOM_ALTER_USER_DEFAULT_ROLE || + sql_cmd == SQLCOM_CREATE_USER || sql_cmd == SQLCOM_DROP_USER || + sql_cmd == SQLCOM_RENAME_USER || sql_cmd == SQLCOM_REVOKE_ALL || + sql_cmd == SQLCOM_ALTER_USER || sql_cmd == SQLCOM_ALTER_USER_DEFAULT_ROLE || sql_cmd == SQLCOM_CREATE_ROLE || sql_cmd == SQLCOM_DROP_ROLE || - sql_cmd == SQLCOM_SET_ROLE || sql_cmd ==SQLCOM_GRANT_ROLE || + sql_cmd == SQLCOM_SET_ROLE || sql_cmd ==SQLCOM_GRANT_ROLE || sql_cmd == SQLCOM_REVOKE_ROLE) { return true; } @@ -1064,7 +1064,7 @@ static void ctc_ddl_rewrite_handle_error(MYSQL_THD thd, int ret, ctc_ddl_broadca return; } -int ddl_broadcast_and_wait(MYSQL_THD thd, string &query_str, +int ddl_broadcast_and_wait(MYSQL_THD thd, string &query_str, uint8_t sql_cmd, ddl_broadcast_cmd &broadcast_cmd) { ctc_handler_t tch; memset(&tch, 0, sizeof(tch)); @@ -1195,7 +1195,7 @@ int ctc_record_sql(MYSQL_THD thd, bool need_select_db) { return ret; } -bool plugin_ddl_block(MYSQL_THD thd, +bool plugin_ddl_block(MYSQL_THD thd, unordered_map::iterator &it, string &query_str, bool &need_forward) { @@ -1203,7 +1203,7 @@ bool plugin_ddl_block(MYSQL_THD thd, if (broadcast_cmd.pre_func != NULL) { int ret = broadcast_cmd.pre_func(query_str, thd, need_forward); if (ret != 0) { - ctc_log_system("pre_func execute failed,ret:%d,cmd:%d, sql:%s", + ctc_log_system("pre_func execute failed,ret:%d,cmd:%d, sql:%s", ret, it->first, query_str.c_str()); return true; } @@ -1468,4 +1468,4 @@ struct st_mysql_plugin g_ctc_ddl_rewriter_plugin = { /* Plugin flags */ /* unsigned long */ STRUCT_FLD(flags, PLUGIN_OPT_ALLOW_EARLY), -}; +}; \ No newline at end of file diff --git a/storage/ctc/ctc_ddl_util.cc b/storage/ctc/ctc_ddl_util.cc index ef26c46..37e0a3d 100644 --- a/storage/ctc/ctc_ddl_util.cc +++ b/storage/ctc/ctc_ddl_util.cc @@ -290,14 +290,14 @@ bool set_column_datatype(size_t set_num, TcDb__CtcDDLColumnDef *column) { return true; } else if (set_num > 8 && set_num < 17) { column->datatype->datatype = CTC_DDL_TYPE_SHORT; - return true; + return true; } else if (set_num > 16 && set_num < 33) { column->datatype->datatype = CTC_DDL_TYPE_INT24; - return true; + return true; } else if (set_num > 32 && set_num < 65) { column->datatype->datatype = CTC_DDL_TYPE_LONGLONG; - return true; - } + return true; + } return false; } @@ -431,7 +431,7 @@ bool ctc_ddl_get_create_key_algorithm(dd::Index::enum_index_algorithm algorithm, *ret_algorithm = (int32_t)it->second; return true; } - my_printf_error(ER_DISALLOWED_OPERATION, + my_printf_error(ER_DISALLOWED_OPERATION, "get index algorithm failed, unsuported index algorithm", MYF(0)); return false; } @@ -456,7 +456,7 @@ uint16 get_prefix_index_len(const Field *field, const uint16 key_length) { int convert_ctc_part_type(dd::Table::enum_partition_type mysql_part_type, uint32_t *ctc_part_type) { *ctc_part_type = CTC_PART_TYPE_INVALID; switch (mysql_part_type) { - case dd::Table::PT_RANGE: + case dd::Table::PT_RANGE: case dd::Table::PT_RANGE_COLUMNS: *ctc_part_type = CTC_PART_TYPE_RANGE; break; @@ -502,4 +502,4 @@ int convert_ctc_subpart_type(dd::Table::enum_subpartition_type mysql_subpart_typ return 1; } return 0; -} +} \ No newline at end of file diff --git a/storage/ctc/ctc_error.cc b/storage/ctc/ctc_error.cc index 29ba361..9c618be 100644 --- a/storage/ctc/ctc_error.cc +++ b/storage/ctc/ctc_error.cc @@ -12,7 +12,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include #include "ctc_error.h" @@ -153,7 +153,7 @@ int convert_cantian_err_to_mysql(ct_errno_t error) { void ctc_alter_table_handle_fault(ct_errno_t error) { switch (error) { case ERR_CONSTRAINT_VIOLATED_NO_FOUND: - my_printf_error(ER_NO_REFERENCED_ROW_2, + my_printf_error(ER_NO_REFERENCED_ROW_2, "Cannot add or update a child row: a foreign key constraint fails.", MYF(0)); break; default: @@ -191,4 +191,4 @@ int convert_ctc_error_code_to_mysql_impl(ct_errno_t error, const char* funcName, } ctc_log_note("func %s(line%d) returned with errCode %d, cantian ret %d", funcName, line, ret, (int)error); return ret; -} +} \ No newline at end of file diff --git a/storage/ctc/ctc_error.h b/storage/ctc/ctc_error.h index c1e913a..73017a4 100644 --- a/storage/ctc/ctc_error.h +++ b/storage/ctc/ctc_error.h @@ -12,7 +12,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef __CTC_ERROR_H__ #define __CTC_ERROR_H__ diff --git a/storage/ctc/ctc_log.h b/storage/ctc/ctc_log.h index 144f809..75fe461 100644 --- a/storage/ctc/ctc_log.h +++ b/storage/ctc/ctc_log.h @@ -12,7 +12,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include // vfprintf, stderr @@ -71,7 +71,7 @@ static void do_security_filter(char *filter_str) { } /* - Print message to MySQL Server's error log(s) + Print message to MySQL Server's error log(s) @param loglevel Selects the loglevel used when printing the message to log. @@ -156,4 +156,4 @@ void ctc_log_print(enum loglevel loglevel, const char *fmt, ...) { } \ } while (0) -#endif // __CTC_LOG_H__ +#endif // __CTC_LOG_H__ \ No newline at end of file diff --git a/storage/ctc/ctc_meta_data.cc b/storage/ctc/ctc_meta_data.cc index 5909e3a..6be5d88 100644 --- a/storage/ctc/ctc_meta_data.cc +++ b/storage/ctc/ctc_meta_data.cc @@ -12,7 +12,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include "ctc_meta_data.h" #include @@ -279,7 +279,7 @@ typename std::enable_if::type sp = sp_cache_lookup(spc, name); if (sp) { sp_cache_flush_obsolete(spc, &sp); - } + } if (routine_ticket) thd->mdl_context.release_lock(routine_ticket); if (schema_ticket) thd->mdl_context.release_lock(schema_ticket); @@ -982,4 +982,4 @@ int ctc_ddl_execute_lock_tables_by_req(ctc_handler_t *tch, ctc_lock_table_info * my_thread_end(); return false; -} +} \ No newline at end of file diff --git a/storage/ctc/ctc_meta_data.h b/storage/ctc/ctc_meta_data.h index 92fd986..e8b14f9 100644 --- a/storage/ctc/ctc_meta_data.h +++ b/storage/ctc/ctc_meta_data.h @@ -12,7 +12,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef __CTC_META_DATA_H__ diff --git a/storage/ctc/ctc_mysql_proxy.cc b/storage/ctc/ctc_mysql_proxy.cc index 8141c5f..32a0e54 100644 --- a/storage/ctc/ctc_mysql_proxy.cc +++ b/storage/ctc/ctc_mysql_proxy.cc @@ -12,7 +12,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include #include @@ -111,7 +111,7 @@ static void ctc_drop_proxy_user(MYSQL *agent_conn, const string &proxy_user_name } } -static int ctc_create_proxy_user(MYSQL *agent_conn, const char*user_name, const char*user_ip, +static int ctc_create_proxy_user(MYSQL *agent_conn, const char*user_name, const char*user_ip, string &proxy_user_name, string &proxy_user_password) { string create_user_sql = "CREATE USER '" + proxy_user_name + \ @@ -208,7 +208,7 @@ static void get_ctc_mysql_conn(uint64_t conn_map_key, MYSQL *&curr_conn) { } } -int ctc_init_mysql_client(uint64_t conn_map_key, const char *db, MYSQL *&curr_conn, +int ctc_init_mysql_client(uint64_t conn_map_key, const char *db, MYSQL *&curr_conn, const char *user_name, const char *user_ip, bool use_proxy) { if (opt_noacl && strcmp(user_name, "skip-grants user") == 0) { @@ -257,7 +257,7 @@ int ctc_init_mysql_client(uint64_t conn_map_key, const char *db, MYSQL *&curr_co ret = ctc_select_db(curr_conn, db); if (ret != 0) { - ctc_log_error("ctc_init_mysql_client select db failed, err_code=%d, err_msg=%s.", + ctc_log_error("ctc_init_mysql_client select db failed, err_code=%d, err_msg=%s.", mysql_errno(curr_conn), mysql_error(curr_conn)); ctc_close_mysql_conn(&curr_conn); return ret; @@ -371,7 +371,7 @@ __attribute__((visibility("default"))) int ctc_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) { return 0; - } else if (is_meta_normalization && broadcast_req->sql_command == SQLCOM_SET_OPTION + } else if (is_meta_normalization && broadcast_req->sql_command == SQLCOM_SET_OPTION && (broadcast_req->options & CTC_SET_VARIABLE_WITH_SUBSELECT) == 0){ return ctc_set_sys_var(broadcast_req); } @@ -550,7 +550,7 @@ __attribute__((visibility("default"))) int ctc_ddl_execute_lock_tables(ctc_handl } if (lock_info->sql_type == SQLCOM_CREATE_TABLE || - lock_info->sql_type == SQLCOM_DROP_VIEW || + lock_info->sql_type == SQLCOM_DROP_VIEW || lock_info->sql_type == SQLCOM_CREATE_VIEW) { ctc_log_note("[CTC_LOCK_TABLE]:Skip lock_table. sql_cmd:%d", lock_info->sql_type); return 0; @@ -665,7 +665,7 @@ __attribute__((visibility("default"))) int ctc_ddl_execute_unlock_tables(ctc_han return 0; } -/* thd_id为0时,关闭实例id为mysql_inst_id的所有连接 +/* thd_id为0时,关闭实例id为mysql_inst_id的所有连接 * mysql_inst_id: 高16位 ---> 参天实例id * 低16位 ---> mysqld实例id, 由当前节点参天分配,取值范围(2-19) * 低16位全为1代表整个参天节点故障,清理与参天实例id相关的资源 @@ -700,4 +700,4 @@ __attribute__((visibility("default"))) int close_mysql_connection(uint32_t thd_i close_mysql_conn_by_key(agent_conn_map_key); } return 0; -} +} \ No newline at end of file diff --git a/storage/ctc/ctc_proxy_util.cc b/storage/ctc/ctc_proxy_util.cc index 06fe128..1d93b1e 100644 --- a/storage/ctc/ctc_proxy_util.cc +++ b/storage/ctc/ctc_proxy_util.cc @@ -12,7 +12,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include "ctc_proxy_util.h" @@ -138,7 +138,7 @@ int ctc_mysql_conn(MYSQL *&con, const char *host, const char *user, const char * // do init sql commands for new con. // for ddl do not go to ctc SE. this command should be first executed. it should be placed firstly at mysql_options MYSQL_INIT_COMMAND. (void)mysql_options(con, MYSQL_INIT_COMMAND, "set @ctc_ddl_local_enabled = true;"); - /* proxy的连接强制解除只读属性 + /* proxy的连接强制解除只读属性 proxy的连接应该永远都是没有只读状态才对的,因为如果发起端连接只读,ddl不会转到远端, 但是如果发起端没有只读属性,远端proxy建立的连接有只读属性,远端执行ddl就会报错,节点被踢掉 */ @@ -151,7 +151,7 @@ int ctc_mysql_conn(MYSQL *&con, const char *host, const char *user, const char * (void)mysql_options(con, MYSQL_OPT_WRITE_TIMEOUT, &opt_timeout); int retry_time = CTC_CONN_MAX_RETRY_TIMES; - int dec_conn_count = 0; + int dec_conn_count = 0; while (!mysql_real_connect(con, host, user, passwd, NULL, mysqld_port, mysqld_unix_port, CLIENT_MULTI_STATEMENTS | CLIENT_MULTI_RESULTS | CLIENT_REMEMBER_OPTIONS | CLIENT_INTERACTIVE) && retry_time > 0) { int err = mysql_errno(con); if (err == ER_CON_COUNT_ERROR) { @@ -206,11 +206,11 @@ int ctc_mysql_query(MYSQL *mysql, const char *query) { ctc_log_error("ctc_mysql_query: mysql server has gone. error_code:%d, reconnecting.", ret); } - /* + /* SUCCESS: 0 CR_COMMANDS_OUT_OF_SYNC: 2014 - CR_SERVER_GONE_ERROR: 2006 - CR_SERVER_LOST: 2013 + CR_SERVER_GONE_ERROR: 2006 + CR_SERVER_LOST: 2013 CR_UNKNOWN_ERROR: 2000 */ diff --git a/storage/ctc/ctc_proxy_util.h b/storage/ctc/ctc_proxy_util.h index b9a7367..8170392 100644 --- a/storage/ctc/ctc_proxy_util.h +++ b/storage/ctc/ctc_proxy_util.h @@ -12,7 +12,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef __CTC_PROXY_UTIL_H__ @@ -37,7 +37,7 @@ void ctc_close_mysql_conn(MYSQL **curr_conn); |-----------------|---------------|32bits thd_id| | 32bits mysql_inst_id | | |---------------------------------|-------------| - | 64 bits conn_key (first bit is proxy mask) | + | 64 bits conn_key (first bit is proxy mask) | |-----------------------------------------------| because cantiand_id ranges from [0, 1] @@ -69,4 +69,4 @@ int ctc_mysql_query(MYSQL *mysql, const char *query); #pragma GCC visibility pop -#endif // __CTC_PROXY_UTIL_H__ +#endif // __CTC_PROXY_UTIL_H__ \ No newline at end of file diff --git a/storage/ctc/ctc_srv.h b/storage/ctc/ctc_srv.h index 7a4de58..48045ac 100644 --- a/storage/ctc/ctc_srv.h +++ b/storage/ctc/ctc_srv.h @@ -12,7 +12,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef __CTC_SRV_H__ @@ -631,4 +631,4 @@ int ctc_query_shm_usage(uint32_t *shm_usage); } #endif -#endif +#endif \ No newline at end of file diff --git a/storage/ctc/ctc_srv_mq_module.cc b/storage/ctc/ctc_srv_mq_module.cc index 80a0706..19ac683 100644 --- a/storage/ctc/ctc_srv_mq_module.cc +++ b/storage/ctc/ctc_srv_mq_module.cc @@ -12,7 +12,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include "srv_mq_msg.h" @@ -576,4 +576,4 @@ EXTER_ATTACK int ctc_mq_batch_send_message(void *shm_inst, CTC_FUNC_TYPE func_ty batch_free_shm_buf(seg, msg); shm_free(nullptr, msg); return result; -} +} \ No newline at end of file diff --git a/storage/ctc/ctc_srv_mq_module.h b/storage/ctc/ctc_srv_mq_module.h index e644e3b..e4424f5 100644 --- a/storage/ctc/ctc_srv_mq_module.h +++ b/storage/ctc/ctc_srv_mq_module.h @@ -12,7 +12,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef __CTC_SRV_MQ_MODULE__ @@ -38,4 +38,4 @@ int ctc_mq_deal_func(void* shm_inst, enum CTC_FUNC_TYPE func_type, void* request } #endif /* __cpluscplus */ -#endif +#endif \ No newline at end of file diff --git a/storage/ctc/ctc_srv_mq_stub.cc b/storage/ctc/ctc_srv_mq_stub.cc index 4d56307..ad2f03b 100644 --- a/storage/ctc/ctc_srv_mq_stub.cc +++ b/storage/ctc/ctc_srv_mq_stub.cc @@ -12,7 +12,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include "srv_mq_msg.h" @@ -29,7 +29,7 @@ #define OUTLINE_LOB_LOCATOR_SIZE 44 // 行外LOB数据结构体长度 // 双进程模式在 ctc_init 中已经提前获取 inst_id -int ctc_alloc_inst_id(uint32_t *inst_id) { +int ctc_alloc_inst_id(uint32_t *inst_id) { *inst_id = ha_ctc_get_inst_id(); return ctc_mq_register_func(); } @@ -419,7 +419,7 @@ int ctc_delete_all_rows(ctc_handler_t *tch, dml_flag_t flag) { return result; } -int ctc_index_end(ctc_handler_t *tch) { +int ctc_index_end(ctc_handler_t *tch) { void *shm_inst = get_one_shm_inst(tch); index_end_request *req = (index_end_request*)alloc_share_mem(shm_inst, sizeof(index_end_request)); if (req == NULL) { @@ -560,7 +560,7 @@ int ctc_trx_commit(ctc_handler_t *tch, uint64_t *cursors, int32_t csize, bool *i int result = ERR_CONNECTION_FAILED; int ret = ctc_mq_deal_func(shm_inst, CTC_FUNC_TYPE_TRX_COMMIT, req, tch->msg_buf); - *is_ddl_commit = req->is_ddl_commit; + *is_ddl_commit = req->is_ddl_commit; if (ret == CT_SUCCESS) { result = req->result; } @@ -822,7 +822,7 @@ int ctc_get_cbo_stats(ctc_handler_t *tch, ctc_cbo_stats_t *stats, ctc_cbo_stats_ return ERR_ALLOC_MEMORY; } if (!is_part_table) { - req->ctc_cbo_stats_table = + req->ctc_cbo_stats_table = (ctc_cbo_stats_table_t*)alloc_share_mem(shm_inst_4_table, sizeof(ctc_cbo_stats_table_t)); if (req->ctc_cbo_stats_table == NULL) { ctc_log_error("alloc shm mem error, shm_inst(%p), size(%lu)", shm_inst_4_table, sizeof(ctc_cbo_stats_table_t)); @@ -867,7 +867,7 @@ int ctc_get_cbo_stats(ctc_handler_t *tch, ctc_cbo_stats_t *stats, ctc_cbo_stats_ } } } else { - req->ctc_cbo_stats_table = + req->ctc_cbo_stats_table = (ctc_cbo_stats_table_t*)alloc_share_mem(shm_inst_4_table, num_part_fetch * sizeof(ctc_cbo_stats_table_t)); if (req->ctc_cbo_stats_table == NULL) { ctc_log_error("alloc shm mem error, shm_inst(%p), size(%lu)", shm_inst_4_table, num_part_fetch * sizeof(ctc_cbo_stats_table_t)); @@ -1673,4 +1673,4 @@ int ctc_query_shm_usage(uint32_t *shm_usage) } free_share_mem(shm_inst, req); return result; -} +} \ No newline at end of file diff --git a/storage/ctc/ctc_stats.cc b/storage/ctc/ctc_stats.cc index a03a218..20e8a91 100644 --- a/storage/ctc/ctc_stats.cc +++ b/storage/ctc/ctc_stats.cc @@ -12,7 +12,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include "ctc_stats.h" #include "ctc_log.h" @@ -221,6 +221,6 @@ void ctc_stats::print_stats(THD *thd, stat_print_fn *stat_print) { #endif ctc_srv_monitor = &ctc_srv_monitor_str[0]; - stat_print(thd, "ctc", static_cast(strlen("ctc")), STRING_WITH_LEN(""), + stat_print(thd, "ctc", static_cast(strlen("ctc")), STRING_WITH_LEN(""), ctc_srv_monitor, (uint)ctc_srv_monitor_str.length()); -} +} \ No newline at end of file diff --git a/storage/ctc/ctc_stats.h b/storage/ctc/ctc_stats.h index 3e2d168..6f8896f 100644 --- a/storage/ctc/ctc_stats.h +++ b/storage/ctc/ctc_stats.h @@ -12,7 +12,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef __CTC_STATS_H__ #define __CTC_STATS_H__ @@ -49,4 +49,4 @@ class ctc_stats { std::atomic_uint64_t m_use_time[CTC_FUNC_TYPE_NUMBER]; }; -#endif +#endif \ No newline at end of file diff --git a/storage/ctc/ctc_util.cc b/storage/ctc/ctc_util.cc index 6cde6e5..f082185 100644 --- a/storage/ctc/ctc_util.cc +++ b/storage/ctc/ctc_util.cc @@ -12,7 +12,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include "ctc_srv.h" @@ -133,7 +133,7 @@ string sql_without_plaintext_password(ctc_ddl_broadcast_request* broadcast_req) } int16_t ctc_get_column_by_field(Field **field, const char *col_name) { - int16_t col_id; + int16_t col_id; for (col_id = 0; *field != nullptr; field++, col_id++) { if (my_strcasecmp(system_charset_info, (*field)->field_name, col_name) == 0) { return col_id; @@ -449,7 +449,7 @@ int ctc_fill_cond_field(ctc_handler_t m_tch, Item *items, Field **field, ctc_con type = (type == MYSQL_TYPE_FLOAT) ? MYSQL_TYPE_DOUBLE : type; const field_cnvrt_aux_t *mysql_info = get_auxiliary_for_field_convert(mysql_field, type); cond->field_info.field_type = mysql_info->ddl_field_type; - // update field_no if there are gcol in tables + // update field_no if there are gcol in tables uint16_t gcol_cnt = 0; for (uint16_t col_id = 0; col_id < cond->field_info.field_no; col_id++) { Field *pre_field = *(field + col_id); diff --git a/storage/ctc/ctc_util.h b/storage/ctc/ctc_util.h index 7885910..2e3ff1e 100644 --- a/storage/ctc/ctc_util.h +++ b/storage/ctc/ctc_util.h @@ -12,7 +12,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef __CTC_UTIL_H__ @@ -82,4 +82,4 @@ string cnvrt_name_for_sql(string name); #pragma GCC visibility pop -#endif // __CTC_UTIL_H__ +#endif // __CTC_UTIL_H__ \ No newline at end of file diff --git a/storage/ctc/datatype_cnvrt_4_index_search.cc b/storage/ctc/datatype_cnvrt_4_index_search.cc index 97b0565..9fc1492 100644 --- a/storage/ctc/datatype_cnvrt_4_index_search.cc +++ b/storage/ctc/datatype_cnvrt_4_index_search.cc @@ -12,7 +12,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include "sql/field.h" #include "typelib.h" @@ -93,7 +93,7 @@ static void ctc_index_make_up_key_length(int *key, uint8_t **origin_key, uint32_ return; } -int ctc_fill_index_key_info(TABLE *table, const uchar *key, uint key_len, const key_range *end_range, +int ctc_fill_index_key_info(TABLE *table, const uchar *key, uint key_len, const key_range *end_range, index_key_info_t *index_key_info, bool index_skip_scan) { const uchar *my_key = nullptr; const uchar *end_key = key + key_len; @@ -104,7 +104,7 @@ int ctc_fill_index_key_info(TABLE *table, const uchar *key, uint key_len, const index_key_info->key_num = 0; do { if (index_key_info->key_num >= table->key_info[index_key_info->active_index].actual_key_parts) { - ctc_log_error("ctc_fill_index_key_info: colunm id(%d) is bigger than table key parts(%d).", + ctc_log_error("ctc_fill_index_key_info: colunm id(%d) is bigger than table key parts(%d).", index_key_info->key_num, table->key_info[index_key_info->active_index].actual_key_parts); return ERR_GENERIC_INTERNAL_ERROR; } diff --git a/storage/ctc/datatype_cnvrt_4_index_search.h b/storage/ctc/datatype_cnvrt_4_index_search.h index a83cccc..d4588f5 100644 --- a/storage/ctc/datatype_cnvrt_4_index_search.h +++ b/storage/ctc/datatype_cnvrt_4_index_search.h @@ -12,14 +12,14 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include "sql/dd/types/table.h" #include "ctc_srv.h" #include "datatype_cnvrtr.h" #include "decimal_convert.h" -int ctc_fill_index_key_info(TABLE *table, const uchar *key, uint key_len, const key_range *end_range, +int ctc_fill_index_key_info(TABLE *table, const uchar *key, uint key_len, const key_range *end_range, index_key_info_t *index_key_info, bool index_skip_scan); -int ctc_convert_index_datatype(TABLE *table, index_key_info_t *index_key_info, bool has_right_key, dec4_t *data); +int ctc_convert_index_datatype(TABLE *table, index_key_info_t *index_key_info, bool has_right_key, dec4_t *data); \ No newline at end of file diff --git a/storage/ctc/datatype_cnvrtr.cc b/storage/ctc/datatype_cnvrtr.cc index fde35e4..da79e3a 100644 --- a/storage/ctc/datatype_cnvrtr.cc +++ b/storage/ctc/datatype_cnvrtr.cc @@ -12,7 +12,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include #include "field_types.h" @@ -622,8 +622,8 @@ static inline uint32_t get_blob_buffer_size(uint32_t remain_size) blob data is stored in mysql Field_blob struct, which is in one piece of continuous memory we can get the ptr and length from Field_blob get_blob_data and get_length interface, then invoke the Cantian ctc_knl_write_lob interface, write blob data to ctc storage engine - piece by piece. It's important to note that one piece of blob data preferably greater than 4000, - because the ctc storage engine is store blob data inline when blob data length less than 4000, + piece by piece. It's important to note that one piece of blob data preferably greater than 4000, + because the ctc storage engine is store blob data inline when blob data length less than 4000, otherwise the blob data store outline. */ int convert_blob_to_cantian(uchar *cantian_ptr, uint32 &cantian_offset, @@ -918,7 +918,7 @@ int convert_numeric_to_cantian(const field_cnvrt_aux_t *mysql_info, const uchar break; case MYSQL_TYPE_FLOAT: *(double *)cantian_ptr = *(const float *)mysql_ptr; - break; + break; case MYSQL_TYPE_DOUBLE: *(double *)cantian_ptr = *(const double *)mysql_ptr; break; @@ -1047,7 +1047,7 @@ static void decode_mysql_timestamp_type(MYSQL_TIME& ltime, const uchar *mysql_pt For the value of hour in the CantianDB must range from 0 to 23, the ctc just support TIME type range from 00:00:00.000000 to 23:59:59.000000. @param[out] ltime The variable to convert to. - @param mysql_info mysql field type info. + @param mysql_info mysql field type info. @param mysql_ptr The value to convert from, mysql data ptr. @param mysql_field mysql field class. */ @@ -1127,7 +1127,7 @@ bool check_datetime_vaild(const date_detail_t& date_detail) int assign_mysql_date_detail(enum_field_types mysql_field_type, MYSQL_TIME ltime, date_detail_t *date_detail) { - // Assigning Values for date_detail_t + // Assigning Values for date_detail_t if (mysql_field_type == MYSQL_TYPE_TIME) { ltime.year = ltime.year == 0 ? 1900 : ltime.year; ltime.month = ltime.month == 0 ? 1 : ltime.month; @@ -1238,7 +1238,7 @@ static void convert_numeric_to_mysql(const field_cnvrt_aux_t *mysql_info, uchar break; case MYSQL_TYPE_FLOAT: *(float *)mysql_ptr = *(double *)cantian_ptr; - break; + break; case MYSQL_TYPE_DOUBLE: *(double *)mysql_ptr = *(double *)cantian_ptr; break; @@ -1248,7 +1248,7 @@ static void convert_numeric_to_mysql(const field_cnvrt_aux_t *mysql_info, uchar case MYSQL_TYPE_LONGLONG: *(int64_t *)mysql_ptr = *(int64_t *)cantian_ptr; break; - case MYSQL_TYPE_NEWDECIMAL: + case MYSQL_TYPE_NEWDECIMAL: decimal_cantian_to_mysql(mysql_ptr, cantian_ptr, mysql_field); break; default: @@ -1557,7 +1557,7 @@ static void get_map_and_field_len(uint32_t &field_len, const field_cnvrt_aux_t* // But when the type is MYSQL_TYPE_BLOB,the field_len need to calculate by lob_locator_t obj follow. // The value may greater than 65535 only when the data type is LOB_DATA. // Therefore, uint16_t is sufficient here. - // In addition, you do not need to worry that two bytes are insufficient because data larger than 4000 on the + // In addition, you do not need to worry that two bytes are insufficient because data larger than 4000 on the // Cantian side is stored outside the row. if (mysql_info->sql_data_type != LOB_DATA) { uint8_t mysql_data_length_bytes = 0; @@ -2079,7 +2079,7 @@ int get_cantian_record_length(const TABLE *table) int scale = mysql_field->decimals(); Field_new_decimal *f = dynamic_cast(mysql_field); CTC_RET_ERR_IF_NULL(f); - int prec = f->precision; + int prec = f->precision; int ncells = ALIGN_UP(prec - scale, 4) + ALIGN_UP(scale, 4); field_len = ROUND_UP((1 + ncells) * sizeof(uint16_t) + sizeof(uint16_t), 4); } @@ -2098,4 +2098,4 @@ int get_cantian_record_length(const TABLE *table) total_record_length += field_len; } // for field return total_record_length; -} +} \ No newline at end of file diff --git a/storage/ctc/datatype_cnvrtr.h b/storage/ctc/datatype_cnvrtr.h index 2499520..fe0fbe1 100644 --- a/storage/ctc/datatype_cnvrtr.h +++ b/storage/ctc/datatype_cnvrtr.h @@ -12,7 +12,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include "ha_ctc.h" @@ -68,7 +68,7 @@ typedef int64 date_t; longlong bit_cnvt_mysql_cantian(const uchar *ptr, Field *mysql_field); void bit_cnvt_cantian_mysql(const uchar *cantian_ptr, uchar *mysql_ptr, Field *mysql_field); enum enum_sql_data_types -{ +{ UNKNOW_DATA = 0, NUMERIC_DATA, DATETIME_DATA, @@ -168,8 +168,8 @@ typedef enum en_isolation_level { } isolation_level_t; typedef struct st_mysql_to_cantian_field_convert { - enum_field_types mysql_field_type; - uint8_t cantian_map_type; + enum_field_types mysql_field_type; + uint8_t cantian_map_type; enum_sql_data_types sql_data_type; enum_ctc_ddl_field_types ddl_field_type; } field_cnvrt_aux_t; @@ -177,13 +177,13 @@ typedef struct st_mysql_to_cantian_field_convert { typedef struct { Field *field; uchar *cantian_cur_field; - uchar *mysql_cur_field; + uchar *mysql_cur_field; uint16_t field_len; } field_info_t; typedef struct { uint16_t *field_len; - uint16_t *aligned_field_len; + uint16_t *aligned_field_len; uint *cantian_field_offset; uint *mysql_field_offset; } field_offset_and_len_t; @@ -251,4 +251,4 @@ bool check_zero_time_ltime(const MYSQL_TIME ltime); void cnvrt_time_decimal(const uchar *src_ptr, int src_dec, uchar *des_ptr, int des_dec, uint32 length); void cnvrt_datetime_decimal(const uchar *src_ptr, int src_dec, uchar *des_ptr, int des_dec, uint32 length); int decimal_mysql_to_double(const uint8_t *mysql_ptr, uchar *double_ptr, Field *mysql_field); -#endif +#endif \ No newline at end of file diff --git a/storage/ctc/decimal_convert.cc b/storage/ctc/decimal_convert.cc index 4c818ef..6ba11ef 100644 --- a/storage/ctc/decimal_convert.cc +++ b/storage/ctc/decimal_convert.cc @@ -12,7 +12,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include "decimal_convert.h" #include @@ -753,4 +753,4 @@ status_t ct_cm_dec8_to_text(const dec8_t *dec, int32 max_len, text_t *text) { } // output plain text return cm_dec8_to_plain_text(text, dec, max_len, sci_exp, prec); -} +} \ No newline at end of file diff --git a/storage/ctc/decimal_convert.h b/storage/ctc/decimal_convert.h index 8b02d83..e63d8bd 100644 --- a/storage/ctc/decimal_convert.h +++ b/storage/ctc/decimal_convert.h @@ -12,7 +12,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include #include "my_dbug.h" diff --git a/storage/ctc/ha_ctc.cc b/storage/ctc/ha_ctc.cc index c4dfb3d..78c6c98 100644 --- a/storage/ctc/ha_ctc.cc +++ b/storage/ctc/ha_ctc.cc @@ -12,7 +12,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ // @file storage/ctc/ha_ctc.cc @@ -150,15 +150,15 @@ static void ctc_statistics_enabled_update(THD *, SYS_VAR *, void *var_ptr, const /* 创库的表空间datafile自动扩展, 默认开 */ bool ctc_db_datafile_autoextend = true; -static MYSQL_SYSVAR_BOOL(db_datafile_autoextend, ctc_db_datafile_autoextend, PLUGIN_VAR_NOCMDARG, +static MYSQL_SYSVAR_BOOL(db_datafile_autoextend, ctc_db_datafile_autoextend, PLUGIN_VAR_NOCMDARG, "Indicates whether to automatically extend the tablespace data files of the CTC database.", nullptr, nullptr, true); /* 创库的表空间datafile大小, 单位M, 默认32M, 最小1M, 最大8T */ uint32_t ctc_db_datafile_size = 32; -static MYSQL_SYSVAR_UINT(db_datafile_size, ctc_db_datafile_size, PLUGIN_VAR_RQCMDARG, +static MYSQL_SYSVAR_UINT(db_datafile_size, ctc_db_datafile_size, PLUGIN_VAR_RQCMDARG, "Size of the tablespace data file of the CTC database, in MB.", nullptr, nullptr, 32, 1, 8192 * 1024, 0); /* 创库的表空间datafile自动扩展大小, 单位M, 默认128M, 最小1M, 最大8T */ uint32_t ctc_db_datafile_extend_size = 128; -static MYSQL_SYSVAR_UINT(db_datafile_extend_size, ctc_db_datafile_extend_size, PLUGIN_VAR_RQCMDARG, +static MYSQL_SYSVAR_UINT(db_datafile_extend_size, ctc_db_datafile_extend_size, PLUGIN_VAR_RQCMDARG, "Size of the CTC database tablespace data file automatically extended, in MB.", nullptr, nullptr, 128, 1, 8192 * 1024, 0); bool ctc_concurrent_ddl = true; @@ -485,7 +485,7 @@ static void ctc_unreg_instance() { } } -/* +/* * Check if the ALTER TABLE operations need table copy * reference: is_inplace_alter_impossible() * Alter_info::ALTER_TABLE_ALGORITHM_COPY tag set at ha_ctc::create or spcified by ALGORITHMY = COPY @@ -636,7 +636,7 @@ static bool is_supported_func_item(Item *term) { return false; } - // filter unsupport datatype + // filter unsupport datatype if (!is_supported_datatype_cond(item_field->field->real_type())) { return false; } @@ -691,7 +691,7 @@ int create_and_conditions(Item_cond *cond, List pushed_list, pushed_cond = new Item_cond_and(pushed_list); if (pushed_cond == nullptr) { return 1; - } + } } if (remainder_list.elements == 1) { @@ -923,7 +923,7 @@ bool ha_ctc::get_se_private_data(dd::Table *dd_table, bool reset) { static uint n_pages = 4; DBUG_TRACE; - assert(dd_table != nullptr); + assert(dd_table != nullptr); if (reset) { n_tables = 0; @@ -1023,12 +1023,12 @@ static bool ctc_is_supported_system_table(const char *db MY_ATTRIBUTE((unused)), @param charset_coll: MySQL charset-collation code @return precise type, including the charset-collation code. - */ + */ uint ctc_dtype_form_prtype(uint old_prtype, uint charset_coll) { return (old_prtype + (charset_coll << 16)); } -uint get_ctc_type_from_mysql_dd_type(uint *unsigned_flag, uint *binary_type, uint *charset_no, +uint get_ctc_type_from_mysql_dd_type(uint *unsigned_flag, uint *binary_type, uint *charset_no, dd::enum_column_types dd_type, const CHARSET_INFO *field_charset, bool is_unsigned) { @@ -1155,7 +1155,7 @@ compatibility check from column description in Ha_fk_column_type form. @note dict_col_t which is produced by this call is not valid for general purposes. @param[out] col dict_col filled by this function - @param[in] fk_col_type foreign key type information + @param[in] fk_col_type foreign key type information */ static void ctc_fill_fake_column_struct( dict_col *col, const Ha_fk_column_type *fk_col_type) { @@ -1193,7 +1193,7 @@ bool ctc_dtype_is_string_type(uint mtype) { those DATA_BLOB columns this function currently returns FALSE. @param mtype main data type @param prtype precise type - @return true if binary string type + @return true if binary string type */ bool ctc_dtype_is_binary_string_type(uint mtype, uint prtype) { if ((mtype == DATA_FIXBINARY) || (mtype == DATA_BINARY) || @@ -1210,7 +1210,7 @@ bool ctc_dtype_is_binary_string_type(uint mtype, uint prtype) { For those DATA_BLOB columns this function currently returns TRUE. @param mtype main data type @param prtype precise type - @return true if non-binary string type + @return true if non-binary string type */ bool ctc_dtype_is_non_binary_string_type(uint mtype, uint prtype) { if (ctc_dtype_is_string_type(mtype) == true && @@ -1266,7 +1266,7 @@ bool ctc_cmp_cols_are_equal(const dict_col *col1, const dict_col *col2, /** Check if types of child and parent columns in foreign key are compatible. @param[in] check_charsets Indicates whether we need to check that charsets of string columns match. Which is true in most cases. - @return True if types are compatible, False if not. + @return True if types are compatible, False if not. */ static bool ctc_check_fk_column_compat(const Ha_fk_column_type *child_column_type, const Ha_fk_column_type *parent_column_type, bool check_charsets) { @@ -1278,7 +1278,7 @@ static bool ctc_check_fk_column_compat(const Ha_fk_column_type *child_column_typ return (ctc_cmp_cols_are_equal(&dict_child_col, &dict_parent_col, check_charsets)); } -/* +/* Return a session context for current thread. Initialize one if session context is not exists. A session context is one-to-one mapping of thread. @@ -1626,7 +1626,7 @@ static void ctc_register_trx(handlerton *hton, THD *thd) { // 利用SFINAE特性,控制是否调用thd->is_empty() template -static typename std::enable_if::type +static typename std::enable_if::type commit_preprocess(T* thd, ctc_handler_t *tch) { if (is_work_flow() && !thd->is_empty() && !thd->is_attachable_transaction_active()) { (void)invalidate_remote_dd(thd, tch); @@ -1761,7 +1761,7 @@ static int ctc_commit(handlerton *hton, THD *thd, bool commit_trx) { current statement only statement ended @return 0 or deadlock error if the transaction was aborted by another higher priority transaction. - @note: + @note: */ static int ctc_rollback(handlerton *hton, THD *thd, bool rollback_trx) { DBUG_TRACE; @@ -2043,7 +2043,7 @@ static bool ctc_notify_exclusive_mdl(THD *thd, const MDL_key *mdl_key, return false; } /* - we can not check sql length while using prepare statement, + we can not check sql length while using prepare statement, so we need to check the sql length before ddl sql again */ size_t query_len = thd->query().length; @@ -2196,7 +2196,7 @@ static int ctc_release_savepoint(handlerton *hton, THD *thd, void *savepoint) { /** * SQLCOM_SAVEPOINT命令如果发现之前已保存有重名的savepoint,mysql会触发调用ctc_release_savepoint, * 该种场景下就不需要再调用ctc_srv_release_savepoint了,knl_set_savepoint接口内部会去掉重名的savepoint; - * + * * ctc_srv_release_savepoint底层调到knl_release_savepoint,会把当前savepoint及其之后的全都release掉, * 与innodb行为不一致,在某些场景下会引发缺陷 */ @@ -2286,7 +2286,7 @@ void ha_ctc::fill_record_to_rec_buffer() { m_rec_buf->set_out_of_range(is_out_of_range); } -void ha_ctc::reset_rec_buf(bool is_prefetch) { +void ha_ctc::reset_rec_buf(bool is_prefetch) { cur_pos_in_buf = INVALID_MAX_UINT32; if (is_prefetch) { cur_pos_in_buf = 0; @@ -2750,7 +2750,7 @@ void ha_ctc::start_bulk_insert(ha_rows rows) { m_rec_buf_data = (uchar *)my_malloc(PSI_NOT_INSTRUMENTED, MAX_RECORD_BUFFER_SIZE_CTC, MYF(MY_WME)); } - if (rows == 1 || m_is_insert_dup || m_is_replace || m_ignore_dup || table->s->blob_fields > 0 || + if (rows == 1 || m_is_insert_dup || m_is_replace || m_ignore_dup || table->s->blob_fields > 0 || table->next_number_field || m_rec_buf_data == nullptr) { m_rec_buf_4_writing = nullptr; return; @@ -2925,7 +2925,7 @@ int ha_ctc::delete_row(const uchar *buf) { DBUG_TRACE; UNUSED_PARAM(buf); ha_statistic_increment(&System_status_var::ha_delete_count); - THD *thd = ha_thd(); + THD *thd = ha_thd(); m_is_replace = (thd->lex->sql_command == SQLCOM_REPLACE || thd->lex->sql_command == SQLCOM_REPLACE_SELECT) ? true : m_is_replace; // m_is_insert_dup for on duplicate key update in partiton table when new row is in different partition @@ -3148,7 +3148,7 @@ int ha_ctc::rnd_init(bool) { enum_sql_command sql_command = (enum_sql_command)thd_sql_command(ha_thd()); if (sql_command == SQLCOM_DELETE) { action = EXP_CURSOR_ACTION_DELETE; - } else if (sql_command != SQLCOM_ALTER_TABLE){ // action can't be set to update when alter operation using copy algorithm + } else if (sql_command != SQLCOM_ALTER_TABLE){ // action can't be set to update when alter operation using copy algorithm action = EXP_CURSOR_ACTION_UPDATE; } } @@ -3892,7 +3892,7 @@ enum_alter_inplace_result ha_ctc::check_if_supported_inplace_alter( DBUG_TRACE; THD *thd = ha_thd(); - // remote node execute ALTER statement using default way + // remote node execute ALTER statement using default way if (engine_ddl_passthru(thd)) { return HA_ALTER_INPLACE_EXCLUSIVE_LOCK; } @@ -3982,7 +3982,7 @@ void ha_ctc::set_ctc_range_key(ctc_key *ctc_key, key_range *mysql_range_key, boo ctc_key->key = nullptr; ctc_key->cmp_type = CMP_TYPE_NULL; ctc_key->len = 0; - ctc_key->col_map = 0; + ctc_key->col_map = 0; return; } @@ -4188,7 +4188,7 @@ THR_LOCK_DATA **ha_ctc::store_lock(THD *, THR_LOCK_DATA **to, DBUG_TRACE; // SELECT FOR SHARE / SELECT FOR UPDATE use exclusive lock - if ((lock_type == TL_READ_WITH_SHARED_LOCKS && ctc_get_cluster_role() == (int32_t)dis_cluster_role::PRIMARY) || + if ((lock_type == TL_READ_WITH_SHARED_LOCKS && ctc_get_cluster_role() == (int32_t)dis_cluster_role::PRIMARY) || (lock_type >= TL_WRITE_ALLOW_WRITE && lock_type <= TL_WRITE_ONLY)) { m_select_lock = lock_mode::EXCLUSIVE_LOCK; } else { @@ -4224,7 +4224,7 @@ int ha_ctc::external_lock(THD *thd, int lock_type) { if (IS_METADATA_NORMALIZATION() && ctc_check_if_log_table(table_share->db.str, table_share->table_name.str)) { - is_log_table = true; + is_log_table = true; if (!thd->in_sub_stmt) { thd_sess_ctx_s *sess_ctx = get_or_init_sess_ctx(ctc_hton, thd); sess_ctx->sql_stat_start = 1; @@ -4464,7 +4464,7 @@ void ctc_set_mysql_read_only() { ctc_log_system("[Disaster Recovery] set super_read_only = true."); } -void ctc_reset_mysql_read_only() { +void ctc_reset_mysql_read_only() { ctc_log_system("[Disaster Recovecy] starting or initializing"); super_read_only = false; read_only = false; @@ -5163,7 +5163,7 @@ EXTER_ATTACK int ha_ctc::create(const char *name, TABLE *form, HA_CREATE_INFO *c char *func_name = strtok_r(NULL, ",", &err_msg); if (func_name) { // func_name非空的情况对应default function - my_error(ER_DEFAULT_VAL_GENERATED_NAMED_FUNCTION_IS_NOT_ALLOWED, MYF(0), + my_error(ER_DEFAULT_VAL_GENERATED_NAMED_FUNCTION_IS_NOT_ALLOWED, MYF(0), field_name, func_name); return CT_ERROR; } @@ -5427,12 +5427,12 @@ int ha_ctc::initialize_cbo_stats() return ERR_ALLOC_MEMORY; } *m_share->cbo_stats = {0, 0, 0, 0, 0, nullptr, 0, nullptr, nullptr}; - m_share->cbo_stats->ctc_cbo_stats_table = + m_share->cbo_stats->ctc_cbo_stats_table = (ctc_cbo_stats_table_t*)my_malloc(PSI_NOT_INSTRUMENTED, sizeof(ctc_cbo_stats_table_t), MYF(MY_WME)); if (m_share->cbo_stats->ctc_cbo_stats_table == nullptr) { ctc_log_error("alloc mem failed, m_share->cbo_stats->ctc_cbo_stats_table(%lu)", sizeof(ctc_cbo_stats_table_t)); return ERR_ALLOC_MEMORY; - } + } m_share->cbo_stats->ctc_cbo_stats_table->columns = (ctc_cbo_stats_column_t*)my_malloc(PSI_NOT_INSTRUMENTED, table->s->fields * sizeof(ctc_cbo_stats_column_t), MYF(MY_WME)); if (m_share->cbo_stats->ctc_cbo_stats_table->columns == nullptr) { @@ -5848,4 +5848,4 @@ static int ctc_push_to_engine(THD *thd, AccessPath *root_path, JOIN *) { const handlerton *ha_ctc::hton_supporting_engine_pushdown() { return ctc_hton; } -#endif +#endif \ No newline at end of file diff --git a/storage/ctc/ha_ctc.h b/storage/ctc/ha_ctc.h index 35f889d..d5130c9 100644 --- a/storage/ctc/ha_ctc.h +++ b/storage/ctc/ha_ctc.h @@ -12,7 +12,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ /* class for the the ctc handler */ @@ -74,7 +74,7 @@ using namespace std; /* The 'MAIN TYPE' of a column */ #define DATA_MISSING 0 /* missing column */ -#define DATA_VARCHAR 1 +#define DATA_VARCHAR 1 #define DATA_CHAR 2 /* fixed length character of the latin1_swedish_ci charset-collation */ #define DATA_FIXBINARY 3 /* binary string of fixed length */ #define DATA_BINARY 4 /* binary string */ diff --git a/storage/ctc/ha_ctc_ddl.cc b/storage/ctc/ha_ctc_ddl.cc index bc0f4be..50e2a43 100644 --- a/storage/ctc/ha_ctc_ddl.cc +++ b/storage/ctc/ha_ctc_ddl.cc @@ -12,7 +12,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include "storage/ctc/ha_ctc.h" #include "storage/ctc/ha_ctc_ddl.h" @@ -77,7 +77,7 @@ extern handlerton *ctc_hton; size_t ctc_ddl_stack_mem::ctc_ddl_req_msg_mem_max_size = 0; size_t ctc_ddl_stack_mem::ctc_ddl_req_msg_mem_use_heap_cnt = 0; -int fill_delete_table_req(const char *full_path_name, const dd::Table *table_def, +int fill_delete_table_req(const char *full_path_name, const dd::Table *table_def, THD *thd, ddl_ctrl_t *ddl_ctrl, ctc_ddl_stack_mem *stack_mem) { TcDb__CtcDDLDropTableDef req; @@ -415,7 +415,7 @@ static bool ctc_fill_column_precision_and_scale(TcDb__CtcDDLColumnDef *column, F } break; } - case MYSQL_TYPE_DECIMAL: + case MYSQL_TYPE_DECIMAL: case MYSQL_TYPE_NEWDECIMAL: { Field_new_decimal *f = dynamic_cast(field); column->datatype->precision = f->precision; @@ -428,7 +428,7 @@ static bool ctc_fill_column_precision_and_scale(TcDb__CtcDDLColumnDef *column, F break; } case MYSQL_TYPE_TIME2: - case MYSQL_TYPE_DATETIME2: + case MYSQL_TYPE_DATETIME2: case MYSQL_TYPE_TIMESTAMP2: { column->datatype->precision = field->decimals(); break; @@ -513,7 +513,7 @@ static int ctc_prepare_enum_field_impl(THD *thd, Create_field *sql_field, String return CTC_ENUM_DEFAULT_INVALID; } -static bool ctc_prepare_set_field_impl(THD *thd, Create_field *sql_field, ulonglong *set_bitmap, +static bool ctc_prepare_set_field_impl(THD *thd, Create_field *sql_field, ulonglong *set_bitmap, String *def, TcDb__CtcDDLColumnDef *column) { DBUG_TRACE; assert(sql_field->sql_type == MYSQL_TYPE_SET); @@ -555,15 +555,15 @@ static bool ctc_prepare_set_field_impl(THD *thd, Create_field *sql_field, ulongl const char *not_used; uint not_used2; bool not_found = false; - // SQL "NULL" maps to NULL + // SQL "NULL" maps to NULL if (def == nullptr) { if ((sql_field->flags & NOT_NULL_FLAG) != 0) { my_error(ER_INVALID_DEFAULT, MYF(0), sql_field->field_name); return false; } else { - // else, NULL is an allowed value + // else, NULL is an allowed value *set_bitmap = find_set(interval, nullptr, 0, sql_field->charset, ¬_used, ¬_used2, ¬_found); - } + } } else { // default not NULL */ *set_bitmap = find_set(interval, def->ptr(), def->length(), sql_field->charset, ¬_used, ¬_used2, ¬_found); @@ -661,7 +661,7 @@ static bool ctc_get_datetime_default_value( TcDb__CtcDDLColumnDef *column, Field *field, const Create_field *fld, const dd::Column *col_obj, char **mem_start, char *mem_end, ctc_column_option_set_bit *option_set, bool is_expr_value) { if (field->has_insert_default_datetime_value_expression()) { - // current_timestamp (or with ON UPDATE CURRENT_TIMESTAMP) + // current_timestamp (or with ON UPDATE CURRENT_TIMESTAMP) option_set->is_default_func = 1; option_set->is_curr_timestamp = 1; column->default_text = const_cast(col_obj->default_value_utf8().data()); @@ -710,7 +710,7 @@ static bool ctc_get_datetime_default_value( ctc_log_error("alloc mem for datetime default text failed."); return false; } - strncpy(column->default_text, tmp_zero_date, len + 1); + strncpy(column->default_text, tmp_zero_date, len + 1); return true; } @@ -775,7 +775,7 @@ static int ctc_prepare_enum_field(THD *thd, Field *field, const Create_field *fl def = sql_field->m_default_val_expr->expr_item->val_str(&default_str); } if (fld == nullptr) { - // 修改ENUM default带charset + // 修改ENUM default带charset // 或设置了全局charset找不到enum_index // 判断当前charset与field charset是否一致 if(field_cs == nullptr || strcmp(def->charset()->csname, field_cs->csname) != 0) { @@ -852,7 +852,7 @@ static bool ctc_prepare_set_field(THD *thd, Field *field, const Create_field *fl } static bool ctc_get_set_default_value( - THD *thd, TcDb__CtcDDLColumnDef *column, Field *field, const Create_field *fld, char **mem_start, + THD *thd, TcDb__CtcDDLColumnDef *column, Field *field, const Create_field *fld, char **mem_start, char *mem_end, const CHARSET_INFO *field_cs) { ulonglong set_bitmap; bool is_get_set_bitmap = false; @@ -984,18 +984,18 @@ static bool ctc_check_expression_default_value(TcDb__CtcDDLColumnDef *column, Fi fld->m_default_val_expr->expr_item; //default expression if (!constant_default->const_for_execution() && constant_default->type() != Item::FUNC_ITEM) { - my_printf_error(ER_DISALLOWED_OPERATION, "%s", MYF(0), + my_printf_error(ER_DISALLOWED_OPERATION, "%s", MYF(0), "Current storage engine only support default expression without variable parameters"); - return false; + return false; } else if (constant_default->type() == Item::FUNC_ITEM) { // default function Item_func *item_func = dynamic_cast(constant_default); column->default_func_name = const_cast(item_func->func_name()); for (uint i = 0; i < item_func->arg_count; i++) { if (item_func->get_arg(i)->type() == Item::FIELD_ITEM) { - my_printf_error(ER_DISALLOWED_OPERATION, "%s", MYF(0), + my_printf_error(ER_DISALLOWED_OPERATION, "%s", MYF(0), "Current storage engine only support default function without variable parameters"); - return false; + return false; } } } else { @@ -1084,7 +1084,7 @@ static void ctc_fill_column_option_set(TcDb__CtcDDLColumnDef *column, Field *fie option_set->nullable = false; } option_set->unique = field->is_flag_set(UNIQUE_KEY_FLAG); - column->cons_name = option_set->primary ? const_cast("PRIMARY") : + column->cons_name = option_set->primary ? const_cast("PRIMARY") : (option_set->unique ? column->name : nullptr); option_set->is_serial = field->is_flag_set(AUTO_INCREMENT_FLAG); option_set->is_comment = field->comment.length > 0; @@ -1125,7 +1125,7 @@ static bool ctc_ddl_fill_column_by_field( column->name = const_cast(fld->change); if (strcmp(fld->change, field->field_name) != 0) { column->new_name = const_cast(field->field_name); - } + } } else { column->name = const_cast(field->field_name); } @@ -1136,7 +1136,7 @@ static bool ctc_ddl_fill_column_by_field( ctc_fill_column_option_set(column, field, form, &option_set); if (ctc_is_with_default_value(field, col_obj)) { - CTC_RETURN_IF_ERROR(ctc_ddl_fill_column_default_value(thd, column, field, fld, col_obj, + CTC_RETURN_IF_ERROR(ctc_ddl_fill_column_default_value(thd, column, field, fld, col_obj, &option_set, mem_start, mem_end, field_cs), false); } else { option_set.is_default = 0; @@ -1230,14 +1230,14 @@ static uint32_t ctc_fill_func_key_part(TABLE *form, THD *thd, TcDb__CtcDDLTableK Item_func *func_expr_item = dynamic_cast(gcol_info->expr_item); if (func_expr_item == nullptr) { my_printf_error(ER_DISALLOWED_OPERATION, "%s", MYF(0), - "[CTC_CREATE_TABLE]: CTC do not support this functional index."); + "[CTC_CREATE_TABLE]: CTC do not support this functional index."); return CT_ERROR; } uint32_t arg_count = func_expr_item->arg_count; if (arg_count == 0) { my_printf_error(ER_DISALLOWED_OPERATION, "%s", MYF(0), - "[CTC_CREATE_TABLE]: There is no functional index."); + "[CTC_CREATE_TABLE]: There is no functional index."); return CT_ERROR; } @@ -1325,7 +1325,7 @@ static bool ctc_ddl_create_table_fill_add_key(TcDb__CtcDDLCreateTableDef *req, T if (fld->is_virtual_gcol()) { my_printf_error(ER_DISALLOWED_OPERATION, "%s", MYF(0), "Cantian does not support index on virtual generated column."); - return false; + return false; } uint prefix_len = get_prefix_index_len(fld, key_part->length); @@ -1379,7 +1379,7 @@ static bool ctc_ddl_create_table_fill_add_key(TcDb__CtcDDLCreateTableDef *req, T if (fld->is_virtual_gcol()) { my_printf_error(ER_DISALLOWED_OPERATION, "%s", MYF(0), "Cantian does not support index on virtual generated column."); - return false; + return false; } uint prefix_len = get_prefix_index_len(fld, key_part->length()); @@ -1406,7 +1406,7 @@ static bool ctc_ddl_create_table_fill_add_key(TcDb__CtcDDLCreateTableDef *req, T static int ctc_ddl_fill_partition_table_info(const dd::Partition *pt, char **mem_start, char *mem_end, TcDb__CtcDDLPartitionDef *part_def, uint32_t part_id) { - TcDb__CtcDDLPartitionTableDef *part_table = part_def->part_table_list[part_id]; + TcDb__CtcDDLPartitionTableDef *part_table = part_def->part_table_list[part_id]; part_table->name = const_cast(pt->name().data()); part_table->n_subpart_table_list = pt->subpartitions().size(); if (part_table->n_subpart_table_list > 0) { @@ -1423,7 +1423,7 @@ static int ctc_ddl_fill_partition_table_info(const dd::Partition *pt, char **mem return HA_ERR_OUT_OF_MEM; } tc_db__ctc_ddlpartition_table_def__init(subpart_table_list[i]); - TcDb__CtcDDLPartitionTableDef *sub_part_table = part_table->subpart_table_list[i]; + TcDb__CtcDDLPartitionTableDef *sub_part_table = part_table->subpart_table_list[i]; sub_part_table->name = const_cast(sub_part_obj->name().data()); i++; } @@ -1652,7 +1652,7 @@ static int ctc_ddl_init_create_table_def(TcDb__CtcDDLCreateTableDef *req, if (table_def->partitions().size() > 0) { uint subpart_num_per_part = table_def->leaf_partitions().size() / table_def->partitions().size(); if (subpart_num_per_part > MAX_SUBPART_NUM) { - my_printf_error(ER_TOO_MANY_PARTITIONS_ERROR, + my_printf_error(ER_TOO_MANY_PARTITIONS_ERROR, "The number of subpartitions of one parent partition exceeds the maximum %d.", MYF(0), MAX_SUBPART_NUM); return -1; } @@ -1770,7 +1770,7 @@ static int fill_create_table_req_columns_info(HA_CREATE_INFO *create_info, dd::T continue; } my_printf_error(ER_DISALLOWED_OPERATION, "%s", MYF(0), "Cantian does not support stored generated column."); - return HA_ERR_WRONG_COMMAND; + return HA_ERR_WRONG_COMMAND; } TcDb__CtcDDLColumnDef *column = req->columns[ctc_col_idx]; @@ -1786,7 +1786,7 @@ static int fill_create_table_req_columns_info(HA_CREATE_INFO *create_info, dd::T /*prevent only virtual columns*/ if (req->n_columns == 0) { my_printf_error(ER_DISALLOWED_OPERATION, "%s", MYF(0), "Cantian does not support all columns are generated."); - return HA_ERR_WRONG_COMMAND; + return HA_ERR_WRONG_COMMAND; } return 0; @@ -2122,7 +2122,7 @@ static int init_alter_index_list_4alter_table(TcDb__CtcDDLAlterTableDef *req, ch return 0; } -static int init_ctc_ddl_alter_table_def(TcDb__CtcDDLAlterTableDef *req, Alter_inplace_info *ha_alter_info, +static int init_ctc_ddl_alter_table_def(TcDb__CtcDDLAlterTableDef *req, Alter_inplace_info *ha_alter_info, THD *thd, TABLE *altered_table, char **mem_start, char *mem_end, size_t *rename_cols) { tc_db__ctc_ddlalter_table_def__init(req); uint32_t create_fields = (uint32_t)ha_alter_info->alter_info->create_list.size(); @@ -2133,7 +2133,7 @@ static int init_ctc_ddl_alter_table_def(TcDb__CtcDDLAlterTableDef *req, Alter_in my_error(ER_TOO_MANY_FIELDS, MYF(0)); return HA_ERR_TOO_MANY_FIELDS; } - req->n_drop_list = (uint32_t)ha_alter_info->alter_info->drop_list.size(); + req->n_drop_list = (uint32_t)ha_alter_info->alter_info->drop_list.size(); for (size_t i = 0; i < ha_alter_info->alter_info->alter_list.size(); i++) { const Alter_column *alter_column = ha_alter_info->alter_info->alter_list.at((size_t)i); if (alter_column->change_type() == Alter_column::Type::RENAME_COLUMN) { @@ -2172,7 +2172,7 @@ static int init_ctc_ddl_alter_table_def(TcDb__CtcDDLAlterTableDef *req, Alter_in tc_db__ctc_ddlalter_table_porp__init(req->table_def); // 添加索引 - if ((ha_alter_info->handler_flags & Alter_inplace_info::ADD_STORED_BASE_COLUMN) && + if ((ha_alter_info->handler_flags & Alter_inplace_info::ADD_STORED_BASE_COLUMN) && thd->lex->sql_command == SQLCOM_ALTER_TABLE) { req->n_add_key_list = 0; } @@ -2378,7 +2378,7 @@ static int fill_ctc_alter_create_list(THD *thd, TABLE *altered_table, Alter_inpl } const CHARSET_INFO *field_cs = get_sql_field_charset(fld, ha_alter_info->create_info); CTC_RETURN_IF_ERROR(ctc_ddl_fill_column_by_field(thd, req_create_column, altered_table->s->field[mysql_col_idx], - ((const dd::Table *)new_table_def), altered_table, fld, alter_mode, mem_start, mem_end, field_cs), + ((const dd::Table *)new_table_def), altered_table, fld, alter_mode, mem_start, mem_end, field_cs), CT_ERROR); ctc_col_idx++; mysql_col_idx++; @@ -2387,7 +2387,7 @@ static int fill_ctc_alter_create_list(THD *thd, TABLE *altered_table, Alter_inpl //prevent only virtual columns if (req->n_create_list == 0) { my_printf_error(ER_DISALLOWED_OPERATION, "%s", MYF(0), "Cantian does not support all columns are generated."); - return HA_ERR_WRONG_COMMAND; + return HA_ERR_WRONG_COMMAND; } return CT_SUCCESS; diff --git a/storage/ctc/ha_ctc_ddl.h b/storage/ctc/ha_ctc_ddl.h index 910279f..757fbe0 100644 --- a/storage/ctc/ha_ctc_ddl.h +++ b/storage/ctc/ha_ctc_ddl.h @@ -12,7 +12,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef __HA_CTC_DDL_H__ #define __HA_CTC_DDL_H__ @@ -21,7 +21,7 @@ #include #include #include "storage/ctc/ha_ctcpart.h" -#define UN_SUPPORT_DDL "ddl statement" +#define UN_SUPPORT_DDL "ddl statement" /** Max table name length as defined in CT_MAX_NAME_LEN */ #define CTC_MAX_TABLE_NAME_LEN 64 #define CTC_MAX_CONS_NAME_LEN CTC_MAX_TABLE_NAME_LEN @@ -217,7 +217,7 @@ public: void *buf_obj; }; -int fill_delete_table_req(const char *full_path_name, const dd::Table *table_def, +int fill_delete_table_req(const char *full_path_name, const dd::Table *table_def, THD *thd, ddl_ctrl_t *ddl_ctrl, ctc_ddl_stack_mem *stack_mem); int ctcbase_alter_tablespace(handlerton *hton, THD *thd, st_alter_tablespace *alter_info, @@ -232,9 +232,9 @@ int fill_alter_table_req(TABLE *altered_table, Alter_inplace_info *ha_alter_info dd::Table *new_table_def, THD *thd, ddl_ctrl_t *ddl_ctrl, ctc_ddl_stack_mem *stack_mem); int fill_rename_table_req(const char *from, const char *to, const dd::Table *from_table_def, dd::Table *to_table_def, THD *thd, ddl_ctrl_t *ddl_ctrl, ctc_ddl_stack_mem *stack_mem); -int fill_truncate_partition_req(const char *full_name, partition_info *part_info, +int fill_truncate_partition_req(const char *full_name, partition_info *part_info, dd::Table *dd_table, THD *thd, ddl_ctrl_t *ddl_ctrl, ctc_ddl_stack_mem *stack_mem); int fill_rebuild_index_req(TABLE *table, THD *thd, ddl_ctrl_t *ddl_ctrl, ctc_ddl_stack_mem *stack_mem); bool get_ctc_key_type(const KEY *key_info, int32_t *ret_type); bool get_ctc_key_algorithm(ha_key_alg algorithm, int32_t *ret_algorithm); -#endif +#endif \ No newline at end of file diff --git a/storage/ctc/ha_ctcpart.cc b/storage/ctc/ha_ctcpart.cc index 3b9aa3a..aef0003 100644 --- a/storage/ctc/ha_ctcpart.cc +++ b/storage/ctc/ha_ctcpart.cc @@ -12,7 +12,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ // @file storage/ctc/ha_ctcpart.cc @@ -90,7 +90,7 @@ static bool get_used_partitions(partition_info *part_info, my_free(*part_ids); return false; } - uint32_t part_id = part_info->get_first_used_partition(); + uint32_t part_id = part_info->get_first_used_partition(); if(part_id == MY_BIT_NONE){ return true; } @@ -193,7 +193,7 @@ void ha_ctcpart::set_partition(uint part_id) { void ha_ctcpart::reset_partition(uint part_id) { m_tch.part_id = INVALID_PART_ID; m_tch.subpart_id = INVALID_PART_ID; - m_last_part = part_id; + m_last_part = part_id; } void ha_ctcpart::get_auto_increment(ulonglong, ulonglong, ulonglong, @@ -350,7 +350,7 @@ int ha_ctcpart::rnd_init_in_part(uint part_id, bool scan) { return ret; } -/** +/** Get next row during scan of a specific partition. @param[in] part_id Partition to read from. @param[out] buf Next row. @@ -567,7 +567,7 @@ int ha_ctcpart::index_next_in_part(uint part_id, uchar *record) { return ret; } -/** +/** Return next same record in index from a partition. This routine is used to read the next record, but only if the key is the same as supplied in the call. @@ -637,7 +637,7 @@ int ha_ctcpart::index_read_last_map_in_part(uint part_id, uchar *record, const u return ret; } -/** +/** Start index scan and return first record from a partition. This routine starts an index scan using a start key. The calling function will check the end key on its own. @@ -711,7 +711,7 @@ bool ha_ctcpart::equal_range_on_part_field(const key_range *start_key, const key return true; } -/** +/** Start index scan and return first record from a partition. This routine starts an index scan using a start and end key. @param[in] part_id Partition to read from. @@ -906,7 +906,7 @@ extern uint32_t ctc_instance_id; int ha_ctcpart::truncate_partition_low(dd::Table *dd_table) { THD *thd = ha_thd(); if (engine_ddl_passthru(thd)) { - return 0; + return 0; } ctc_ddl_stack_mem stack_mem(0); @@ -1004,7 +1004,7 @@ int ha_ctcpart::initialize_cbo_stats() { if (m_part_share->cbo_stats != nullptr) { return CT_SUCCESS; } - uint32_t part_num = m_is_sub_partitioned ? table->part_info->num_parts * table->part_info->num_subparts : + uint32_t part_num = m_is_sub_partitioned ? table->part_info->num_parts * table->part_info->num_subparts : table->part_info->num_parts; m_part_share->cbo_stats = (ctc_cbo_stats_t*)my_malloc(PSI_NOT_INSTRUMENTED, sizeof(ctc_cbo_stats_t), MYF(MY_WME)); @@ -1016,7 +1016,7 @@ int ha_ctcpart::initialize_cbo_stats() { m_part_share->cbo_stats->part_cnt = part_num; - m_part_share->cbo_stats->ctc_cbo_stats_table = + m_part_share->cbo_stats->ctc_cbo_stats_table = (ctc_cbo_stats_table_t*)my_malloc(PSI_NOT_INSTRUMENTED, part_num * sizeof(ctc_cbo_stats_table_t), MYF(MY_WME)); if (m_part_share->cbo_stats->ctc_cbo_stats_table == nullptr) { ctc_log_error("alloc mem failed, m_part_share->cbo_stats->ctc_cbo_stats_table size(%lu)", part_num * sizeof(ctc_cbo_stats_table_t)); @@ -1108,7 +1108,7 @@ void ha_ctcpart::free_cbo_stats() { if (m_part_share->cbo_stats == nullptr) { return; } - uint32_t part_num = m_is_sub_partitioned ? table->part_info->num_parts * table->part_info->num_subparts : + uint32_t part_num = m_is_sub_partitioned ? table->part_info->num_parts * table->part_info->num_subparts : table->part_info->num_parts; bool is_str_first_addr = true; @@ -1177,18 +1177,17 @@ bool ha_ctcpart::check_unsupported_indexdir(dd::Table *table_def) { if (!index_file_name.empty()) { my_error(ER_ILLEGAL_HA, MYF(0), table_share != nullptr ? table_share->table_name.str : " "); return true; - } + } } return false; } EXTER_ATTACK int ha_ctcpart::create(const char *name, TABLE *form, HA_CREATE_INFO *create_info, dd::Table *table_def) { - THD *thd = ha_thd(); + THD *thd = ha_thd(); if (table_def != nullptr && check_unsupported_indexdir(table_def)) { ctc_log_system("Unsupported operation. sql = %s", thd->query().str); return HA_ERR_WRONG_COMMAND; - } - return ha_ctc::create(name, form, create_info, table_def); + } + return ha_ctc::create(name, form, create_info, table_def); } - diff --git a/storage/ctc/ha_ctcpart.h b/storage/ctc/ha_ctcpart.h index 79caa88..a42c4f9 100644 --- a/storage/ctc/ha_ctcpart.h +++ b/storage/ctc/ha_ctcpart.h @@ -12,7 +12,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ /* class for the the ctc part table handler */ @@ -237,8 +237,8 @@ class ha_ctcpart : public ha_ctc, return (Partition_helper::ph_rnd_next(record)); } - int rnd_end() override { - return (Partition_helper::ph_rnd_end()); + int rnd_end() override { + return (Partition_helper::ph_rnd_end()); } void position(const uchar *record) override { @@ -274,7 +274,7 @@ class ha_ctcpart : public ha_ctc, int index_end() override; - int index_read(uchar *buf, const uchar *key, uint key_len, + int index_read(uchar *buf, const uchar *key, uint key_len, ha_rkey_function find_flag) override; int index_next(uchar *record) override { @@ -371,7 +371,7 @@ class ha_ctcpart : public ha_ctc, int optimize(THD *thd, HA_CHECK_OPT *check_opt) override; int create(const char *name, TABLE *form, HA_CREATE_INFO *create_info, - dd::Table *table_def) override; + dd::Table *table_def) override; /* Get partition row type @param[in] partition_table partition table @@ -442,4 +442,4 @@ static inline void cursor_clear_bit(int *cursor_set, uint bit) { (cursor_set)[bit / 8] &= ~(1 << (bit & 7)); } -#endif /* ha_ctcpart_h */ +#endif /* ha_ctcpart_h */ \ No newline at end of file diff --git a/storage/ctc/message_queue/dsw_list.h b/storage/ctc/message_queue/dsw_list.h index 1f3f7dc..483022b 100644 --- a/storage/ctc/message_queue/dsw_list.h +++ b/storage/ctc/message_queue/dsw_list.h @@ -12,7 +12,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef __dsw_list_pub_h__ diff --git a/storage/ctc/message_queue/dsw_message.h b/storage/ctc/message_queue/dsw_message.h index 636ea1f..3a64133 100644 --- a/storage/ctc/message_queue/dsw_message.h +++ b/storage/ctc/message_queue/dsw_message.h @@ -12,7 +12,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef __dsw_message_pub_h__ @@ -128,4 +128,4 @@ typedef struct { #ifdef __cplusplus } #endif /* __cpluscplus */ -#endif // __dsw_message_pub_h__ +#endif // __dsw_message_pub_h__ \ No newline at end of file diff --git a/storage/ctc/message_queue/dsw_shm.h b/storage/ctc/message_queue/dsw_shm.h index 33ea257..1f3c00a 100644 --- a/storage/ctc/message_queue/dsw_shm.h +++ b/storage/ctc/message_queue/dsw_shm.h @@ -12,7 +12,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef __dsw_shm_pub_h__ @@ -286,4 +286,4 @@ void shm_tpool_destroy(); #ifdef __cplusplus } #endif /* __cpluscplus */ -#endif // __dsw_shm_pub_h__ +#endif // __dsw_shm_pub_h__ \ No newline at end of file diff --git a/storage/ctc/message_queue/dsw_typedef.h b/storage/ctc/message_queue/dsw_typedef.h index 61a924d..6d3962a 100644 --- a/storage/ctc/message_queue/dsw_typedef.h +++ b/storage/ctc/message_queue/dsw_typedef.h @@ -12,7 +12,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef __dsw_typedef_pub_h__ @@ -91,4 +91,4 @@ extern void __dsw_assert_inner(dsw_u64 exp); } #endif /* __cpluscplus */ -#endif // __dsw_typedef_pub_h__ +#endif // __dsw_typedef_pub_h__ \ No newline at end of file diff --git a/storage/ctc/mysql_cantian_plugin.cc b/storage/ctc/mysql_cantian_plugin.cc index 757469f..2eb2b15 100644 --- a/storage/ctc/mysql_cantian_plugin.cc +++ b/storage/ctc/mysql_cantian_plugin.cc @@ -12,7 +12,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include #include @@ -21,9 +21,9 @@ #include #include #include -#include -#include -#include +#include +#include +#include #include #include "m_string.h" // strlen @@ -161,4 +161,4 @@ int daemon_cantian_plugin_deinit() { } int (*ctc_init)() = daemon_cantian_plugin_init; -int (*ctc_deinit)() = daemon_cantian_plugin_deinit; +int (*ctc_deinit)() = daemon_cantian_plugin_deinit; \ No newline at end of file diff --git a/storage/ctc/protobuf/tc_db.pb-c.h b/storage/ctc/protobuf/tc_db.pb-c.h index 9a445a0..f4fbab2 100644 --- a/storage/ctc/protobuf/tc_db.pb-c.h +++ b/storage/ctc/protobuf/tc_db.pb-c.h @@ -134,7 +134,7 @@ struct TcDb__CtcDDLTableKeyPart */ char *name; /* - * Length of key part in bytes, excluding NULL flag and length bytes + * Length of key part in bytes, excluding NULL flag and length bytes */ uint32_t length; int32_t datatype; @@ -1150,4 +1150,4 @@ extern const ProtobufCMessageDescriptor tc_db__ctc_ddlalter_space_def__descripto PROTOBUF_C__END_DECLS -#endif /* PROTOBUF_C_tc_5fdb_2eproto__INCLUDED */ +#endif /* PROTOBUF_C_tc_5fdb_2eproto__INCLUDED */ \ No newline at end of file diff --git a/storage/ctc/protobuf/tc_db.proto b/storage/ctc/protobuf/tc_db.proto index 62e6da8..5a93777 100644 --- a/storage/ctc/protobuf/tc_db.proto +++ b/storage/ctc/protobuf/tc_db.proto @@ -16,7 +16,7 @@ message CtcDDLColumnDataTypeDef { message CtcDDLColumnDef { string name = 1; CtcDDLColumnDataTypeDef datatype = 2; - uint32 is_option_set = 4; + uint32 is_option_set = 4; uint32 col_id = 5; string cons_name = 6; string ref_user = 10; @@ -254,7 +254,7 @@ message CtcDDLAlterSpaceDef { uint32 action = 1; string name = 2; // name of the space string new_name = 3; // name of the new space - uint64 auto_extend_size = 4; + uint64 auto_extend_size = 4; string db_name = 5; string sql_str = 6; -} +} \ No newline at end of file diff --git a/storage/ctc/srv_mq_msg.h b/storage/ctc/srv_mq_msg.h index 1338647..d3891e4 100644 --- a/storage/ctc/srv_mq_msg.h +++ b/storage/ctc/srv_mq_msg.h @@ -12,7 +12,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef SRV_MQ_MSG__ @@ -454,4 +454,4 @@ void free_share_mem(void* shm_inst, void* shm_mem); } #endif /* __cpluscplus */ -#endif +#endif \ No newline at end of file -- Gitee