Skip to content

Commit

Permalink
fix(tianmu):EXPLAIN query Q4, MySQL server has gone away (stoneatom#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 committed Oct 25, 2022
1 parent 7a9dfb3 commit 20be465
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions storage/tianmu/core/query_compile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1101,11 +1101,7 @@ 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 +1123,7 @@ 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 20be465

Please sign in to comment.