From a893463835a8cecf73ee13d5e6cf4fd5e2b00815 Mon Sep 17 00:00:00 2001 From: lujiashun Date: Wed, 19 Oct 2022 15:20:43 +0800 Subject: [PATCH] feat(StoneDB 8.0): support view query, port mtr "issue342". (#743) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [summary] 1 replace original_field_name function instead of get_result_field,compare with function strcmp; 2 remove unused variable tianmu_bootstrap; 3 eliminate some compile warning; --- mysql-test/suite/tianmu/r/issue342.result | 8 ++++---- .../suite/tianmu/t/{issue342.testbak => issue342.test} | 8 ++++---- storage/tianmu/core/query_compile.cpp | 2 +- storage/tianmu/handler/ha_my_tianmu.cpp | 8 ++++---- storage/tianmu/handler/ha_my_tianmu.h | 2 +- storage/tianmu/handler/ha_tianmu.cpp | 10 ---------- 6 files changed, 14 insertions(+), 24 deletions(-) rename mysql-test/suite/tianmu/t/{issue342.testbak => issue342.test} (97%) diff --git a/mysql-test/suite/tianmu/r/issue342.result b/mysql-test/suite/tianmu/r/issue342.result index fc905eaf8a..efa78e1c3b 100644 --- a/mysql-test/suite/tianmu/r/issue342.result +++ b/mysql-test/suite/tianmu/r/issue342.result @@ -1,9 +1,9 @@ USE test; CREATE TABLE `lineitem_i342` ( -`l_orderkey` int(11) NOT NULL, -`l_partkey` int(11) NOT NULL, -`l_suppkey` int(11) NOT NULL, -`l_linenumber` int(11) NOT NULL, +`l_orderkey` int NOT NULL, +`l_partkey` int NOT NULL, +`l_suppkey` int NOT NULL, +`l_linenumber` int NOT NULL, `l_quantity` decimal(15,2) NOT NULL, `l_extendedprice` decimal(15,2) NOT NULL, `l_discount` decimal(15,2) NOT NULL, diff --git a/mysql-test/suite/tianmu/t/issue342.testbak b/mysql-test/suite/tianmu/t/issue342.test similarity index 97% rename from mysql-test/suite/tianmu/t/issue342.testbak rename to mysql-test/suite/tianmu/t/issue342.test index 103c3caa64..ab9b4f40f9 100644 --- a/mysql-test/suite/tianmu/t/issue342.testbak +++ b/mysql-test/suite/tianmu/t/issue342.test @@ -1,9 +1,9 @@ USE test; CREATE TABLE `lineitem_i342` ( -`l_orderkey` int(11) NOT NULL, -`l_partkey` int(11) NOT NULL, -`l_suppkey` int(11) NOT NULL, -`l_linenumber` int(11) NOT NULL, +`l_orderkey` int NOT NULL, +`l_partkey` int NOT NULL, +`l_suppkey` int NOT NULL, +`l_linenumber` int NOT NULL, `l_quantity` decimal(15,2) NOT NULL, `l_extendedprice` decimal(15,2) NOT NULL, `l_discount` decimal(15,2) NOT NULL, diff --git a/storage/tianmu/core/query_compile.cpp b/storage/tianmu/core/query_compile.cpp index 778e686ae6..d74611d9bc 100644 --- a/storage/tianmu/core/query_compile.cpp +++ b/storage/tianmu/core/query_compile.cpp @@ -267,7 +267,7 @@ bool Query::FieldUnmysterify(Item *item, TabID &tab, AttrID &col) { // Physical table in FROM - RCTable int field_num; for (field_num = 0; mysql_table->field[field_num]; field_num++) - if (mysql_table->field[field_num]->field_name == ifield->get_result_field()->field_name) break; + if (std::strcmp(mysql_table->field[field_num]->field_name, ifield->original_field_name()) == 0) break; if (!mysql_table->field[field_num]) continue; col = AttrID(field_num); return true; diff --git a/storage/tianmu/handler/ha_my_tianmu.cpp b/storage/tianmu/handler/ha_my_tianmu.cpp index 2974a49035..c2ab4969e2 100644 --- a/storage/tianmu/handler/ha_my_tianmu.cpp +++ b/storage/tianmu/handler/ha_my_tianmu.cpp @@ -96,9 +96,9 @@ Query_route_to Tianmu_Handle_Query(THD *thd, Query_expression *qe, Query_result if (ret == DBHandler::Query_route_to::TO_MYSQL && AtLeastOneTianmuTableInvolved(qe) && ForbiddenMySQLQueryPath(qe)) { my_message(static_cast(common::ErrorCode::UNKNOWN_ERROR), - "The query includes syntax that is not supported by the storage engine. \ - Either restructure the query with supported syntax, or enable the MySQL core::Query Path \ - in config file to execute the query with reduced performance.", + "The query includes syntax that is not supported by the storage engine. " + "Either restructure the query with supported syntax, or enable the MySQL core::Query Path " + "in config file to execute the query with reduced performance.", MYF(0)); ret = Query_route_to::TO_TIANMU; } @@ -165,6 +165,6 @@ bool Tianmu_Load(THD *thd, sql_exchange *ex, TABLE_LIST *table_list, void *arg) return false; } -bool Tianmu_Get_Insert_Delayed_Flag(THD *thd) { return tianmu_sysvar_insert_delayed; } +bool Tianmu_Get_Insert_Delayed_Flag([[maybe_unused]] THD *thd) { return tianmu_sysvar_insert_delayed; } } // namespace DBHandler } // namespace Tianmu diff --git a/storage/tianmu/handler/ha_my_tianmu.h b/storage/tianmu/handler/ha_my_tianmu.h index abcf9fb78c..bc6fbd8133 100644 --- a/storage/tianmu/handler/ha_my_tianmu.h +++ b/storage/tianmu/handler/ha_my_tianmu.h @@ -38,7 +38,7 @@ void Tianmu_UpdateAndStoreColumnComment(TABLE *table, int field_id, Field *sourc // processing the load operation. bool Tianmu_Load(THD *thd, sql_exchange *ex, TABLE_LIST *table_list, void *arg); -bool Tianmu_Get_Insert_Delayed_Flag(THD *thd); +bool Tianmu_Get_Insert_Delayed_Flag([[maybe_unused]] THD *thd); } // namespace DBHandler } // namespace Tianmu diff --git a/storage/tianmu/handler/ha_tianmu.cpp b/storage/tianmu/handler/ha_tianmu.cpp index 15d207b555..8a76f7d29e 100644 --- a/storage/tianmu/handler/ha_tianmu.cpp +++ b/storage/tianmu/handler/ha_tianmu.cpp @@ -45,8 +45,6 @@ namespace Tianmu { namespace DBHandler { -extern bool tianmu_bootstrap = 0; - char *strmov_str(char *dst, const char *src) { while ((*dst++ = *src++)) ; @@ -1714,8 +1712,6 @@ handler *rcbase_create_handler(handlerton *hton, TABLE_SHARE *table, bool partit } int rcbase_panic_func([[maybe_unused]] handlerton *hton, enum ha_panic_function flag) { - if (tianmu_bootstrap) return 0; - if (flag == HA_PANIC_CLOSE) { delete ha_rcengine_; ha_rcengine_ = nullptr; @@ -1823,8 +1819,6 @@ bool rcbase_show_status([[maybe_unused]] handlerton *hton, THD *thd, stat_print_ return false; } -extern bool tianmu_bootstrap; - static int init_variables() { opt_binlog_order_commits = false; return 0; @@ -1857,10 +1851,6 @@ int rcbase_init_func(void *p) { tianmu_hton->show_status = rcbase_show_status; tianmu_hton->file_extensions = ha_tianmu_exts; - // When mysqld runs as bootstrap mode, we do not need to initialize - // memmanager. - if (tianmu_bootstrap) DBUG_RETURN(0); - int ret = 1; ha_rcengine_ = nullptr;