From 3731c6034d3a618e549991581a21f2901478d285 Mon Sep 17 00:00:00 2001 From: yuanyazhi Date: Sat, 18 May 2024 12:11:21 +0800 Subject: [PATCH 1/6] Revert "add cbo string type" This reverts commit ab3ac4bde28750152e61288dffa7faf0819c3ca9. --- .../tianchi/datatype_cnvrt_4_index_search.cc | 3 +- storage/tianchi/tse_cbo.cc | 94 +++++++------------ storage/tianchi/tse_srv.h | 1 - storage/tianchi/tse_util.h | 2 +- 4 files changed, 37 insertions(+), 63 deletions(-) diff --git a/storage/tianchi/datatype_cnvrt_4_index_search.cc b/storage/tianchi/datatype_cnvrt_4_index_search.cc index cc6ded0..6f104f2 100644 --- a/storage/tianchi/datatype_cnvrt_4_index_search.cc +++ b/storage/tianchi/datatype_cnvrt_4_index_search.cc @@ -19,7 +19,8 @@ #include "tse_log.h" #include "tse_error.h" #include "datatype_cnvrt_4_index_search.h" -#include "tse_util.h" + +constexpr uint8 OFFSET_VARCHAR_TYPE = 2; static void tse_convert_mysql_key_to_cantian(KEY_PART_INFO &key_part, const uint8_t *key, uint16_t key_len, uint32_t *data_field_len, uint8_t **use_key, uint32_t *use_key_len, bool *is_key_null) { diff --git a/storage/tianchi/tse_cbo.cc b/storage/tianchi/tse_cbo.cc index f96f8be..c3c0f6a 100644 --- a/storage/tianchi/tse_cbo.cc +++ b/storage/tianchi/tse_cbo.cc @@ -22,7 +22,8 @@ #include "datatype_cnvrtr.h" #include "decimal_convert.h" #include "tse_util.h" -void r_key2variant(tse_key *rKey, KEY_PART_INFO *cur_index_part, cache_variant_t *ret_val, cache_variant_t * value, uint32_t key_offset, const CHARSET_INFO *cs) + +void r_key2variant(tse_key *rKey, KEY_PART_INFO *cur_index_part, cache_variant_t *ret_val, cache_variant_t * value, uint32_t key_offset) { if (rKey->cmp_type == CMP_TYPE_NULL) { *ret_val = *value; @@ -44,7 +45,6 @@ void r_key2variant(tse_key *rKey, KEY_PART_INFO *cur_index_part, cache_variant_t const uchar *key = rKey->key + key_offset + offset; uchar tmp_ptr[TSE_BYTE_8] = {0}; const field_cnvrt_aux_t *mysql_info = get_auxiliary_for_field_convert(field, field->type()); - int size = 0; switch(field->real_type()) { case MYSQL_TYPE_TINY: case MYSQL_TYPE_SHORT: @@ -82,24 +82,6 @@ void r_key2variant(tse_key *rKey, KEY_PART_INFO *cur_index_part, cache_variant_t decimal_mysql_to_cantian(const_cast(key), tmp_ptr, field, &length); memcpy((void *)&ret_val->v_dec, tmp_ptr, sizeof(dec4_t)); break; - case MYSQL_TYPE_STRING: - case MYSQL_TYPE_VAR_STRING: - case MYSQL_TYPE_VARCHAR: - - size = sizeof(ret_val->v_text.str); - ret_val->v_text= *(my_text_t *)const_cast(key); - ret_val->v_text.len= *(uint32_t *)cs->cset->lengthsp; - - if(ret_val->v_text.str != nullptr && (ret_val->v_text.len == 0||ret_val->v_text.len > (uint32_t)size)){ - int index; - for (index = 0; index < size; index++) { - if(ret_val->v_text.str[index] == cs->pad_char || ret_val->v_text.str[index] == '\0'){ - break; - } - } - ret_val->v_text.len = index; - } - break; default: break; } @@ -133,7 +115,7 @@ double decimal_compare(dec4_t *dec1, dec4_t *dec2) return my_decimal_cmp(&my_decimal1, &my_decimal2); } -en_tse_compare_type compare(cache_variant_t *right, cache_variant_t *left, enum_field_types field_type, const CHARSET_INFO *cs) +en_tse_compare_type compare(cache_variant_t *right, cache_variant_t *left, enum_field_types field_type) { double compare_value = 0; switch(field_type) { @@ -147,7 +129,7 @@ en_tse_compare_type compare(cache_variant_t *right, cache_variant_t *left, enum_ compare_value = (right->v_real - left->v_real); break; case MYSQL_TYPE_LONGLONG: - compare_value = (right->v_bigint - left->v_bigint); + compare_value = (right->v_bigint - left->v_bigint); break; case MYSQL_TYPE_YEAR: case MYSQL_TYPE_TIMESTAMP2: @@ -166,11 +148,6 @@ en_tse_compare_type compare(cache_variant_t *right, cache_variant_t *left, enum_ case MYSQL_TYPE_NEWDECIMAL: compare_value = decimal_compare((dec4_t *)&right->v_dec, (dec4_t *)&left->v_dec); break; - case MYSQL_TYPE_STRING: - case MYSQL_TYPE_VAR_STRING: - case MYSQL_TYPE_VARCHAR: - compare_value = cs->coll->strnncollsp(cs, (uchar *)right->v_text.str, right->v_text.len,(uchar *)left->v_text.str, left->v_text.len); - break; default: return UNCOMPARABLE; } @@ -202,14 +179,14 @@ double eval_density_result(double density) } static double calc_frequency_hist_equal_density(tse_cbo_stats_column_t *col_stat, cache_variant_t *val, - enum_field_types field_type, const CHARSET_INFO *cs) + enum_field_types field_type) { en_tse_compare_type cmp_result; int64 result = 0; double density = col_stat->density; tse_cbo_column_hist_t *hist_infos = col_stat->column_hist; for (uint32 i = 0; i < col_stat->hist_count; i++) { - cmp_result = compare(&hist_infos[i].ep_value, val, field_type, cs); + cmp_result = compare(&hist_infos[i].ep_value, val, field_type); if (cmp_result == EQUAL) { result = (i == 0) ? hist_infos[i].ep_number : hist_infos[i].ep_number - hist_infos[i - 1].ep_number; @@ -230,13 +207,13 @@ static double calc_frequency_hist_equal_density(tse_cbo_stats_column_t *col_stat } static double calc_balance_hist_equal_density(tse_cbo_stats_column_t *col_stat, cache_variant_t *val, - enum_field_types field_type, const CHARSET_INFO *cs) + enum_field_types field_type) { uint32 popular_count = 0; en_tse_compare_type cmp_result; tse_cbo_column_hist_t *hist_infos = col_stat->column_hist; for (uint32 i = 0; i < col_stat->hist_count; i++) { - cmp_result = compare(&hist_infos[i].ep_value, val, field_type, cs); + cmp_result = compare(&hist_infos[i].ep_value, val, field_type); if (cmp_result == EQUAL) { // ep_number is different from oracle, when compress balance histogram, need to change this @@ -262,7 +239,7 @@ static double calc_equal_null_density(tse_cbo_stats_table_t *cbo_stats, uint32 c } double calc_hist_equal_density(tse_cbo_stats_table_t *cbo_stats, cache_variant_t *val, - uint32 col_id, enum_field_types field_type, const CHARSET_INFO *cs) + uint32 col_id, enum_field_types field_type) { tse_cbo_stats_column_t *col_stat = &cbo_stats->columns[col_id]; double density = col_stat->density; @@ -272,15 +249,15 @@ double calc_hist_equal_density(tse_cbo_stats_table_t *cbo_stats, cache_variant_t } if (col_stat->hist_type == FREQUENCY_HIST) { // HISTOGRAM_FREQUENCY - density = calc_frequency_hist_equal_density(col_stat, val, field_type, cs); + density = calc_frequency_hist_equal_density(col_stat, val, field_type); } else { // HISTOGRAM_BALANCE - density = calc_balance_hist_equal_density(col_stat, val, field_type, cs); + density = calc_balance_hist_equal_density(col_stat, val, field_type); } return density; } -static double calc_hist_between_frequency(tse_cbo_stats_table_t *cbo_stats, field_stats_val stats_val, enum_field_types field_type, uint32 col_id, const CHARSET_INFO *cs) +static double calc_hist_between_frequency(tse_cbo_stats_table_t *cbo_stats, field_stats_val stats_val, enum_field_types field_type, uint32 col_id) { tse_cbo_stats_column_t *col_stat = &cbo_stats->columns[col_id]; double density = col_stat->density; @@ -299,7 +276,7 @@ static double calc_hist_between_frequency(tse_cbo_stats_table_t *cbo_stats, fiel // HISTOGRAM_FREQUNCEY for (uint32 i = 0; i < hist_count; i++) { - cmp_result = compare(&hist_infos[i].ep_value, stats_val.min_key_val, field_type, cs); + cmp_result = compare(&hist_infos[i].ep_value, stats_val.min_key_val, field_type); if ((stats_val.min_type == CMP_TYPE_CLOSE_INTERNAL && (cmp_result == GREAT || cmp_result == EQUAL)) || (stats_val.min_type == CMP_TYPE_OPEN_INTERNAL && cmp_result == GREAT)) { if (i > 0) { @@ -312,7 +289,7 @@ static double calc_hist_between_frequency(tse_cbo_stats_table_t *cbo_stats, fiel for (uint32 i = 0; i < hist_count; i++) { - cmp_result = compare(&hist_infos[i].ep_value, stats_val.max_key_val, field_type, cs); + cmp_result = compare(&hist_infos[i].ep_value, stats_val.max_key_val, field_type); if ((stats_val.max_type == CMP_TYPE_OPEN_INTERNAL && (cmp_result == GREAT || cmp_result == EQUAL)) || (stats_val.max_type == CMP_TYPE_CLOSE_INTERNAL && cmp_result == GREAT)) { @@ -410,9 +387,6 @@ double percent_in_bucket(tse_cbo_stats_column_t *col_stat, uint32 high, case MYSQL_TYPE_NEWDECIMAL: percent = percent_in_bucket_4_decimal((dec4_t *)&ep_high->v_dec, (dec4_t *)&key->v_dec, (dec4_t *)&ep_low->v_dec); break; - case MYSQL_TYPE_STRING: - case MYSQL_TYPE_VAR_STRING: - case MYSQL_TYPE_VARCHAR: default: return DEFAULT_RANGE_DENSITY; } @@ -421,7 +395,7 @@ double percent_in_bucket(tse_cbo_stats_column_t *col_stat, uint32 high, } static int calc_hist_range_boundary(field_stats_val stats_val, enum_field_types field_type, tse_cbo_stats_column_t *col_stat, - double *percent, const CHARSET_INFO *cs) + double *percent) { en_tse_compare_type cmp_result; uint32 i, lo_pos, hi_pos; @@ -431,7 +405,7 @@ static int calc_hist_range_boundary(field_stats_val stats_val, enum_field_types lo_pos = hi_pos = hist_count - 1; for (i = 0; i < hist_count; i++) { - cmp_result = compare(&hist_infos[i].ep_value, stats_val.min_key_val, field_type, cs); + cmp_result = compare(&hist_infos[i].ep_value, stats_val.min_key_val, field_type); if (cmp_result == GREAT) { lo_pos = i; break; @@ -442,7 +416,7 @@ static int calc_hist_range_boundary(field_stats_val stats_val, enum_field_types *percent += percent_in_bucket(col_stat, i, stats_val.min_key_val, field_type); for (i = lo_pos; i < hist_count; i++) { - cmp_result = compare(&hist_infos[i].ep_value, stats_val.max_key_val, field_type, cs); + cmp_result = compare(&hist_infos[i].ep_value, stats_val.max_key_val, field_type); if (cmp_result == GREAT || cmp_result == EQUAL) { hi_pos = i; break; @@ -457,18 +431,18 @@ static int calc_hist_range_boundary(field_stats_val stats_val, enum_field_types } if (stats_val.min_type == CMP_TYPE_CLOSE_INTERNAL) { - *percent += calc_balance_hist_equal_density(col_stat, stats_val.min_key_val, field_type, cs); + *percent += calc_balance_hist_equal_density(col_stat, stats_val.min_key_val, field_type); } if (stats_val.max_type == CMP_TYPE_CLOSE_INTERNAL) { - *percent += calc_balance_hist_equal_density(col_stat, stats_val.max_key_val, field_type, cs); + *percent += calc_balance_hist_equal_density(col_stat, stats_val.max_key_val, field_type); } // return complete bucket number return hi_pos - lo_pos; } -static double calc_hist_between_balance(tse_cbo_stats_table_t *cbo_stats, field_stats_val stats_val, enum_field_types field_type, uint32 col_id, const CHARSET_INFO *cs) +static double calc_hist_between_balance(tse_cbo_stats_table_t *cbo_stats, field_stats_val stats_val, enum_field_types field_type, uint32 col_id) { tse_cbo_stats_column_t *col_stat = &cbo_stats->columns[col_id]; double density = col_stat->density; @@ -478,7 +452,7 @@ static double calc_hist_between_balance(tse_cbo_stats_table_t *cbo_stats, field_ } double percent = 0; - int bucket_range = calc_hist_range_boundary(stats_val, field_type, col_stat, &percent, cs); + int bucket_range = calc_hist_range_boundary(stats_val, field_type, col_stat, &percent); if (col_stat->num_buckets > 0) { density = (double)bucket_range / col_stat->num_buckets + percent; @@ -489,22 +463,22 @@ static double calc_hist_between_balance(tse_cbo_stats_table_t *cbo_stats, field_ } static double calc_hist_between_density(tse_cbo_stats_table_t *cbo_stats, - uint32 col_id, enum_field_types field_type, field_stats_val stats_val, const CHARSET_INFO *cs) + uint32 col_id, enum_field_types field_type, field_stats_val stats_val) { double density; tse_cbo_stats_column_t *col_stat = &cbo_stats->columns[col_id]; if (col_stat->hist_type == FREQUENCY_HIST) { // HISTOGRAM_FREQUENCY - density = calc_hist_between_frequency(cbo_stats, stats_val, field_type, col_id, cs); + density = calc_hist_between_frequency(cbo_stats, stats_val, field_type, col_id); } else { // HISTOGRAM_BALANCE - density = calc_hist_between_balance(cbo_stats, stats_val, field_type, col_id, cs); + density = calc_hist_between_balance(cbo_stats, stats_val, field_type, col_id); } return density; } double calc_density_by_cond(tse_cbo_stats_table_t *cbo_stats, KEY_PART_INFO cur_index_part, tse_range_key *key, - uint32_t key_offset, const CHARSET_INFO *cs) + uint32_t key_offset) { double density = DEFAULT_RANGE_DENSITY; uint32 col_id = cur_index_part.field->field_index(); @@ -529,16 +503,16 @@ double calc_density_by_cond(tse_cbo_stats_table_t *cbo_stats, KEY_PART_INFO cur_ cache_variant_t min_key_val; cache_variant_t max_key_val; - r_key2variant(min_key, &cur_index_part, &min_key_val, low_val, key_offset, cs); - r_key2variant(max_key, &cur_index_part, &max_key_val, high_val, key_offset, cs); + r_key2variant(min_key, &cur_index_part, &min_key_val, low_val, key_offset); + r_key2variant(max_key, &cur_index_part, &max_key_val, high_val, key_offset); enum_field_types field_type = cur_index_part.field->real_type(); - if (compare(&max_key_val, low_val, field_type, cs) == LESS || compare(&min_key_val, high_val, field_type, cs) == GREAT) { + if (compare(&max_key_val, low_val, field_type) == LESS || compare(&min_key_val, high_val, field_type) == GREAT) { return 0; } - en_tse_compare_type comapare_value = compare(&max_key_val, &min_key_val, field_type, cs); + en_tse_compare_type comapare_value = compare(&max_key_val, &min_key_val, field_type); if (comapare_value == EQUAL && min_key->cmp_type == CMP_TYPE_CLOSE_INTERNAL && max_key->cmp_type == CMP_TYPE_CLOSE_INTERNAL) { - return calc_hist_equal_density(cbo_stats, &max_key_val, col_id, field_type, cs); + return calc_hist_equal_density(cbo_stats, &max_key_val, col_id, field_type); } else if (comapare_value == UNCOMPARABLE) { return DEFAULT_RANGE_DENSITY; } else if (comapare_value == LESS) { @@ -546,7 +520,7 @@ double calc_density_by_cond(tse_cbo_stats_table_t *cbo_stats, KEY_PART_INFO cur_ } field_stats_val stats_val = {min_key->cmp_type, max_key->cmp_type, &max_key_val, &min_key_val}; - density = calc_hist_between_density(cbo_stats, col_id, field_type, stats_val, cs); + density = calc_hist_between_density(cbo_stats, col_id, field_type, stats_val); return density; } @@ -574,15 +548,15 @@ double calc_density_one_table(uint16_t idx_id, tse_range_key *key, KEY_PART_INFO cur_index_part = cur_index.key_part[idx_col_num]; col_id = cur_index_part.field->field_index(); uint32_t offset = cur_index_part.field->is_nullable() ? 1 : 0;//null值标记位 - key_offset += cur_index_part.field->type() == MYSQL_TYPE_VARCHAR?OFFSET_VARCHAR_TYPE:0; + if (cbo_stats->columns[col_id].total_rows == 0) { //空表 col_product = 0; } else if (key_offset + offset + cur_index_part.field->key_length() == key_len) {// - col_product = calc_density_by_cond(cbo_stats, cur_index_part, key, key_offset, table.field[col_id]->charset()); + col_product = calc_density_by_cond(cbo_stats, cur_index_part, key, key_offset); } else if ((offset == 1) && *(key->min_key->key + key_offset) == 1) { //null值 col_product = calc_equal_null_density(cbo_stats, col_id, true); } else { - col_product = calc_density_by_cond(cbo_stats, cur_index_part, key, key_offset, table.field[col_id]->charset());//联合索引 + col_product = calc_density_by_cond(cbo_stats, cur_index_part, key, key_offset);//联合索引 // col_product = calc_equal_density(part_info, QUERY_TYPE_EQUAL, cbo_stats, col_id); // col_product = calc_hist_equal_density(cbo_stats, &max_key_val, col_id, field_type); } diff --git a/storage/tianchi/tse_srv.h b/storage/tianchi/tse_srv.h index 905d59d..ea0f0da 100644 --- a/storage/tianchi/tse_srv.h +++ b/storage/tianchi/tse_srv.h @@ -135,7 +135,6 @@ typedef struct cache_st_variant { unsigned long long v_ubigint; double v_real; date_t v_date; - my_text_t v_text; my_dec4_t v_dec; }; } cache_variant_t; diff --git a/storage/tianchi/tse_util.h b/storage/tianchi/tse_util.h index 6198f14..3cad7f2 100644 --- a/storage/tianchi/tse_util.h +++ b/storage/tianchi/tse_util.h @@ -33,7 +33,7 @@ using namespace std; static unordered_set mysql_system_db{"information_schema", "mysql", "performance_schema", "sys"}; #define CM_IS_EMPTY_STR(str) (((str) == NULL) || ((str)[0] == 0)) -constexpr uint8 OFFSET_VARCHAR_TYPE = 2; + #define TSE_GET_THD_DB_NAME(thd) (thd->db().str == NULL) ? nullptr : const_cast(thd->db().str) void tse_split_normalized_name(const char *file_name, char db[], size_t db_buf_len, -- Gitee From bf988574c761d8c53fe19f91ad5cd6213b90a23e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8F=9E=E7=8F=88=E5=B1=B1=E7=9A=84=E7=8C=AB?= Date: Sat, 18 May 2024 16:51:04 +0800 Subject: [PATCH 2/6] decimal reconstruct --- storage/tianchi/datatype_cnvrtr.cc | 29 ++++++++++++----- storage/tianchi/datatype_cnvrtr.h | 1 + storage/tianchi/decimal_convert.h | 7 ++--- storage/tianchi/tse_cbo.cc | 50 ++++-------------------------- storage/tianchi/tse_srv.h | 25 +-------------- 5 files changed, 31 insertions(+), 81 deletions(-) diff --git a/storage/tianchi/datatype_cnvrtr.cc b/storage/tianchi/datatype_cnvrtr.cc index 2e6c4ca..4bdcd98 100644 --- a/storage/tianchi/datatype_cnvrtr.cc +++ b/storage/tianchi/datatype_cnvrtr.cc @@ -389,9 +389,10 @@ int decimal_mysql_to_cantian(const uint8_t *mysql_ptr, uchar *cantian_ptr, Field return ret; } -my_decimal cnvrt_cantian_to_my_decimal(dec4_t *d4) +void decimal_cantian_to_mysql(uint8_t *mysql_ptr, uchar *cantian_ptr, Field *mysql_field) { dec8_t dec; + dec4_t *d4 = (dec4_t *)cantian_ptr; ct_cm_dec_4_to_8(&dec, d4, (uint32)cm_dec4_stor_sz(d4)); char str[DEC_MAX_NUM_SAVING_PREC]; if (ct_cm_dec8_to_str(&dec, DEC_MAX_NUM_SAVING_PREC, str) != CT_SUCCESS_STATUS) { @@ -406,13 +407,6 @@ my_decimal cnvrt_cantian_to_my_decimal(dec4_t *d4) tse_log_error("[cantian2mysql]Decimal data type convert str to my_decimal failed!"); assert(0); } - return decimal_value; -} - -void decimal_cantian_to_mysql(uint8_t *mysql_ptr, uchar *cantian_ptr, Field *mysql_field) -{ - dec4_t *d4 = (dec4_t *)(char *)cantian_ptr; - my_decimal decimal_value = cnvrt_cantian_to_my_decimal(d4); const int prec = ((Field_new_decimal *)mysql_field)->precision; const int scale = mysql_field->decimals(); @@ -422,6 +416,25 @@ void decimal_cantian_to_mysql(uint8_t *mysql_ptr, uchar *cantian_ptr, Field *mys } } +int decimal_mysql_to_double(const uint8_t *mysql_ptr, uchar *double_ptr, Field *mysql_field) +{ + int ret = 0; + const int scale = mysql_field->decimals(); + Field_new_decimal *f = (Field_new_decimal *)mysql_field; + const int prec = f->precision; + my_decimal d; + ret = binary2my_decimal(E_DEC_FATAL_ERROR, mysql_ptr, &d, prec, scale); + if (ret != E_DEC_OK) { + tse_log_error("[decimal2double]: Decimal data type convert binary to my_decimal failed!"); + return ret; + } + ret = decimal2double(&d, (double *)double_ptr); + if (ret != E_DEC_OK) { + tse_log_error("[decimal2double]: Decimal data type convert my_decimal to double failed!"); + } + return ret; +} + static inline uint32 get_lob_locator_size(void* locator) { lob_locator_t *lob = (lob_locator_t *)locator; diff --git a/storage/tianchi/datatype_cnvrtr.h b/storage/tianchi/datatype_cnvrtr.h index 95f8630..76f4f59 100644 --- a/storage/tianchi/datatype_cnvrtr.h +++ b/storage/tianchi/datatype_cnvrtr.h @@ -242,4 +242,5 @@ 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 diff --git a/storage/tianchi/decimal_convert.h b/storage/tianchi/decimal_convert.h index 5b8f26f..8b02d83 100644 --- a/storage/tianchi/decimal_convert.h +++ b/storage/tianchi/decimal_convert.h @@ -18,9 +18,7 @@ #include "my_dbug.h" #include "my_inttypes.h" #include "string.h" -#include "tse_srv.h" -#include "sql/item.h" -#include "sql/item_func.h" + #ifndef DECIMAL_CONVERT_H #define DECIMAL_CONVERT_H #define DEC8_EXPN_UNIT 8 @@ -355,5 +353,4 @@ static inline void cm_dec_8_to_4(dec4_t *d4, const dec8_t *d8) { i4--; } d4->ncells = (uint8)i4; -} -my_decimal cnvrt_cantian_to_my_decimal(dec4_t *d4); \ No newline at end of file +} \ No newline at end of file diff --git a/storage/tianchi/tse_cbo.cc b/storage/tianchi/tse_cbo.cc index c3c0f6a..d6b1211 100644 --- a/storage/tianchi/tse_cbo.cc +++ b/storage/tianchi/tse_cbo.cc @@ -20,7 +20,6 @@ #include "sql/field.h" #include "tse_srv_mq_module.h" #include "datatype_cnvrtr.h" -#include "decimal_convert.h" #include "tse_util.h" void r_key2variant(tse_key *rKey, KEY_PART_INFO *cur_index_part, cache_variant_t *ret_val, cache_variant_t * value, uint32_t key_offset) @@ -78,9 +77,8 @@ void r_key2variant(tse_key *rKey, KEY_PART_INFO *cur_index_part, cache_variant_t break; case MYSQL_TYPE_DECIMAL: case MYSQL_TYPE_NEWDECIMAL: - uint32 length; - decimal_mysql_to_cantian(const_cast(key), tmp_ptr, field, &length); - memcpy((void *)&ret_val->v_dec, tmp_ptr, sizeof(dec4_t)); + decimal_mysql_to_double(const_cast(key), tmp_ptr, field); + ret_val->v_real = *(double *)tmp_ptr; break; default: break; @@ -108,13 +106,6 @@ double datetime_compare(const uchar *datetime1, const uchar *datetime2) return datetime1_int - datetime2_int; } -double decimal_compare(dec4_t *dec1, dec4_t *dec2) -{ - my_decimal my_decimal1 = cnvrt_cantian_to_my_decimal(dec1); - my_decimal my_decimal2 = cnvrt_cantian_to_my_decimal(dec2); - return my_decimal_cmp(&my_decimal1, &my_decimal2); -} - en_tse_compare_type compare(cache_variant_t *right, cache_variant_t *left, enum_field_types field_type) { double compare_value = 0; @@ -126,6 +117,8 @@ en_tse_compare_type compare(cache_variant_t *right, cache_variant_t *left, enum_ break; case MYSQL_TYPE_FLOAT: case MYSQL_TYPE_DOUBLE: + case MYSQL_TYPE_DECIMAL: + case MYSQL_TYPE_NEWDECIMAL: compare_value = (right->v_real - left->v_real); break; case MYSQL_TYPE_LONGLONG: @@ -144,10 +137,6 @@ en_tse_compare_type compare(cache_variant_t *right, cache_variant_t *left, enum_ case MYSQL_TYPE_TIME2: compare_value = time_compare((const uchar *)&(right->v_date), (const uchar *)&(left->v_date)); break; - case MYSQL_TYPE_DECIMAL: - case MYSQL_TYPE_NEWDECIMAL: - compare_value = decimal_compare((dec4_t *)&right->v_dec, (dec4_t *)&left->v_dec); - break; default: return UNCOMPARABLE; } @@ -306,31 +295,6 @@ static double calc_hist_between_frequency(tse_cbo_stats_table_t *cbo_stats, fiel } -double percent_in_bucket_4_decimal(dec4_t *high_dec, dec4_t *key_dec, dec4_t *low_dec) -{ - double percent = 0.0D; - my_decimal high_decimal_value = cnvrt_cantian_to_my_decimal(high_dec); - my_decimal key_decimal_value = cnvrt_cantian_to_my_decimal(key_dec); - my_decimal low_decimal_value = cnvrt_cantian_to_my_decimal(low_dec); - my_decimal denominator; - if (my_decimal_sub(E_DEC_FATAL_ERROR, &denominator, &high_decimal_value, &low_decimal_value) != E_DEC_OK) { - return 0; - } - my_decimal numerator; - if (my_decimal_sub(E_DEC_FATAL_ERROR, &numerator, &high_decimal_value, &key_decimal_value) != E_DEC_OK) { - return 0; - } - my_decimal percent_decimal_value; - if (my_decimal_div(E_DEC_FATAL_ERROR, &percent_decimal_value, &numerator, &denominator, 0) != E_DEC_OK) { - return 0; - } - my_decimal2double(E_DEC_FATAL_ERROR, &percent_decimal_value, &percent); - if (percent > 0) { - return percent; - } - return 0; -} - double percent_in_bucket(tse_cbo_stats_column_t *col_stat, uint32 high, cache_variant_t *key, enum_field_types field_type) { @@ -349,6 +313,8 @@ double percent_in_bucket(tse_cbo_stats_column_t *col_stat, uint32 high, break; case MYSQL_TYPE_FLOAT: case MYSQL_TYPE_DOUBLE: + case MYSQL_TYPE_DECIMAL: + case MYSQL_TYPE_NEWDECIMAL: if (ep_high->v_real - ep_low->v_real > 0) { percent = (double)(ep_high->v_real - key->v_real) / (ep_high->v_real - ep_low->v_real); } @@ -383,10 +349,6 @@ double percent_in_bucket(tse_cbo_stats_column_t *col_stat, uint32 high, percent = time_compare((const uchar *)&ep_high->v_date, (const uchar *)&key->v_date) / denominator; } break; - case MYSQL_TYPE_DECIMAL: - case MYSQL_TYPE_NEWDECIMAL: - percent = percent_in_bucket_4_decimal((dec4_t *)&ep_high->v_dec, (dec4_t *)&key->v_dec, (dec4_t *)&ep_low->v_dec); - break; default: return DEFAULT_RANGE_DENSITY; } diff --git a/storage/tianchi/tse_srv.h b/storage/tianchi/tse_srv.h index ea0f0da..5f6eab9 100644 --- a/storage/tianchi/tse_srv.h +++ b/storage/tianchi/tse_srv.h @@ -103,29 +103,7 @@ typedef struct { int32_t sql_type; int32_t mdl_namespace; } tse_lock_table_info; -#pragma pack(4) -typedef struct my_st_text { - char str[64]; - uint32_t len; -} my_text_t; -#pragma pack() -typedef uint16_t my_c4typ_t; -typedef uint32_t my_cc4typ_t; -#define MY_DEC4_CELL_SIZE (uint8_t)18 -typedef my_c4typ_t my_cell4_t[MY_DEC4_CELL_SIZE]; -#pragma pack(2) -typedef struct my_st_dec4 { - union { - struct { - uint8_t sign : 1; /* 0: for positive integer; 1: for negative integer */ - uint8_t ncells : 7; /* number of cells, 0: for unspecified precision */ - int8_t expn; /* the exponent of the number */ - }; - my_c4typ_t head; - }; - my_cell4_t cells; -} my_dec4_t; -#pragma pack() + typedef struct cache_st_variant { union { int v_int; @@ -135,7 +113,6 @@ typedef struct cache_st_variant { unsigned long long v_ubigint; double v_real; date_t v_date; - my_dec4_t v_dec; }; } cache_variant_t; -- Gitee From 636f18b09351bfd387ae484859ee60a03406570b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8F=9E=E7=8F=88=E5=B1=B1=E7=9A=84=E7=8C=AB?= Date: Wed, 22 May 2024 11:21:24 +0800 Subject: [PATCH 3/6] dynamic_cast item_func --- storage/tianchi/ha_tse_ddl.cc | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/storage/tianchi/ha_tse_ddl.cc b/storage/tianchi/ha_tse_ddl.cc index f407ea4..ee1bc4d 100644 --- a/storage/tianchi/ha_tse_ddl.cc +++ b/storage/tianchi/ha_tse_ddl.cc @@ -1179,7 +1179,14 @@ static void tse_fill_prefix_func_key_part(TcDb__TseDDLTableKeyPart *req_key_part static uint32_t tse_fill_func_key_part(TABLE *form, THD *thd, TcDb__TseDDLTableKeyPart *req_key_part, Value_generator *gcol_info) { - uint32_t arg_count = ((Item_func *)gcol_info->expr_item)->arg_count; + 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), + "[TSE_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), "[TSE_CREATE_TABLE]: There is no functional index."); @@ -1187,8 +1194,8 @@ static uint32_t tse_fill_func_key_part(TABLE *form, THD *thd, TcDb__TseDDLTableK } req_key_part->is_func = true; - req_key_part->func_name = const_cast(((Item_func *)gcol_info->expr_item)->func_name()); - Item **args = ((Item_func *)gcol_info->expr_item)->arguments(); + req_key_part->func_name = const_cast(func_expr_item->func_name()); + Item **args = func_expr_item->arguments(); uint32_t col_item_count = 0; Field *field = nullptr; for (uint32_t i = 0; i < arg_count; i++) { -- Gitee From 327e19710b280295c5749812f34db6a6f03a09dc Mon Sep 17 00:00:00 2001 From: solid-yang Date: Fri, 24 May 2024 17:49:56 +0800 Subject: [PATCH 4/6] unlock tables before locking tables --- storage/tianchi/ctc_meta_data.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/storage/tianchi/ctc_meta_data.cc b/storage/tianchi/ctc_meta_data.cc index f93bc15..09399ec 100644 --- a/storage/tianchi/ctc_meta_data.cc +++ b/storage/tianchi/ctc_meta_data.cc @@ -829,6 +829,9 @@ int ctc_set_sys_var(tse_ddl_broadcast_request *broadcast_req) { } int tse_ddl_execute_lock_tables_by_req(tianchi_handler_t *tch, tse_lock_table_info *lock_info, int *err_code) { +// unlock tables before locking tables + tse_mdl_unlock_tables_thd(tch); + bool is_same_node = (tch->inst_id == tse_instance_id); uint64_t mdl_thd_key = tse_get_conn_key(tch->inst_id, tch->thd_id, true); -- Gitee From 8bf28894f875d89c571d2cfa3e415bbba7416644 Mon Sep 17 00:00:00 2001 From: solid-yang Date: Tue, 21 May 2024 11:21:36 +0800 Subject: [PATCH 5/6] fix calculation of rec_per_key --- storage/tianchi/tse_cbo.cc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/storage/tianchi/tse_cbo.cc b/storage/tianchi/tse_cbo.cc index d6b1211..eaf20f8 100644 --- a/storage/tianchi/tse_cbo.cc +++ b/storage/tianchi/tse_cbo.cc @@ -550,11 +550,20 @@ void tse_index_stats_update(TABLE *table, tianchi_cbo_stats_t *cbo_stats) for (uint32 i = 0; i < table->s->keys; i++) { sk = table->key_info[i]; for (uint32 j = 0; j < sk.actual_key_parts; j++) { + bool all_n_diff_is_zero = true; rec_per_key = 0.0f; for (uint32 k = 0; k < table_part_num; k++) { records = cbo_stats->tse_cbo_stats_table[k].estimate_rows; if (*(n_diff + i * MAX_KEY_COLUMNS + j) > 0) { rec_per_key += static_cast(records) / static_cast(*(n_diff + i * MAX_KEY_COLUMNS + j)); + all_n_diff_is_zero = false; + } + } + + // if all n_diff(s) values 0, take records itself as rec_per_key + if (all_n_diff_is_zero) { + for (uint32 k = 0; k < table_part_num; k++) { + rec_per_key += static_cast(cbo_stats->tse_cbo_stats_table[k].estimate_rows); } } -- Gitee From a9331726d56e49f1a1f52de4cfb1d52deabf0c2a Mon Sep 17 00:00:00 2001 From: qiuyang19960521 Date: Thu, 30 May 2024 17:37:15 +0800 Subject: [PATCH 6/6] fix: index directory error and nullPtr MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit bool check_unsupported_index(dd::Table *table_def);# fix: index directory error and nullptr fix: index directory error and nullPtr fix: index directory error and nullPtr# fix: index directory error and nullPtr bool check_unsupported_index(dd::Table *table_def);# ix: index directory error and nullPtr# fix: index directory error and nullptr fix: partition index directory error fix: index directory error and nullpt# fix: partition index directory error fix: partition index directory error fix: index directory error and nullPtr# 增加分区建表 创建分区表与普通表的索引文件目录拦截 change tse_db_datafile_extend_size fix alter notify lock 创建分区表与普通表的索引文件目录拦截# change tse_db_datafile_extend_size fix alter notify lock 修复分区建表索引目录 修复分区建表索引目录# --- storage/tianchi/ha_tse.cc | 30 +++++++++++++++--- storage/tianchi/ha_tse.h | 2 ++ storage/tianchi/ha_tsepart.cc | 32 +++++++++++++++++++ storage/tianchi/ha_tsepart.h | 6 ++++ storage/tianchi/tse_ddl_rewriter_plugin.cc | 36 ---------------------- storage/tianchi/tse_util.cc | 34 ++++++++++++++++++++ storage/tianchi/tse_util.h | 2 ++ 7 files changed, 102 insertions(+), 40 deletions(-) diff --git a/storage/tianchi/ha_tse.cc b/storage/tianchi/ha_tse.cc index 703d903..cfa9d90 100644 --- a/storage/tianchi/ha_tse.cc +++ b/storage/tianchi/ha_tse.cc @@ -106,6 +106,9 @@ #include "sql/dd/upgrade/server.h" // UPGRADE_FORCE #include "sql/abstract_query_plan.h" +#include "sql/dd/properties.h" +#include "sql/dd/types/partition.h" + #include "tse_stats.h" #include "tse_error.h" #include "tse_log.h" @@ -117,6 +120,7 @@ #include "sql/mysqld.h" #include "sql/plugin_table.h" #include "sql/dd/object_id.h" +#include "sql/dd/string_type.h" #include "sql/dd/cache/dictionary_client.h" #include "sql/dd/dd_schema.h" #include "sql/sql_table.h" @@ -148,8 +152,8 @@ static MYSQL_SYSVAR_BOOL(db_datafile_autoextend, tse_db_datafile_autoextend, PLU uint32_t tse_db_datafile_size = 32; static MYSQL_SYSVAR_UINT(db_datafile_size, tse_db_datafile_size, PLUGIN_VAR_RQCMDARG, "Size of the tablespace data file of the TSE database, in MB.", nullptr, nullptr, 32, 1, 8192 * 1024, 0); -/* 创库的表空间datafile自动扩展大小, 单位M, 默认8M, 最小1M, 最大8T */ -uint32_t tse_db_datafile_extend_size = 8; +/* 创库的表空间datafile自动扩展大小, 单位M, 默认128M, 最小1M, 最大8T */ +uint32_t tse_db_datafile_extend_size = 128; static MYSQL_SYSVAR_UINT(db_datafile_extend_size, tse_db_datafile_extend_size, PLUGIN_VAR_RQCMDARG, "Size of the TSE database tablespace data file automatically extended, in MB.", nullptr, nullptr, 8, 1, 8192 * 1024, 0); @@ -775,7 +779,10 @@ bool ha_tse::check_unsupported_operation(THD *thd, HA_CREATE_INFO *create_info) my_error(ER_NOT_ALLOWED_COMMAND, MYF(0)); return HA_ERR_UNSUPPORTED; } - + if (create_info != nullptr && create_info->index_file_name) { + my_error(ER_ILLEGAL_HA, MYF(0), table_share->table_name.str, HA_WRONG_CREATE_OPTION); + return true; + } return false; } @@ -2002,7 +2009,22 @@ static bool tse_notify_exclusive_mdl(THD *thd, const MDL_key *mdl_key, static bool tse_notify_alter_table(THD *thd, const MDL_key *mdl_key, ha_notification_type notification_type) { - return tse_notify_exclusive_mdl(thd, mdl_key, notification_type, nullptr); + vector ticket_list; + if (IS_METADATA_NORMALIZATION() && notification_type == HA_NOTIFY_PRE_EVENT) { + int pre_lock_ret = tse_lock_table_pre(thd, ticket_list); + if (pre_lock_ret != 0) { + tse_lock_table_post(thd, ticket_list); + my_printf_error(ER_LOCK_WAIT_TIMEOUT, "[tse_notify_alter_table]: LOCK TABLE FAILED", MYF(0)); + return true; + } + } + + bool ret = tse_notify_exclusive_mdl(thd, mdl_key, notification_type, nullptr); + + if (IS_METADATA_NORMALIZATION() && notification_type == HA_NOTIFY_PRE_EVENT) { + tse_lock_table_post(thd, ticket_list); + } + return ret; } static const unsigned int MAX_SAVEPOINT_NAME_LEN = 64; diff --git a/storage/tianchi/ha_tse.h b/storage/tianchi/ha_tse.h index 9cdeedb..33ec26a 100644 --- a/storage/tianchi/ha_tse.h +++ b/storage/tianchi/ha_tse.h @@ -36,6 +36,7 @@ #include "sql/abstract_query_plan.h" #include "sql/dd/types/schema.h" #include "sql/dd/types/object_table_definition.h" +#include "sql/dd/string_type.h" #pragma GCC visibility push(default) @@ -148,6 +149,7 @@ again. */ #define IS_PRIMARY_ROLE() (tse_get_cluster_role() == (int32_t)dis_cluster_role::PRIMARY) #define IS_STANDBY_ROLE() (tse_get_cluster_role() == (int32_t)dis_cluster_role::STANDBY) +static const dd::String_type index_file_name_val_key("index_file_name"); static const uint ROW_ID_LENGTH = sizeof(uint64_t); static const uint TSE_START_TIMEOUT = 120; // seconds extern const char *tse_hton_name; diff --git a/storage/tianchi/ha_tsepart.cc b/storage/tianchi/ha_tsepart.cc index dc0ad9c..a2616f8 100644 --- a/storage/tianchi/ha_tsepart.cc +++ b/storage/tianchi/ha_tsepart.cc @@ -53,6 +53,9 @@ #include "typelib.h" #include "tse_cbo.h" #include "sql/sql_alter.h" +#include "sql/dd/properties.h" +#include "sql/dd/types/partition.h" +#include "sql/dd/string_type.h" #define INVALID_PART_ID (uint32)0xFFFFFFFF; @@ -1130,3 +1133,32 @@ uint32 ha_tsepart::calculate_key_hash_value(Field **field_array) return (Partition_helper::ph_calculate_key_hash_value(field_array)); } +bool ha_tsepart::check_unsupported_index(dd::Table *table_def) { + // 遍历分区,存在index_file_name_val,创建表失败 + for (const auto dd_part : *table_def->leaf_partitions()) { + dd::String_type index_file_name; + if(dd_part == nullptr){ + continue; + } + const dd::Properties &options = dd_part->options(); + if (options.exists(index_file_name_val_key)) { + options.get(index_file_name_val_key, &index_file_name); + } + 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_tsepart::create(const char *name, TABLE *form, HA_CREATE_INFO *create_info, + dd::Table *table_def) { + THD *thd = ha_thd(); + if(table_def != nullptr && check_unsupported_index(table_def)){ + tse_log_system("Unsupported operation. sql = %s", thd->query().str); + return HA_ERR_WRONG_COMMAND; + } + return ha_tse::create(name, form, create_info, table_def); +} + diff --git a/storage/tianchi/ha_tsepart.h b/storage/tianchi/ha_tsepart.h index 0cb0759..ed53454 100644 --- a/storage/tianchi/ha_tsepart.h +++ b/storage/tianchi/ha_tsepart.h @@ -24,6 +24,7 @@ #include "tse_srv.h" #include "tse_util.h" #include "sql/partitioning/partition_handler.h" +#include "sql/dd/string_type.h" class Tsepart_share : public Partition_share { public: @@ -64,6 +65,8 @@ class ha_tsepart : public ha_tse, */ int truncate_partition_low(dd::Table *dd_table) override; + bool check_unsupported_index(dd::Table *table_def); + /** Write a row in specific partition. Stores a row in an TSE database, to the table specified in this handle. @@ -368,6 +371,9 @@ class ha_tsepart : public ha_tse, 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; + /* Get partition row type @param[in] partition_table partition table @param[in] part_id Id of partition for which row type to be retrieved diff --git a/storage/tianchi/tse_ddl_rewriter_plugin.cc b/storage/tianchi/tse_ddl_rewriter_plugin.cc index 4aa9269..d5ee53a 100644 --- a/storage/tianchi/tse_ddl_rewriter_plugin.cc +++ b/storage/tianchi/tse_ddl_rewriter_plugin.cc @@ -706,9 +706,6 @@ static int tse_read_only_ddl(string &, MYSQL_THD thd, bool &need_forward) { return 0; } -int tse_lock_table_pre(THD* thd, vector& ticket_list); -void tse_lock_table_post(THD* thd, vector& ticket_list); - static int tse_lock_tables_ddl(string &, MYSQL_THD thd, bool &) { TABLE_LIST *tables = thd->lex->query_tables; int ret = 0; @@ -952,39 +949,6 @@ static int plugin_init(MYSQL_PLUGIN) { #define key_memory_tse_ddl_rewriter PSI_NOT_INSTRUMENTED #endif /* HAVE_PSI_INTERFACE */ -static inline bool is_temporary_table_being_opened(const TABLE_LIST *table) { - return table->open_type == OT_TEMPORARY_ONLY || - (table->open_type == OT_TEMPORARY_OR_BASE && - is_temporary_table(table)); -} - -int tse_lock_table_pre(THD* thd, vector& ticket_list) { - TABLE_LIST *tables_start = thd->lex->query_tables; - TABLE_LIST *tables_end = thd->lex->first_not_own_table(); - TABLE_LIST *table; - for (table = tables_start; table && table != tables_end; - table = table->next_global) { - if (is_temporary_table_being_opened(table)) { - continue; - } - MDL_request req; - MDL_REQUEST_INIT(&req, MDL_key::TABLE, table->db, table->table_name, - MDL_SHARED_NO_READ_WRITE, MDL_EXPLICIT); - if (thd->mdl_context.acquire_lock(&req, 1)) { - return 1; - } - ticket_list.push_back(req.ticket); - } - return 0; -} - -void tse_lock_table_post(THD* thd, vector& ticket_list) { - for (auto it = ticket_list.begin(); it != ticket_list.end(); ++it) { - thd->mdl_context.release_lock(*it); - } - ticket_list.clear(); -} - static void tse_ddl_rewrite_handle_error(MYSQL_THD thd, int ret, tse_ddl_broadcast_request &broadcast_req, uint8_t sql_cmd) { if (ret == TSE_DDL_VERSION_NOT_MATCH) { broadcast_req.err_code = ER_DISALLOWED_OPERATION; diff --git a/storage/tianchi/tse_util.cc b/storage/tianchi/tse_util.cc index 4d8619d..835c38b 100644 --- a/storage/tianchi/tse_util.cc +++ b/storage/tianchi/tse_util.cc @@ -21,6 +21,7 @@ #include "tse_proxy_util.h" #include "sql/sql_class.h" +#include "sql/sql_lex.h" #include "sql/tztime.h" #include "m_ctype.h" #include "my_sys.h" @@ -723,4 +724,37 @@ int tse_check_unlock_instance(MYSQL_THD thd) { tse_unlock_instance(&is_mysqld_starting, &tch); tse_log_system("[TSE_UNLOCK_INSTANCE]: SUCCESS. tse_inst:%u, conn_id:%u", tch.inst_id, tch.thd_id); return 0; +} + +static inline bool is_temporary_table_being_opened(const TABLE_LIST *table) { + return table->open_type == OT_TEMPORARY_ONLY || + (table->open_type == OT_TEMPORARY_OR_BASE && + is_temporary_table(table)); +} + +int tse_lock_table_pre(MYSQL_THD thd, vector& ticket_list) { + TABLE_LIST *tables_start = thd->lex->query_tables; + TABLE_LIST *tables_end = thd->lex->first_not_own_table(); + TABLE_LIST *table; + for (table = tables_start; table && table != tables_end; + table = table->next_global) { + if (is_temporary_table_being_opened(table)) { + continue; + } + MDL_request req; + MDL_REQUEST_INIT(&req, MDL_key::TABLE, table->db, table->table_name, + MDL_SHARED_NO_READ_WRITE, MDL_EXPLICIT); + if (thd->mdl_context.acquire_lock(&req, 1)) { + return 1; + } + ticket_list.push_back(req.ticket); + } + return 0; +} + +void tse_lock_table_post(MYSQL_THD thd, vector& ticket_list) { + for (auto it = ticket_list.begin(); it != ticket_list.end(); ++it) { + thd->mdl_context.release_lock(*it); + } + ticket_list.clear(); } \ No newline at end of file diff --git a/storage/tianchi/tse_util.h b/storage/tianchi/tse_util.h index 3cad7f2..305409f 100644 --- a/storage/tianchi/tse_util.h +++ b/storage/tianchi/tse_util.h @@ -66,6 +66,8 @@ void tse_print_cantian_err_msg(const ddl_ctrl_t *ddl_ctrl, ct_errno_t ret); int tse_check_lock_instance(MYSQL_THD thd, bool &need_forward); int tse_check_unlock_instance(MYSQL_THD thd); int ctc_record_sql(MYSQL_THD thd, bool need_select_db); +int tse_lock_table_pre(MYSQL_THD thd, vector& ticket_list); +void tse_lock_table_post(MYSQL_THD thd, vector& ticket_list); #pragma GCC visibility push(default) -- Gitee