You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-08-01 06:46:55 +03:00
MCOL-2178 CS now doesn't initiate a scan when MDB explicitly set scan to false in rnd_init().
sortItemIsInGroupRec() now has a base case for Item_Field and this prevents unbound recursion. Fixes fromSub() call with incorrect number of arguments. CS now doesn't ask for statistics unless a user explicitly asks for it using calsettrace().
This commit is contained in:
committed by
Gagan Goel
parent
a9c72675ba
commit
7d5275e1bd
@ -527,7 +527,11 @@ int ha_calpont::rnd_init(bool scan)
|
||||
{
|
||||
DBUG_ENTER("ha_calpont::rnd_init");
|
||||
|
||||
int rc = ha_calpont_impl_rnd_init(table);
|
||||
int rc = 0;
|
||||
if(scan)
|
||||
{
|
||||
rc = ha_calpont_impl_rnd_init(table);
|
||||
}
|
||||
|
||||
DBUG_RETURN(rc);
|
||||
}
|
||||
|
@ -273,6 +273,10 @@ bool sortItemIsInGroupRec(Item* sort_item, Item* group_item)
|
||||
Item_ref* ifp_sort_ref = reinterpret_cast<Item_ref*>(sort_item);
|
||||
found = sortItemIsInGroupRec(*ifp_sort_ref->ref, group_item);
|
||||
}
|
||||
else if (!found && sort_item->type() == Item::FIELD_ITEM)
|
||||
{
|
||||
return found;
|
||||
}
|
||||
|
||||
// seeking for a group_item match
|
||||
for (uint32_t i = 0; !found && i < ifp_sort->argument_count(); i++)
|
||||
@ -6085,7 +6089,7 @@ int getSelectPlan(gp_walk_info& gwi, SELECT_LEX& select_lex,
|
||||
(table_ptr->derived->first_select())->print(gwi.thd, &str, QT_ORDINARY);
|
||||
|
||||
SELECT_LEX* select_cursor = table_ptr->derived->first_select();
|
||||
FromSubQuery fromSub(gwi, select_cursor, false, isPushdownHand);
|
||||
FromSubQuery fromSub(gwi, select_cursor, isPushdownHand);
|
||||
string alias(table_ptr->alias.str);
|
||||
fromSub.alias(lower(alias));
|
||||
|
||||
|
@ -3062,7 +3062,10 @@ int ha_calpont_impl_rnd_end(TABLE* table, bool is_pushdown_hand)
|
||||
|
||||
try
|
||||
{
|
||||
sm::tpl_close(ti.tpl_ctx, &hndl, ci->stats);
|
||||
{
|
||||
bool ask_4_stats = (ci->traceFlags) ? true : false;
|
||||
sm::tpl_close(ti.tpl_ctx, &hndl, ci->stats, ask_4_stats);
|
||||
}
|
||||
|
||||
// set conn hndl back. could be changed in tpl_close
|
||||
if (MIGR::infinidb_vtable.vtable_state == MIGR::INFINIDB_DISABLE_VTABLE)
|
||||
@ -5124,7 +5127,10 @@ int ha_calpont_impl_group_by_end(ha_calpont_group_by_handler* group_hand, TABLE*
|
||||
{
|
||||
if(hndl)
|
||||
{
|
||||
sm::tpl_close(ti.tpl_ctx, &hndl, ci->stats, clearScanCtx);
|
||||
{
|
||||
bool ask_4_stats = (ci->traceFlags) ? true : false;
|
||||
sm::tpl_close(ti.tpl_ctx, &hndl, ci->stats, ask_4_stats, clearScanCtx);
|
||||
}
|
||||
// Normaly stats variables are set in external_lock method but we set it here
|
||||
// since they we pretend we are in vtable_disabled mode and the stats vars won't be set.
|
||||
// We sum the stats up here since server could run a number of
|
||||
|
@ -373,17 +373,16 @@ status_t
|
||||
tpl_close ( cpsm_tplh_t* ntplh,
|
||||
cpsm_conhdl_t** conn_hdl,
|
||||
QueryStats& stats,
|
||||
bool ask_4_stats,
|
||||
bool clear_scan_ctx)
|
||||
{
|
||||
cpsm_conhdl_t* hndl = *conn_hdl;
|
||||
#if IDB_SM_DEBUG
|
||||
SMDEBUGLOG << "tpl_close: hndl" << hndl << " ntplh " << ntplh;
|
||||
|
||||
if (ntplh)
|
||||
SMDEBUGLOG << " tableid: " << ntplh->tableid;
|
||||
|
||||
SMDEBUGLOG << endl;
|
||||
#endif
|
||||
delete ntplh;
|
||||
|
||||
// determine end of result set and end of statement execution
|
||||
@ -391,57 +390,60 @@ tpl_close ( cpsm_tplh_t* ntplh,
|
||||
{
|
||||
// Get the query stats
|
||||
ByteStream bs;
|
||||
ByteStream::quadbyte qb = 3;
|
||||
bs << qb;
|
||||
hndl->write(bs);
|
||||
|
||||
// Ask for a stats only if a user explicitly asks
|
||||
if(ask_4_stats)
|
||||
{
|
||||
ByteStream::quadbyte qb = 3;
|
||||
bs << qb;
|
||||
hndl->write(bs);
|
||||
}
|
||||
// MCOL-1601 Dispose of unused empty RowGroup
|
||||
if (clear_scan_ctx)
|
||||
{
|
||||
std::cout << "tpl_close() clear_scan_ctx read" << std::endl;
|
||||
bs = hndl->exeMgr->read();
|
||||
}
|
||||
|
||||
#if IDB_SM_DEBUG
|
||||
SMDEBUGLOG << "tpl_close hndl->exeMgr: " << hndl->exeMgr << endl;
|
||||
#endif
|
||||
//keep reading until we get a string
|
||||
//TODO: really need to fix this! Why is ExeMgr sending other stuff?
|
||||
for (int tries = 0; tries < 10; tries++)
|
||||
// Ask for a stats only if a user explicitly asks
|
||||
if(ask_4_stats)
|
||||
{
|
||||
bs = hndl->exeMgr->read();
|
||||
for (int tries = 0; tries < 10; tries++)
|
||||
{
|
||||
bs = hndl->exeMgr->read();
|
||||
|
||||
if (bs.length() == 0) break;
|
||||
if (bs.length() == 0) break;
|
||||
|
||||
try
|
||||
{
|
||||
bs >> hndl->queryStats;
|
||||
bs >> hndl->extendedStats;
|
||||
bs >> hndl->miniStats;
|
||||
stats.unserialize(bs);
|
||||
stats.setEndTime();
|
||||
stats.insert();
|
||||
break;
|
||||
try
|
||||
{
|
||||
bs >> hndl->queryStats;
|
||||
bs >> hndl->extendedStats;
|
||||
bs >> hndl->miniStats;
|
||||
stats.unserialize(bs);
|
||||
stats.setEndTime();
|
||||
stats.insert();
|
||||
break;
|
||||
}
|
||||
catch (IDBExcept&)
|
||||
{
|
||||
// @bug4732
|
||||
end_query(hndl);
|
||||
throw;
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
// querystats messed up. close connection.
|
||||
// no need to throw for querystats protocol error, like for tablemode.
|
||||
SMDEBUGLOG << "tpl_close() exception whilst getting stats" << endl;
|
||||
end_query(hndl);
|
||||
sm_cleanup(hndl);
|
||||
*conn_hdl = 0;
|
||||
return STATUS_OK;
|
||||
//throw runtime_error(string("tbl_close catch exception: ") + e.what());
|
||||
}
|
||||
}
|
||||
catch (IDBExcept&)
|
||||
{
|
||||
// @bug4732
|
||||
end_query(hndl);
|
||||
throw;
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
// querystats messed up. close connection.
|
||||
// no need to throw for querystats protocol error, like for tablemode.
|
||||
#if IDB_SM_DEBUG
|
||||
SMDEBUGLOG << "tpl_close() exception whilst getting stats" << endl;
|
||||
#endif
|
||||
end_query(hndl);
|
||||
sm_cleanup(hndl);
|
||||
*conn_hdl = 0;
|
||||
return STATUS_OK;
|
||||
//throw runtime_error(string("tbl_close catch exception: ") + e.what());
|
||||
}
|
||||
}
|
||||
} //stats
|
||||
|
||||
end_query(hndl);
|
||||
}
|
||||
|
@ -282,7 +282,7 @@ extern status_t tpl_open(tableid_t, cpsm_tplh_t*, cpsm_conhdl_t*);
|
||||
extern status_t tpl_scan_open(tableid_t, sp_cpsm_tplsch_t&, cpsm_conhdl_t*);
|
||||
extern status_t tpl_scan_fetch(sp_cpsm_tplsch_t&, cpsm_conhdl_t*, int* k = 0);
|
||||
extern status_t tpl_scan_close(sp_cpsm_tplsch_t&);
|
||||
extern status_t tpl_close(cpsm_tplh_t*, cpsm_conhdl_t**, querystats::QueryStats& stats, bool clear_scan_ctx = false);
|
||||
extern status_t tpl_close(cpsm_tplh_t*, cpsm_conhdl_t**, querystats::QueryStats& stats, bool ask_4_stats, bool clear_scan_ctx = false);
|
||||
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user