Skip to content

Commit

Permalink
fix(StoneDB 8.0): fix ERROR 2013 (HY000): Lost connection to MySQL se…
Browse files Browse the repository at this point in the history
…rver during query. (stoneatom#650)

[summary]
1 cause reason: tianmu load construct Sql_cmd_load_table itself, but not assign it to thd->lex->m_sql_cmd;
2 thd->lex->m_sql_cmd(nullptr) is used later, so crashed;
  • Loading branch information
lujiashun committed Oct 9, 2022
1 parent 0572d99 commit 47c89a1
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions storage/tianmu/core/engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1148,12 +1148,14 @@ static void HandleDelayedLoad(int tid, std::vector<std::unique_ptr<char[]>> &vec
thd->lex->query_tables = &tl;
LEX_STRING lex_str = {const_cast<char *>(ex.file_name), addr.size()};

auto cmd = new (thd->mem_root)
thd->lex->m_sql_cmd = new (thd->mem_root)
Sql_cmd_load_table(ex.filetype, false, lex_str, On_duplicate::ERROR, nullptr, nullptr, nullptr, nullptr, ex.field,
ex.line, ex.skip_lines, nullptr, nullptr, nullptr, nullptr);
if (cmd->execute(thd)) {

if (thd->lex->m_sql_cmd->execute(thd)) {
thd->is_slave_error = 1;
}

// stonedb8 end

thd->set_catalog({0, 1}); // TIANMU UPGRADE
Expand Down

0 comments on commit 47c89a1

Please sign in to comment.