Skip to content

Commit

Permalink
feat(StoneDB 8.0): support view query, port mtr "issue342". (stoneato…
Browse files Browse the repository at this point in the history
…m#743)

[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;
  • Loading branch information
lujiashun committed Oct 19, 2022
1 parent da23ed2 commit a893463
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 24 deletions.
8 changes: 4 additions & 4 deletions mysql-test/suite/tianmu/r/issue342.result
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
2 changes: 1 addition & 1 deletion storage/tianmu/core/query_compile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
8 changes: 4 additions & 4 deletions storage/tianmu/handler/ha_my_tianmu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<int>(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;
}
Expand Down Expand Up @@ -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
2 changes: 1 addition & 1 deletion storage/tianmu/handler/ha_my_tianmu.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 0 additions & 10 deletions storage/tianmu/handler/ha_tianmu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@
namespace Tianmu {
namespace DBHandler {

extern bool tianmu_bootstrap = 0;

char *strmov_str(char *dst, const char *src) {
while ((*dst++ = *src++))
;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;

Expand Down

0 comments on commit a893463

Please sign in to comment.