diff --git a/mysql-test/suite/tianmu/r/issue228.result b/mysql-test/suite/tianmu/r/issue228.result new file mode 100644 index 000000000..1936018ad --- /dev/null +++ b/mysql-test/suite/tianmu/r/issue228.result @@ -0,0 +1,6 @@ +use test; +create table t1 (a varchar(112) charset utf8 collate utf8_bin not null,primary key (a)) select 'test' as a ; +select a from t1; +a +test +drop table t1; diff --git a/mysql-test/suite/tianmu/t/issue228.test b/mysql-test/suite/tianmu/t/issue228.test new file mode 100644 index 000000000..5ce5ea541 --- /dev/null +++ b/mysql-test/suite/tianmu/t/issue228.test @@ -0,0 +1,4 @@ +use test; +create table t1 (a varchar(112) charset utf8 collate utf8_bin not null,primary key (a)) select 'test' as a ; +select a from t1; +drop table t1; diff --git a/storage/tianmu/common/common_definitions.h b/storage/tianmu/common/common_definitions.h index ab3c3a095..895287945 100644 --- a/storage/tianmu/common/common_definitions.h +++ b/storage/tianmu/common/common_definitions.h @@ -89,6 +89,9 @@ constexpr int64_t MAX_ROW_NUMBER = 0x00007FFFFFFFFFFFULL; // 2^47 - 1 constexpr int64_t TIANMU_BIGINT_MAX = PLUS_INF_64; constexpr int64_t TIANMU_BIGINT_MIN = NULL_VALUE_64; +constexpr int32_t TIANMU_MAX_INDEX_COL_LEN_LARGE = 3072; +constexpr int32_t TIANMU_MAX_INDEX_COL_LEN_SMALL = 767; + #define NULL_VALUE_D (*(double *)("\x01\x00\x00\x00\x00\x00\x00\x80")) #define TIANMU_INT_MIN (-2147483647) #define TIANMU_MEDIUMINT_MAX ((1 << 23) - 1) diff --git a/storage/tianmu/handler/tianmu_handler.cpp b/storage/tianmu/handler/tianmu_handler.cpp index 39a384346..3b66b3691 100644 --- a/storage/tianmu/handler/tianmu_handler.cpp +++ b/storage/tianmu/handler/tianmu_handler.cpp @@ -248,9 +248,7 @@ int TianmuHandler::external_lock(THD *thd, int lock_type) { if (thd->lex->sql_command == SQLCOM_LOCK_TABLES) DBUG_RETURN(HA_ERR_WRONG_COMMAND); - if (is_delay_insert(thd) - && table_share->tmp_table == NO_TMP_TABLE - && lock_type == F_WRLCK) { + if (is_delay_insert(thd) && table_share->tmp_table == NO_TMP_TABLE && lock_type == F_WRLCK) { DBUG_RETURN(0); } @@ -273,8 +271,9 @@ int TianmuHandler::external_lock(THD *thd, int lock_type) { tx->AddTableRD(share); } else { tx->AddTableWR(share); - trans_register_ha(thd, false, rcbase_hton,NULL); - if (thd_test_options(thd, OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)) trans_register_ha(thd, true, rcbase_hton,NULL); + trans_register_ha(thd, false, rcbase_hton, NULL); + if (thd_test_options(thd, OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)) + trans_register_ha(thd, true, rcbase_hton, NULL); } } ret = 0; @@ -430,7 +429,7 @@ int TianmuHandler::write_row([[maybe_unused]] uchar *buf) { my_message(static_cast(common::ErrorCode::UNKNOWN_ERROR), e.what(), MYF(0)); } catch (common::FormatException &e) { TIANMU_LOG(LogCtl_Level::ERROR, "An exception is caught in Engine::InsertRow: %s Row: %ld, field %u.", e.what(), - e.m_row_no, e.m_field_no); + e.m_row_no, e.m_field_no); my_message(static_cast(common::ErrorCode::UNKNOWN_ERROR), e.what(), MYF(0)); } catch (common::FileException &e) { TIANMU_LOG(LogCtl_Level::ERROR, "An exception is caught in Engine::InsertRow: %s.", e.what()); @@ -773,8 +772,8 @@ int TianmuHandler::index_end() { index. */ int TianmuHandler::index_read([[maybe_unused]] uchar *buf, [[maybe_unused]] const uchar *key, - [[maybe_unused]] uint key_len __attribute__((unused)), - enum ha_rkey_function find_flag __attribute__((unused))) { + [[maybe_unused]] uint key_len __attribute__((unused)), + enum ha_rkey_function find_flag __attribute__((unused))) { DBUG_ENTER(__PRETTY_FUNCTION__); int rc = HA_ERR_KEY_NOT_FOUND; try { @@ -958,7 +957,7 @@ int TianmuHandler::rnd_init(bool scan) { table_new_iter_end = ((core::RCTable *)table_ptr)->End(); } catch (common::Exception const &e) { rc_control_ << system::lock << "Error in push-down execution, push-down execution aborted: " << e.what() - << system::unlock; + << system::unlock; TIANMU_LOG(LogCtl_Level::ERROR, "An exception is caught in push-down execution: %s", e.what()); } m_query.reset(); @@ -969,8 +968,8 @@ int TianmuHandler::rnd_init(bool scan) { table_new_iter_end = ((core::RCTable *)table_ptr)->End(); } else { std::shared_ptr rctp; - ha_rcengine_->GetTableIterator(m_table_name, table_new_iter, table_new_iter_end, rctp, GetAttrsUseIndicator(table), - table->in_use); + ha_rcengine_->GetTableIterator(m_table_name, table_new_iter, table_new_iter_end, rctp, + GetAttrsUseIndicator(table), table->in_use); table_ptr = rctp.get(); filter_ptr.reset(); } @@ -1110,9 +1109,9 @@ int TianmuHandler::extra(enum ha_extra_function operation) { int TianmuHandler::start_stmt(THD *thd, thr_lock_type lock_type) { try { if (lock_type == TL_WRITE_CONCURRENT_INSERT || lock_type == TL_WRITE_DEFAULT || lock_type == TL_WRITE) { - trans_register_ha(thd, false, rcbase_hton,NULL); + trans_register_ha(thd, false, rcbase_hton, NULL); if (thd_test_options(thd, OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)) { - trans_register_ha(thd, true, rcbase_hton,NULL); + trans_register_ha(thd, true, rcbase_hton, NULL); } current_txn_ = ha_rcengine_->GetTx(thd); current_txn_->AddTableWRIfNeeded(share); @@ -1133,8 +1132,8 @@ int TianmuHandler::start_stmt(THD *thd, thr_lock_type lock_type) { caching. */ my_bool TianmuHandler::register_query_cache_table(THD *thd, char *table_key, size_t key_length, - qc_engine_callback *call_back, - [[maybe_unused]] ulonglong *engine_data) { + qc_engine_callback *call_back, + [[maybe_unused]] ulonglong *engine_data) { *call_back = rcbase_query_caching_of_table_permitted; return rcbase_query_caching_of_table_permitted(thd, table_key, key_length, 0); } @@ -1178,7 +1177,7 @@ int TianmuHandler::delete_table(const char *name) { Called from opt_range.cc by check_quick_keys(). */ ha_rows TianmuHandler::records_in_range([[maybe_unused]] uint inx, [[maybe_unused]] key_range *min_key, - [[maybe_unused]] key_range *max_key) { + [[maybe_unused]] key_range *max_key) { DBUG_ENTER(__PRETTY_FUNCTION__); DBUG_RETURN(10); // low number to force index usage } @@ -1230,6 +1229,13 @@ int TianmuHandler::truncate() { DBUG_RETURN(ret); } +uint TianmuHandler::max_supported_key_part_length(HA_CREATE_INFO *create_info) const { + if (tianmu_sysvar_large_prefix) + return (Tianmu::common::TIANMU_MAX_INDEX_COL_LEN_LARGE); + else + return (Tianmu::common::TIANMU_MAX_INDEX_COL_LEN_SMALL); +} + int TianmuHandler::fill_row(uchar *buf) { if (table_new_iter == table_new_iter_end) return HA_ERR_END_OF_FILE; @@ -1283,7 +1289,7 @@ char *TianmuHandler::update_table_comment(const char *comment) { int count = std::sprintf(buf, "Overall compression ratio: %.3f, Raw size=%ld MB", ratio, sum_u >> 20); extra_len += count; - str = (char *)my_malloc(PSI_NOT_INSTRUMENTED,length + extra_len + 3, MYF(0)); + str = (char *)my_malloc(PSI_NOT_INSTRUMENTED, length + extra_len + 3, MYF(0)); if (str) { char *pos = str + length; if (length) { @@ -1343,7 +1349,7 @@ int TianmuHandler::set_cond_iter() { ret = 0; } catch (common::Exception const &e) { rc_control_ << system::lock << "Error in push-down execution, push-down execution aborted: " << e.what() - << system::unlock; + << system::unlock; TIANMU_LOG(LogCtl_Level::ERROR, "Error in push-down execution, push-down execution aborted: %s", e.what()); } m_query.reset(); @@ -1359,8 +1365,8 @@ const Item *TianmuHandler::cond_push(const Item *a_cond) { try { if (!m_query) { std::shared_ptr rctp; - ha_rcengine_->GetTableIterator(m_table_name, table_new_iter, table_new_iter_end, rctp, GetAttrsUseIndicator(table), - table->in_use); + ha_rcengine_->GetTableIterator(m_table_name, table_new_iter, table_new_iter_end, rctp, + GetAttrsUseIndicator(table), table->in_use); table_ptr = rctp.get(); m_query.reset(new core::Query(current_txn_)); m_cq.reset(new core::CompiledQuery); @@ -1449,7 +1455,7 @@ int TianmuHandler::reset() { } enum_alter_inplace_result TianmuHandler::check_if_supported_inplace_alter([[maybe_unused]] TABLE *altered_table, - Alter_inplace_info *ha_alter_info) { + Alter_inplace_info *ha_alter_info) { if ((ha_alter_info->handler_flags & ~TIANMU_SUPPORTED_ALTER_ADD_DROP_ORDER) && (ha_alter_info->handler_flags != TIANMU_SUPPORTED_ALTER_COLUMN_NAME)) { return HA_ALTER_ERROR; @@ -1478,8 +1484,8 @@ bool TianmuHandler::inplace_alter_table(TABLE *altered_table, Alter_inplace_info return true; } -bool TianmuHandler::commit_inplace_alter_table([[maybe_unused]] TABLE *altered_table, - Alter_inplace_info *ha_alter_info, bool commit) { +bool TianmuHandler::commit_inplace_alter_table([[maybe_unused]] TABLE *altered_table, Alter_inplace_info *ha_alter_info, + bool commit) { if (!commit) { TIANMU_LOG(LogCtl_Level::INFO, "Alter table failed : %s%s", m_table_name.c_str(), " rollback"); return true; @@ -1518,7 +1524,7 @@ bool TianmuHandler::commit_inplace_alter_table([[maybe_unused]] TABLE *altered_t fs::remove_all(bak_dir); } catch (fs::filesystem_error &e) { TIANMU_LOG(LogCtl_Level::ERROR, "file system error: %s %s|%s", e.what(), e.path1().string().c_str(), - e.path2().string().c_str()); + e.path2().string().c_str()); my_message(static_cast(common::ErrorCode::UNKNOWN_ERROR), "Failed to commit alter table", MYF(0)); return true; } @@ -1529,7 +1535,7 @@ bool TianmuHandler::commit_inplace_alter_table([[maybe_unused]] TABLE *altered_t */ void TianmuHandler::key_convert(const uchar *key, uint key_len, std::vector cols, - std::vector &keys) { + std::vector &keys) { key_restore(table->record[0], (uchar *)key, &table->key_info[active_index], key_len); Field **field = table->field; diff --git a/storage/tianmu/handler/tianmu_handler.h b/storage/tianmu/handler/tianmu_handler.h index 50a99169f..130073e64 100644 --- a/storage/tianmu/handler/tianmu_handler.h +++ b/storage/tianmu/handler/tianmu_handler.h @@ -82,7 +82,8 @@ class TianmuHandler final : public handler { uint max_supported_record_length() const override { return HA_MAX_REC_LENGTH; } uint max_supported_keys() const override { return MAX_INDEXES; } uint max_supported_key_parts() const override { return MAX_REF_PARTS; } - uint max_supported_key_length() const override { return 1024; } + uint max_supported_key_length() const override { return 16 * 1024; } + uint max_supported_key_part_length([[maybe_unused]] HA_CREATE_INFO *create_info) const override; /* Called in test_quick_select to determine if indexes should be used. */ @@ -148,8 +149,8 @@ class TianmuHandler final : public handler { void cond_pop() override {} int reset() override; - my_bool register_query_cache_table(THD *thd, char *table_key, size_t key_length, - qc_engine_callback *engine_callback, ulonglong *engine_data) override; + my_bool register_query_cache_table(THD *thd, char *table_key, size_t key_length, qc_engine_callback *engine_callback, + ulonglong *engine_data) override; void update_create_info(HA_CREATE_INFO *create_info) override; int fill_row_by_id(uchar *buf, uint64_t rowid); void key_convert(const uchar *key, uint key_len, std::vector cols, std::vector &keys); diff --git a/storage/tianmu/handler/tianmu_handler_com.cpp b/storage/tianmu/handler/tianmu_handler_com.cpp index ecb6009f3..1c17cb44a 100644 --- a/storage/tianmu/handler/tianmu_handler_com.cpp +++ b/storage/tianmu/handler/tianmu_handler_com.cpp @@ -19,11 +19,11 @@ #include #include +#include "binlog.h" #include "core/transaction.h" #include "handler/tianmu_handler.h" #include "mm/initializer.h" #include "system/file_out.h" -#include "binlog.h" handlerton *rcbase_hton; @@ -41,10 +41,10 @@ namespace dbhandler { */ my_bool tianmu_bootstrap = 0; -char *strmov_str(char *dst, const char *src) -{ - while ((*dst++ = *src++)) ; - return dst-1; +char *strmov_str(char *dst, const char *src) { + while ((*dst++ = *src++)) + ; + return dst - 1; } static int rcbase_done_func([[maybe_unused]] void *p) { @@ -218,32 +218,32 @@ int rcbase_init_func(void *p) { if (hent) strmov_str(global_hostIP_, inet_ntoa(*(struct in_addr *)(hent->h_addr_list[0]))); my_snprintf(global_serverinfo_, sizeof(global_serverinfo_), "\tServerIp:%s\tServerHostName:%s\tServerPort:%d", global_hostIP_, glob_hostname, mysqld_port); - //startup tianmu engine. + // startup tianmu engine. ha_rcengine_ = new core::Engine(); ret = ha_rcengine_->Init(total_ha); { TIANMU_LOG(LogCtl_Level::INFO, - "\n" - "------------------------------------------------------------" - "----------------------------------" - "-------------\n" - " ###### ######## ####### ## ## ######## ###### " - "###### \n" - " ## ## ## ## ## #### ## ## ## ## " - "## ## \n" - " ## ## ## ## ## ## ## ## ## ## " - "## ## \n" - " ###### ## ## ## ## ## ## ###### ## ## " - "######## \n" - " ## ## ## ## ## #### ## ## ## " - "## ## \n" - " ## ## ## ## ## ## ### ## ## ## " - "## ## \n" - " ###### ## ####### ## ## ######## ###### " - "###### \n" - "------------------------------------------------------------" - "----------------------------------" - "-------------\n"); + "\n" + "------------------------------------------------------------" + "----------------------------------" + "-------------\n" + " ###### ######## ####### ## ## ######## ###### " + "###### \n" + " ## ## ## ## ## #### ## ## ## ## " + "## ## \n" + " ## ## ## ## ## ## ## ## ## ## " + "## ## \n" + " ###### ## ## ## ## ## ## ###### ## ## " + "######## \n" + " ## ## ## ## ## #### ## ## ## " + "## ## \n" + " ## ## ## ## ## ## ### ## ## ## " + "## ## \n" + " ###### ## ####### ## ## ######## ###### " + "###### \n" + "------------------------------------------------------------" + "----------------------------------" + "-------------\n"); } } catch (std::exception &e) { @@ -366,9 +366,10 @@ int get_UpdatePerMinute_StatusVar([[maybe_unused]] MYSQL_THD thd, SHOW_VAR *outv return 0; } -char masteslave_info[8192]={0}; +char masteslave_info[8192] = {0}; -SHOW_VAR tianmu_masterslave_dump[] = {{"info", masteslave_info, SHOW_CHAR, SHOW_SCOPE_UNDEF}, {NullS, NullS, SHOW_LONG, SHOW_SCOPE_UNDEF}}; +SHOW_VAR tianmu_masterslave_dump[] = {{"info", masteslave_info, SHOW_CHAR, SHOW_SCOPE_UNDEF}, + {NullS, NullS, SHOW_LONG, SHOW_SCOPE_UNDEF}}; // showtype // ===================== @@ -377,7 +378,7 @@ SHOW_VAR tianmu_masterslave_dump[] = {{"info", masteslave_info, SHOW_CHAR, SHOW_ // SHOW_ARRAY, SHOW_FUNC, SHOW_DOUBLE int tianmu_throw_error_func([[maybe_unused]] MYSQL_THD thd, [[maybe_unused]] struct st_mysql_sys_var *var, - [[maybe_unused]] void *save, struct st_mysql_value *value) { + [[maybe_unused]] void *save, struct st_mysql_value *value) { int buffer_length = 512; char buff[512] = {0}; @@ -409,7 +410,7 @@ extern void async_join_update(MYSQL_THD thd, struct st_mysql_sys_var *var, void #define STATUS_FUNCTION(name, showtype, member) \ int get_##name##_StatusVar([[maybe_unused]] MYSQL_THD thd, struct st_mysql_show_var *outvar, char *tmp) { \ - *((int64_t *)tmp) = ha_rcengine_->cache.member(); \ + *((int64_t *)tmp) = ha_rcengine_->cache.member(); \ outvar->value = tmp; \ outvar->type = showtype; \ return 0; \ @@ -424,7 +425,7 @@ extern void async_join_update(MYSQL_THD thd, struct st_mysql_sys_var *var, void } #define STATUS_MEMBER(name, label) \ - { "Tianmu_" #label, (char *)get_##name##_StatusVar, SHOW_FUNC, SHOW_SCOPE_UNDEF} + { "Tianmu_" #label, (char *)get_##name##_StatusVar, SHOW_FUNC, SHOW_SCOPE_UNDEF } STATUS_FUNCTION(gdchits, SHOW_LONGLONG, getCacheHits) STATUS_FUNCTION(gdcmisses, SHOW_LONGLONG, getCacheMisses) @@ -521,13 +522,13 @@ static MYSQL_SYSVAR_BOOL(ini_usemysqlimportexportdefaults, tianmu_sysvar_usemysq PLUGIN_VAR_READONLY, "-", NULL, NULL, FALSE); static MYSQL_SYSVAR_INT(ini_threadpoolsize, tianmu_sysvar_threadpoolsize, PLUGIN_VAR_READONLY, "-", NULL, NULL, 1, 0, 1000000, 0); -static MYSQL_SYSVAR_INT(ini_cachesizethreshold, tianmu_sysvar_cachesizethreshold, PLUGIN_VAR_INT, "-", NULL, NULL, 4, - 0, 1024, 0); -static MYSQL_SYSVAR_INT(ini_cachereleasethreshold, tianmu_sysvar_cachereleasethreshold, PLUGIN_VAR_INT, "-", NULL, - NULL, 100, 0, 100000, 0); +static MYSQL_SYSVAR_INT(ini_cachesizethreshold, tianmu_sysvar_cachesizethreshold, PLUGIN_VAR_INT, "-", NULL, NULL, 4, 0, + 1024, 0); +static MYSQL_SYSVAR_INT(ini_cachereleasethreshold, tianmu_sysvar_cachereleasethreshold, PLUGIN_VAR_INT, "-", NULL, NULL, + 100, 0, 100000, 0); static MYSQL_SYSVAR_BOOL(insert_delayed, tianmu_sysvar_insert_delayed, PLUGIN_VAR_READONLY, "-", NULL, NULL, TRUE); -static MYSQL_SYSVAR_INT(insert_cntthreshold, tianmu_sysvar_insert_cntthreshold, PLUGIN_VAR_READONLY, "-", NULL, NULL, - 2, 0, 1000, 0); +static MYSQL_SYSVAR_INT(insert_cntthreshold, tianmu_sysvar_insert_cntthreshold, PLUGIN_VAR_READONLY, "-", NULL, NULL, 2, + 0, 1000, 0); static MYSQL_SYSVAR_INT(insert_numthreshold, tianmu_sysvar_insert_numthreshold, PLUGIN_VAR_READONLY, "-", NULL, NULL, 10000, 0, 100000, 0); static MYSQL_SYSVAR_INT(insert_wait_ms, tianmu_sysvar_insert_wait_ms, PLUGIN_VAR_READONLY, "-", NULL, NULL, 100, 10, @@ -536,8 +537,7 @@ static MYSQL_SYSVAR_INT(insert_wait_time, tianmu_sysvar_insert_wait_time, PLUGIN 600000, 0); static MYSQL_SYSVAR_INT(insert_max_buffered, tianmu_sysvar_insert_max_buffered, PLUGIN_VAR_READONLY, "-", NULL, NULL, 65536, 0, 10000000, 0); -static MYSQL_SYSVAR_BOOL(compensation_start, tianmu_sysvar_compensation_start, PLUGIN_VAR_BOOL, "-", NULL, NULL, - FALSE); +static MYSQL_SYSVAR_BOOL(compensation_start, tianmu_sysvar_compensation_start, PLUGIN_VAR_BOOL, "-", NULL, NULL, FALSE); static MYSQL_SYSVAR_STR(hugefiledir, tianmu_sysvar_hugefiledir, PLUGIN_VAR_READONLY, "-", NULL, NULL, ""); static MYSQL_SYSVAR_INT(cachinglevel, tianmu_sysvar_cachinglevel, PLUGIN_VAR_READONLY, "-", NULL, NULL, 1, 0, 512, 0); static MYSQL_SYSVAR_STR(mm_policy, tianmu_sysvar_mm_policy, PLUGIN_VAR_READONLY, "-", NULL, NULL, ""); @@ -549,13 +549,12 @@ static MYSQL_SYSVAR_INT(mm_largetemppool_threshold, tianmu_sysvar_mm_large_thres "size threshold in MB for using large temp thread pool", NULL, NULL, 16, 0, 10240, 0); static MYSQL_SYSVAR_INT(sync_buffers, tianmu_sysvar_sync_buffers, PLUGIN_VAR_READONLY, "-", NULL, NULL, 0, 0, 1, 0); -static MYSQL_SYSVAR_INT(query_threads, tianmu_sysvar_query_threads, PLUGIN_VAR_READONLY, "-", NULL, NULL, 0, 0, 100, - 0); +static MYSQL_SYSVAR_INT(query_threads, tianmu_sysvar_query_threads, PLUGIN_VAR_READONLY, "-", NULL, NULL, 0, 0, 100, 0); static MYSQL_SYSVAR_INT(load_threads, tianmu_sysvar_load_threads, PLUGIN_VAR_READONLY, "-", NULL, NULL, 0, 0, 100, 0); -static MYSQL_SYSVAR_INT(bg_load_threads, tianmu_sysvar_bg_load_threads, PLUGIN_VAR_READONLY, "-", NULL, NULL, 0, 0, - 100, 0); -static MYSQL_SYSVAR_INT(insert_buffer_size, tianmu_sysvar_insert_buffer_size, PLUGIN_VAR_READONLY, "-", NULL, NULL, - 512, 512, 10000, 0); +static MYSQL_SYSVAR_INT(bg_load_threads, tianmu_sysvar_bg_load_threads, PLUGIN_VAR_READONLY, "-", NULL, NULL, 0, 0, 100, + 0); +static MYSQL_SYSVAR_INT(insert_buffer_size, tianmu_sysvar_insert_buffer_size, PLUGIN_VAR_READONLY, "-", NULL, NULL, 512, + 512, 10000, 0); static MYSQL_THDVAR_INT(session_debug_level, PLUGIN_VAR_INT, "session debug level", NULL, debug_update, 3, 0, 5, 0); static MYSQL_THDVAR_INT(control_trace, PLUGIN_VAR_OPCMDARG, "ini controltrace", NULL, trace_update, 0, 0, 100, 0); @@ -611,7 +610,10 @@ static MYSQL_SYSVAR_BOOL(join_disable_switch_side, tianmu_sysvar_join_disable_sw NULL, FALSE); static MYSQL_SYSVAR_BOOL(enable_histogram_cmap_bloom, tianmu_sysvar_enable_histogram_cmap_bloom, PLUGIN_VAR_BOOL, "-", NULL, NULL, FALSE); - +static MYSQL_SYSVAR_BOOL(large_prefix, tianmu_sysvar_large_prefix, PLUGIN_VAR_RQCMDARG, + "Support large index prefix length of 3072 bytes. If off, the maximum " + "index prefix length is 767.", + NULL, NULL, FALSE); static MYSQL_SYSVAR_UINT(result_sender_rows, tianmu_sysvar_result_sender_rows, PLUGIN_VAR_UNSIGNED, "The number of rows to load at a time when processing " "queries like select xxx from yyya", @@ -678,63 +680,64 @@ void async_join_update([[maybe_unused]] MYSQL_THD thd, [[maybe_unused]] struct s } static struct st_mysql_sys_var *tianmu_showvars[] = {MYSQL_SYSVAR(bg_load_threads), - MYSQL_SYSVAR(cachinglevel), - MYSQL_SYSVAR(compensation_start), - MYSQL_SYSVAR(control_trace), - MYSQL_SYSVAR(data_distribution_policy), - MYSQL_SYSVAR(disk_usage_threshold), - MYSQL_SYSVAR(distinct_cache_size), - MYSQL_SYSVAR(filterevaluation_speedup), - MYSQL_SYSVAR(global_debug_level), - MYSQL_SYSVAR(groupby_speedup), - MYSQL_SYSVAR(hugefiledir), - MYSQL_SYSVAR(index_cache_size), - MYSQL_SYSVAR(index_search), - MYSQL_SYSVAR(enable_rowstore), - MYSQL_SYSVAR(ini_allowmysqlquerypath), - MYSQL_SYSVAR(ini_cachefolder), - MYSQL_SYSVAR(ini_cachereleasethreshold), - MYSQL_SYSVAR(ini_cachesizethreshold), - MYSQL_SYSVAR(ini_controlquerylog), - MYSQL_SYSVAR(ini_knlevel), - MYSQL_SYSVAR(ini_pushdown), - MYSQL_SYSVAR(ini_servermainheapsize), - MYSQL_SYSVAR(ini_threadpoolsize), - MYSQL_SYSVAR(ini_usemysqlimportexportdefaults), - MYSQL_SYSVAR(insert_buffer_size), - MYSQL_SYSVAR(insert_cntthreshold), - MYSQL_SYSVAR(insert_delayed), - MYSQL_SYSVAR(insert_max_buffered), - MYSQL_SYSVAR(insert_numthreshold), - MYSQL_SYSVAR(insert_wait_ms), - MYSQL_SYSVAR(insert_wait_time), - MYSQL_SYSVAR(join_disable_switch_side), - MYSQL_SYSVAR(enable_histogram_cmap_bloom), - MYSQL_SYSVAR(join_parallel), - MYSQL_SYSVAR(join_splitrows), - MYSQL_SYSVAR(load_threads), - MYSQL_SYSVAR(lookup_max_size), - MYSQL_SYSVAR(max_execution_time), - MYSQL_SYSVAR(minmax_speedup), - MYSQL_SYSVAR(mm_hardlimit), - MYSQL_SYSVAR(mm_largetempratio), - MYSQL_SYSVAR(mm_largetemppool_threshold), - MYSQL_SYSVAR(mm_policy), - MYSQL_SYSVAR(mm_releasepolicy), - MYSQL_SYSVAR(orderby_speedup), - MYSQL_SYSVAR(parallel_filloutput), - MYSQL_SYSVAR(parallel_mapjoin), - MYSQL_SYSVAR(qps_log), - MYSQL_SYSVAR(query_threads), - MYSQL_SYSVAR(refresh_sys_tianmu), - MYSQL_SYSVAR(session_debug_level), - MYSQL_SYSVAR(sync_buffers), - MYSQL_SYSVAR(trigger_error), - MYSQL_SYSVAR(async_join), - MYSQL_SYSVAR(force_hashjoin), - MYSQL_SYSVAR(start_async), - MYSQL_SYSVAR(result_sender_rows), - NULL}; + MYSQL_SYSVAR(cachinglevel), + MYSQL_SYSVAR(compensation_start), + MYSQL_SYSVAR(control_trace), + MYSQL_SYSVAR(data_distribution_policy), + MYSQL_SYSVAR(disk_usage_threshold), + MYSQL_SYSVAR(distinct_cache_size), + MYSQL_SYSVAR(filterevaluation_speedup), + MYSQL_SYSVAR(global_debug_level), + MYSQL_SYSVAR(groupby_speedup), + MYSQL_SYSVAR(hugefiledir), + MYSQL_SYSVAR(index_cache_size), + MYSQL_SYSVAR(index_search), + MYSQL_SYSVAR(enable_rowstore), + MYSQL_SYSVAR(ini_allowmysqlquerypath), + MYSQL_SYSVAR(ini_cachefolder), + MYSQL_SYSVAR(ini_cachereleasethreshold), + MYSQL_SYSVAR(ini_cachesizethreshold), + MYSQL_SYSVAR(ini_controlquerylog), + MYSQL_SYSVAR(ini_knlevel), + MYSQL_SYSVAR(ini_pushdown), + MYSQL_SYSVAR(ini_servermainheapsize), + MYSQL_SYSVAR(ini_threadpoolsize), + MYSQL_SYSVAR(ini_usemysqlimportexportdefaults), + MYSQL_SYSVAR(insert_buffer_size), + MYSQL_SYSVAR(insert_cntthreshold), + MYSQL_SYSVAR(insert_delayed), + MYSQL_SYSVAR(insert_max_buffered), + MYSQL_SYSVAR(insert_numthreshold), + MYSQL_SYSVAR(insert_wait_ms), + MYSQL_SYSVAR(insert_wait_time), + MYSQL_SYSVAR(join_disable_switch_side), + MYSQL_SYSVAR(enable_histogram_cmap_bloom), + MYSQL_SYSVAR(join_parallel), + MYSQL_SYSVAR(join_splitrows), + MYSQL_SYSVAR(large_prefix), + MYSQL_SYSVAR(load_threads), + MYSQL_SYSVAR(lookup_max_size), + MYSQL_SYSVAR(max_execution_time), + MYSQL_SYSVAR(minmax_speedup), + MYSQL_SYSVAR(mm_hardlimit), + MYSQL_SYSVAR(mm_largetempratio), + MYSQL_SYSVAR(mm_largetemppool_threshold), + MYSQL_SYSVAR(mm_policy), + MYSQL_SYSVAR(mm_releasepolicy), + MYSQL_SYSVAR(orderby_speedup), + MYSQL_SYSVAR(parallel_filloutput), + MYSQL_SYSVAR(parallel_mapjoin), + MYSQL_SYSVAR(qps_log), + MYSQL_SYSVAR(query_threads), + MYSQL_SYSVAR(refresh_sys_tianmu), + MYSQL_SYSVAR(session_debug_level), + MYSQL_SYSVAR(sync_buffers), + MYSQL_SYSVAR(trigger_error), + MYSQL_SYSVAR(async_join), + MYSQL_SYSVAR(force_hashjoin), + MYSQL_SYSVAR(start_async), + MYSQL_SYSVAR(result_sender_rows), + NULL}; } // namespace dbhandler } // namespace Tianmu @@ -748,8 +751,8 @@ mysql_declare_plugin(tianmu){ Tianmu::dbhandler::rcbase_init_func, /* Plugin Init */ Tianmu::dbhandler::rcbase_done_func, /* Plugin Deinit */ 0x0001 /* 0.1 */, - Tianmu::dbhandler::statusvars, /* status variables */ + Tianmu::dbhandler::statusvars, /* status variables */ Tianmu::dbhandler::tianmu_showvars, /* system variables */ - NULL, /* config options */ - 0 /* flags for plugin */ + NULL, /* config options */ + 0 /* flags for plugin */ } mysql_declare_plugin_end; diff --git a/storage/tianmu/system/configuration.cpp b/storage/tianmu/system/configuration.cpp index 8647197d5..0ae31eb59 100644 --- a/storage/tianmu/system/configuration.cpp +++ b/storage/tianmu/system/configuration.cpp @@ -65,6 +65,7 @@ my_bool tianmu_sysvar_orderby_speedup; my_bool tianmu_sysvar_parallel_filloutput; my_bool tianmu_sysvar_parallel_mapjoin; my_bool tianmu_sysvar_qps_log; +my_bool tianmu_sysvar_large_prefix; unsigned int tianmu_sysvar_lookup_max_size; unsigned long tianmu_sysvar_dist_policy; char tianmu_sysvar_force_hashjoin; diff --git a/storage/tianmu/system/configuration.h b/storage/tianmu/system/configuration.h index c2e77de57..b3fca5de5 100644 --- a/storage/tianmu/system/configuration.h +++ b/storage/tianmu/system/configuration.h @@ -32,6 +32,7 @@ extern char tianmu_sysvar_parallel_mapjoin; extern char tianmu_sysvar_pushdown; extern char tianmu_sysvar_qps_log; extern char tianmu_sysvar_refresh_sys_table; +extern char tianmu_sysvar_large_prefix; extern char tianmu_sysvar_usemysqlimportexportdefaults; extern char *tianmu_sysvar_cachefolder; extern char *tianmu_sysvar_hugefiledir;