1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-10-31 18:30:33 +03:00

MCOL-6018: cleanup stacks on error

This commit is contained in:
Leonid Fedorov
2025-08-15 01:29:20 +00:00
committed by Leonid Fedorov
parent 578c2b1db1
commit 56d04cb711
4 changed files with 11 additions and 7 deletions

View File

@@ -2223,8 +2223,10 @@ void setError(THD* thd, uint32_t errcode, string errmsg)
ci->expressionId = 0;
}
void setError(THD* thd, uint32_t errcode, string errmsg, gp_walk_info& /*gwi*/)
void setError(THD* thd, uint32_t errcode, string errmsg, gp_walk_info& gwi)
{
// Clean up any allocated objects in the work stacks to prevent memory leaks
clearDeleteStacks(gwi);
setError(thd, errcode, errmsg);
}
@@ -2236,6 +2238,8 @@ int setErrorAndReturn(gp_walk_info& gwi)
// processing.
if (gwi.thd->derived_tables_processing)
{
// Clean up work stacks even for derived table processing to prevent leaks
clearDeleteStacks(gwi);
gwi.cs_vtable_is_update_with_derive = true;
return -1;
}
@@ -7126,7 +7130,7 @@ int getSelectPlan(gp_walk_info& gwi, SELECT_LEX& select_lex, SCSEP& csep, bool i
if (funcFieldVec.size() != 0 && !gwi.fatalParseError)
{
string emsg("Fatal parse error in vtable mode: Unsupported Items in union or sub select unit");
setError(gwi.thd, ER_CHECK_NOT_IMPLEMENTED, emsg);
setError(gwi.thd, ER_CHECK_NOT_IMPLEMENTED, emsg, gwi);
return ER_CHECK_NOT_IMPLEMENTED;
}
}

View File

@@ -980,7 +980,7 @@ void parse_item(Item* item, vector<Item_field*>& field_vec, bool& hasNonSupportI
// ERR_CORRELATED_SUB_OR
string parseErrorText =
logging::IDBErrorInfo::instance()->errorMsg(logging::ERR_NON_SUPPORT_SUB_QUERY_TYPE);
setError(gwi->thd, ER_CHECK_NOT_IMPLEMENTED, parseErrorText);
setError(gwi->thd, ER_CHECK_NOT_IMPLEMENTED, parseErrorText, *gwi);
break;
}

View File

@@ -424,7 +424,7 @@ int cs_get_select_plan(ha_columnstore_select_handler* handler, THD* thd, execpla
int getSelectPlan(gp_walk_info& gwi, SELECT_LEX& select_lex, execplan::SCSEP& csep, bool isUnion = false,
bool isSelectHandlerTop = false, bool isSelectLexUnit = false,
const std::vector<COND*>& condStack = std::vector<COND*>());
void setError(THD* thd, uint32_t errcode, const std::string errmsg, gp_walk_info* gwi);
void setError(THD* thd, uint32_t errcode, const std::string errmsg, gp_walk_info& gwi);
void setError(THD* thd, uint32_t errcode, const std::string errmsg);
void gp_walk(const Item* item, void* arg);
void clearDeleteStacks(gp_walk_info& gwi);

View File

@@ -61,13 +61,13 @@ ReturnedColumn* nullOnError(gp_walk_info& gwi)
if (gwi.hasSubSelect)
{
gwi.parseErrorText = logging::IDBErrorInfo::instance()->errorMsg(logging::ERR_NON_SUPPORT_SELECT_SUB);
setError(gwi.thd, ER_CHECK_NOT_IMPLEMENTED, gwi.parseErrorText);
setError(gwi.thd, ER_CHECK_NOT_IMPLEMENTED, gwi.parseErrorText, gwi);
}
if (gwi.parseErrorText.empty())
{
gwi.parseErrorText = logging::IDBErrorInfo::instance()->errorMsg(logging::ERR_WF_NON_SUPPORT);
setError(gwi.thd, ER_CHECK_NOT_IMPLEMENTED, gwi.parseErrorText);
setError(gwi.thd, ER_CHECK_NOT_IMPLEMENTED, gwi.parseErrorText, gwi);
}
return NULL;
@@ -879,7 +879,7 @@ ReturnedColumn* buildWindowFunctionColumn(Item* item, gp_walk_info& gwi, bool& n
if (gwi.parseErrorText.empty())
gwi.parseErrorText = logging::IDBErrorInfo::instance()->errorMsg(logging::ERR_WF_NON_SUPPORT);
setError(gwi.thd, ER_CHECK_NOT_IMPLEMENTED, gwi.parseErrorText);
setError(gwi.thd, ER_CHECK_NOT_IMPLEMENTED, gwi.parseErrorText, gwi);
return NULL;
}
#if 0