Skip to content

Commit

Permalink
fix(tianmu):EXPLAIN query Q4, MySQL server has gone away (#727)
Browse files Browse the repository at this point in the history
Eplain query Q4 lead to crash,because assert(join == NULL) in SELECT_LEX::optimize() function.
the root cause is that the new join is not released. we can use sl->cleanup(true) to release it
  • Loading branch information
DandreChen authored and mergify[bot] committed Oct 26, 2022
1 parent 7a9dfb3 commit e61f3da
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions storage/tianmu/core/query_compile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1101,11 +1101,8 @@ int Query::Compile(CompiledQuery *compiled_query, SELECT_LEX *selects_list, SELE
cq = saved_cq;
if (cond_to_reinsert && list_to_reinsert)
list_to_reinsert->push_back(cond_to_reinsert);
sl->cleanup(0);
if (ifNewJoinForTianmu) {
delete sl->join;
sl->join = nullptr;
}
if (ifNewJoinForTianmu)
sl->cleanup(true);
return RETURN_QUERY_TO_MYSQL_ROUTE;
}

Expand All @@ -1127,11 +1124,8 @@ int Query::Compile(CompiledQuery *compiled_query, SELECT_LEX *selects_list, SELE
union_all = true;
if (cond_to_reinsert && list_to_reinsert)
list_to_reinsert->push_back(cond_to_reinsert);
sl->cleanup(0);
if (ifNewJoinForTianmu) {
delete sl->join;
sl->join = nullptr;
}
if (ifNewJoinForTianmu)
sl->cleanup(true);
}

cq->BuildTableIDStepsMap();
Expand Down

0 comments on commit e61f3da

Please sign in to comment.