You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-08-07 03:22:57 +03:00
FE connection info structure migration.
Replaced INFINIDB_VTABLE.cal_conn_info with a plugin thread variable. Fixed query_string memory deallocation crash at plugin_thdvar_cleanup.
This commit is contained in:
@@ -380,7 +380,6 @@ static int calpont_close_connection ( handlerton* hton, THD* thd )
|
||||
|
||||
ha_calpont::ha_calpont(handlerton* hton, TABLE_SHARE* table_arg) :
|
||||
handler(hton, table_arg),
|
||||
fe_conn_info(NULL),
|
||||
int_table_flags(HA_BINLOG_STMT_CAPABLE | HA_BINLOG_ROW_CAPABLE |
|
||||
HA_TABLE_SCAN_ON_INDEX |
|
||||
HA_CAN_TABLE_CONDITION_PUSHDOWN)
|
||||
@@ -684,11 +683,10 @@ int ha_calpont::rnd_init(bool scan)
|
||||
{
|
||||
DBUG_ENTER("ha_calpont::rnd_init");
|
||||
|
||||
// Use global THD*
|
||||
set_original_query(current_thd, current_thd->query_string.str());
|
||||
mcs_handler_info mhi(static_cast<void*>(this), LEGACY);
|
||||
String query_string_cpy; query_string_cpy.append(current_thd->query_string.str());
|
||||
set_original_query(current_thd, query_string_cpy.c_ptr_safe());
|
||||
|
||||
int rc = ha_calpont_impl_rnd_init(table, mhi);
|
||||
int rc = ha_calpont_impl_rnd_init(table);
|
||||
|
||||
DBUG_RETURN(rc);
|
||||
}
|
||||
|
@@ -43,7 +43,6 @@ class ha_calpont: public handler
|
||||
THR_LOCK_DATA lock; ///< MySQL lock
|
||||
INFINIDB_SHARE* share; ///< Shared lock info
|
||||
ulonglong int_table_flags;
|
||||
void* fe_conn_info;
|
||||
|
||||
public:
|
||||
ha_calpont(handlerton* hton, TABLE_SHARE* table_arg);
|
||||
|
@@ -664,10 +664,10 @@ int ProcessDDLStatement(string& ddlStatement, string& schema, const string& tabl
|
||||
IDBCompressInterface idbCompress;
|
||||
parser.Parse(ddlStatement.c_str());
|
||||
|
||||
if (!thd->infinidb_vtable.cal_conn_info)
|
||||
thd->infinidb_vtable.cal_conn_info = (void*)(new cal_connection_info());
|
||||
if (get_fe_conn_info_ptr() == NULL)
|
||||
set_fe_conn_info_ptr((void*)new cal_connection_info());
|
||||
|
||||
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(thd->infinidb_vtable.cal_conn_info);
|
||||
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(get_fe_conn_info_ptr());
|
||||
|
||||
if (parser.Good())
|
||||
{
|
||||
|
@@ -58,6 +58,7 @@ using namespace logging;
|
||||
#include "idb_mysql.h"
|
||||
|
||||
#include "ha_calpont_impl_if.h"
|
||||
#include "mcs_sysvars.h"
|
||||
#include "ha_subquery.h"
|
||||
//#include "ha_view.h"
|
||||
using namespace cal_impl_if;
|
||||
@@ -1442,10 +1443,10 @@ bool buildPredicateItem(Item_func* ifp, gp_walk_info* gwip)
|
||||
}
|
||||
}
|
||||
|
||||
if (!(gwip->thd->infinidb_vtable.cal_conn_info))
|
||||
gwip->thd->infinidb_vtable.cal_conn_info = (void*)(new cal_connection_info());
|
||||
if (get_fe_conn_info_ptr() == NULL)
|
||||
set_fe_conn_info_ptr((void*)new cal_connection_info());
|
||||
|
||||
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(gwip->thd->infinidb_vtable.cal_conn_info);
|
||||
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(get_fe_conn_info_ptr());
|
||||
|
||||
|
||||
if (ifp->functype() == Item_func::BETWEEN)
|
||||
@@ -2466,10 +2467,10 @@ void setError(THD* thd, uint32_t errcode, string errmsg)
|
||||
thd->infinidb_vtable.override_largeside_estimate = false;
|
||||
|
||||
// reset expressionID
|
||||
if (!(thd->infinidb_vtable.cal_conn_info))
|
||||
thd->infinidb_vtable.cal_conn_info = (void*)(new cal_connection_info());
|
||||
if (get_fe_conn_info_ptr() == NULL)
|
||||
set_fe_conn_info_ptr((void*)new cal_connection_info());
|
||||
|
||||
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(thd->infinidb_vtable.cal_conn_info);
|
||||
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(get_fe_conn_info_ptr());
|
||||
ci->expressionId = 0;
|
||||
}
|
||||
|
||||
@@ -3104,10 +3105,10 @@ ArithmeticColumn* buildArithmeticColumn(
|
||||
bool& nonSupport,
|
||||
bool pushdownHand)
|
||||
{
|
||||
if (!(gwi.thd->infinidb_vtable.cal_conn_info))
|
||||
gwi.thd->infinidb_vtable.cal_conn_info = (void*)(new cal_connection_info());
|
||||
if (get_fe_conn_info_ptr() == NULL)
|
||||
set_fe_conn_info_ptr((void*)new cal_connection_info());
|
||||
|
||||
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(gwi.thd->infinidb_vtable.cal_conn_info);
|
||||
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(get_fe_conn_info_ptr());
|
||||
|
||||
ArithmeticColumn* ac = new ArithmeticColumn();
|
||||
Item** sfitempp = item->arguments();
|
||||
@@ -3329,10 +3330,10 @@ ReturnedColumn* buildFunctionColumn(
|
||||
bool& nonSupport,
|
||||
bool pushdownHand)
|
||||
{
|
||||
if (!(gwi.thd->infinidb_vtable.cal_conn_info))
|
||||
gwi.thd->infinidb_vtable.cal_conn_info = (void*)(new cal_connection_info());
|
||||
if (get_fe_conn_info_ptr() == NULL)
|
||||
set_fe_conn_info_ptr((void*)new cal_connection_info());
|
||||
|
||||
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(gwi.thd->infinidb_vtable.cal_conn_info);
|
||||
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(get_fe_conn_info_ptr());
|
||||
|
||||
string funcName = ifp->func_name();
|
||||
FuncExp* funcExp = FuncExp::instance();
|
||||
@@ -3801,10 +3802,10 @@ ReturnedColumn* buildFunctionColumn(
|
||||
|
||||
FunctionColumn* buildCaseFunction(Item_func* item, gp_walk_info& gwi, bool& nonSupport)
|
||||
{
|
||||
if (!(gwi.thd->infinidb_vtable.cal_conn_info))
|
||||
gwi.thd->infinidb_vtable.cal_conn_info = (void*)(new cal_connection_info());
|
||||
if (get_fe_conn_info_ptr() == NULL)
|
||||
set_fe_conn_info_ptr((void*)new cal_connection_info());
|
||||
|
||||
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(gwi.thd->infinidb_vtable.cal_conn_info);
|
||||
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(get_fe_conn_info_ptr());
|
||||
|
||||
FunctionColumn* fc = new FunctionColumn();
|
||||
FunctionParm funcParms;
|
||||
@@ -4194,10 +4195,10 @@ ReturnedColumn* buildAggregateColumn(Item* item, gp_walk_info& gwi)
|
||||
vector<SRCP> selCols;
|
||||
vector<SRCP> orderCols;
|
||||
bool bIsConst = false;
|
||||
if (!(gwi.thd->infinidb_vtable.cal_conn_info))
|
||||
gwi.thd->infinidb_vtable.cal_conn_info = (void*)(new cal_connection_info());
|
||||
if (get_fe_conn_info_ptr() == NULL)
|
||||
set_fe_conn_info_ptr((void*)new cal_connection_info());
|
||||
|
||||
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(gwi.thd->infinidb_vtable.cal_conn_info);
|
||||
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(get_fe_conn_info_ptr());
|
||||
|
||||
Item_sum* isp = reinterpret_cast<Item_sum*>(item);
|
||||
Item** sfitempp = isp->get_orig_args();
|
||||
|
@@ -866,10 +866,10 @@ void makeUpdateSemiJoin(const ParseTree* n, void* obj)
|
||||
|
||||
uint32_t doUpdateDelete(THD* thd)
|
||||
{
|
||||
if (!thd->infinidb_vtable.cal_conn_info)
|
||||
thd->infinidb_vtable.cal_conn_info = (void*)(new cal_connection_info());
|
||||
if (get_fe_conn_info_ptr() == NULL)
|
||||
set_fe_conn_info_ptr((void*)new cal_connection_info());
|
||||
|
||||
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(thd->infinidb_vtable.cal_conn_info);
|
||||
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(get_fe_conn_info_ptr());
|
||||
|
||||
//@bug 5660. Error out DDL/DML on slave node, or on local query node
|
||||
if (ci->isSlaveNode && !thd->slave_thread)
|
||||
@@ -1919,10 +1919,10 @@ extern "C"
|
||||
{
|
||||
THD* thd = current_thd;
|
||||
|
||||
if (!thd->infinidb_vtable.cal_conn_info)
|
||||
thd->infinidb_vtable.cal_conn_info = (void*)(new cal_connection_info());
|
||||
if (get_fe_conn_info_ptr() == NULL)
|
||||
set_fe_conn_info_ptr((void*)new cal_connection_info());
|
||||
|
||||
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(thd->infinidb_vtable.cal_conn_info);
|
||||
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(get_fe_conn_info_ptr());
|
||||
|
||||
unsigned long l = ci->queryStats.size();
|
||||
|
||||
@@ -1971,10 +1971,10 @@ extern "C"
|
||||
{
|
||||
THD* thd = current_thd;
|
||||
|
||||
if (!thd->infinidb_vtable.cal_conn_info)
|
||||
thd->infinidb_vtable.cal_conn_info = (void*)(new cal_connection_info());
|
||||
if (get_fe_conn_info_ptr() == NULL)
|
||||
set_fe_conn_info_ptr((void*)new cal_connection_info());
|
||||
|
||||
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(thd->infinidb_vtable.cal_conn_info);
|
||||
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(get_fe_conn_info_ptr());
|
||||
|
||||
long long oldTrace = ci->traceFlags;
|
||||
ci->traceFlags = (uint32_t)(*((long long*)args->args[0]));
|
||||
@@ -2329,10 +2329,10 @@ extern "C"
|
||||
{
|
||||
THD* thd = current_thd;
|
||||
|
||||
if (!thd->infinidb_vtable.cal_conn_info)
|
||||
thd->infinidb_vtable.cal_conn_info = (void*)(new cal_connection_info());
|
||||
if (get_fe_conn_info_ptr() == NULL)
|
||||
set_fe_conn_info_ptr((void*)new cal_connection_info());
|
||||
|
||||
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(thd->infinidb_vtable.cal_conn_info);
|
||||
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(get_fe_conn_info_ptr());
|
||||
CalpontSystemCatalog::TableName tableName;
|
||||
|
||||
if ( args->arg_count == 2 )
|
||||
@@ -2402,11 +2402,11 @@ extern "C"
|
||||
{
|
||||
THD* thd = current_thd;
|
||||
|
||||
if (!thd->infinidb_vtable.cal_conn_info)
|
||||
thd->infinidb_vtable.cal_conn_info = (void*)(new cal_connection_info());
|
||||
if (get_fe_conn_info_ptr() == NULL)
|
||||
set_fe_conn_info_ptr((void*)new cal_connection_info());
|
||||
|
||||
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(
|
||||
thd->infinidb_vtable.cal_conn_info);
|
||||
get_fe_conn_info_ptr());
|
||||
long long lockID = *reinterpret_cast<long long*>(args->args[0]);
|
||||
|
||||
if ( !ci->dmlProc )
|
||||
@@ -2581,10 +2581,10 @@ extern "C"
|
||||
}
|
||||
}
|
||||
|
||||
if (!thd->infinidb_vtable.cal_conn_info)
|
||||
thd->infinidb_vtable.cal_conn_info = (void*)(new cal_connection_info());
|
||||
if (get_fe_conn_info_ptr() == NULL)
|
||||
set_fe_conn_info_ptr((void*)new cal_connection_info());
|
||||
|
||||
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(thd->infinidb_vtable.cal_conn_info);
|
||||
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(get_fe_conn_info_ptr());
|
||||
|
||||
if (flags > 0)
|
||||
//msgp = &connMap[sessionID].extendedStats;
|
||||
@@ -2677,10 +2677,10 @@ extern "C"
|
||||
{
|
||||
THD* thd = current_thd;
|
||||
|
||||
if (!thd->infinidb_vtable.cal_conn_info)
|
||||
thd->infinidb_vtable.cal_conn_info = (void*)(new cal_connection_info());
|
||||
if (get_fe_conn_info_ptr() == NULL)
|
||||
set_fe_conn_info_ptr((void*)new cal_connection_info());
|
||||
|
||||
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(thd->infinidb_vtable.cal_conn_info);
|
||||
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(get_fe_conn_info_ptr());
|
||||
idbassert(ci != 0);
|
||||
|
||||
MessageQueueClient* mqc = 0;
|
||||
@@ -2768,14 +2768,8 @@ int ha_calpont_impl_discover_existence(const char* schema, const char* name)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ha_calpont_impl_rnd_init(TABLE* table, mcs_handler_info hndtl_ptr)
|
||||
int ha_calpont_impl_rnd_init(TABLE* table)
|
||||
{
|
||||
ha_calpont* handler;
|
||||
if ( hndtl_ptr.hndl_type == LEGACY )
|
||||
{
|
||||
handler = reinterpret_cast<ha_calpont*>(hndtl_ptr.hndl_ptr);
|
||||
}
|
||||
|
||||
#ifdef DEBUG_SETENV
|
||||
string home(getenv("HOME"));
|
||||
|
||||
@@ -2874,10 +2868,10 @@ int ha_calpont_impl_rnd_init(TABLE* table, mcs_handler_info hndtl_ptr)
|
||||
boost::shared_ptr<CalpontSystemCatalog> csc = CalpontSystemCatalog::makeCalpontSystemCatalog(sessionID);
|
||||
csc->identity(CalpontSystemCatalog::FE);
|
||||
|
||||
if (!thd->infinidb_vtable.cal_conn_info)
|
||||
thd->infinidb_vtable.cal_conn_info = (void*)(new cal_connection_info());
|
||||
if (get_fe_conn_info_ptr() == NULL)
|
||||
set_fe_conn_info_ptr((void*)new cal_connection_info());
|
||||
|
||||
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(thd->infinidb_vtable.cal_conn_info);
|
||||
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(get_fe_conn_info_ptr());
|
||||
|
||||
idbassert(ci != 0);
|
||||
|
||||
@@ -3413,10 +3407,10 @@ int ha_calpont_impl_rnd_next(uchar* buf, TABLE* table)
|
||||
return ER_INTERNAL_ERROR;
|
||||
}
|
||||
|
||||
if (!thd->infinidb_vtable.cal_conn_info)
|
||||
thd->infinidb_vtable.cal_conn_info = (void*)(new cal_connection_info());
|
||||
if (get_fe_conn_info_ptr() == NULL)
|
||||
set_fe_conn_info_ptr((void*)new cal_connection_info());
|
||||
|
||||
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(thd->infinidb_vtable.cal_conn_info);
|
||||
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(get_fe_conn_info_ptr());
|
||||
|
||||
// @bug 3078
|
||||
if (thd->killed == KILL_QUERY || thd->killed == KILL_QUERY_HARD)
|
||||
@@ -3514,8 +3508,8 @@ int ha_calpont_impl_rnd_end(TABLE* table)
|
||||
|
||||
thd->infinidb_vtable.isNewQuery = true;
|
||||
|
||||
if (thd->infinidb_vtable.cal_conn_info)
|
||||
ci = reinterpret_cast<cal_connection_info*>(thd->infinidb_vtable.cal_conn_info);
|
||||
if (get_fe_conn_info_ptr() != NULL)
|
||||
ci = reinterpret_cast<cal_connection_info*>(get_fe_conn_info_ptr());
|
||||
|
||||
if (thd->infinidb_vtable.vtable_state == THD::INFINIDB_ORDER_BY )
|
||||
{
|
||||
@@ -3563,8 +3557,8 @@ int ha_calpont_impl_rnd_end(TABLE* table)
|
||||
|
||||
if (!ci)
|
||||
{
|
||||
thd->infinidb_vtable.cal_conn_info = (void*)(new cal_connection_info());
|
||||
ci = reinterpret_cast<cal_connection_info*>(thd->infinidb_vtable.cal_conn_info);
|
||||
set_fe_conn_info_ptr((void*)new cal_connection_info());
|
||||
ci = reinterpret_cast<cal_connection_info*>(get_fe_conn_info_ptr());
|
||||
}
|
||||
|
||||
// @bug 3078. Also session limit variable works the same as ctrl+c
|
||||
@@ -3684,10 +3678,10 @@ int ha_calpont_impl_create(const char* name, TABLE* table_arg, HA_CREATE_INFO* c
|
||||
{
|
||||
THD* thd = current_thd;
|
||||
|
||||
if (!thd->infinidb_vtable.cal_conn_info)
|
||||
thd->infinidb_vtable.cal_conn_info = (void*)(new cal_connection_info());
|
||||
if (get_fe_conn_info_ptr() == NULL)
|
||||
set_fe_conn_info_ptr((void*)new cal_connection_info());
|
||||
|
||||
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(thd->infinidb_vtable.cal_conn_info);
|
||||
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(get_fe_conn_info_ptr());
|
||||
|
||||
// @bug1940 Do nothing for select query. Support of set default engine to IDB.
|
||||
if (thd->infinidb_vtable.vtable_state == THD::INFINIDB_CREATE_VTABLE ||
|
||||
@@ -3733,10 +3727,10 @@ int ha_calpont_impl_delete_table(const char* name)
|
||||
if (string(name).find("@0024vtable") != string::npos)
|
||||
return 0;
|
||||
|
||||
if (!thd->infinidb_vtable.cal_conn_info)
|
||||
thd->infinidb_vtable.cal_conn_info = (void*)(new cal_connection_info());
|
||||
if (get_fe_conn_info_ptr() == NULL)
|
||||
set_fe_conn_info_ptr((void*)new cal_connection_info());
|
||||
|
||||
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(thd->infinidb_vtable.cal_conn_info);
|
||||
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(get_fe_conn_info_ptr());
|
||||
|
||||
if (!thd) return 0;
|
||||
|
||||
@@ -3809,10 +3803,10 @@ int ha_calpont_impl_write_row(uchar* buf, TABLE* table)
|
||||
}
|
||||
}
|
||||
|
||||
if (!thd->infinidb_vtable.cal_conn_info)
|
||||
thd->infinidb_vtable.cal_conn_info = (void*)(new cal_connection_info());
|
||||
if (get_fe_conn_info_ptr() == NULL)
|
||||
set_fe_conn_info_ptr((void*)new cal_connection_info());
|
||||
|
||||
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(thd->infinidb_vtable.cal_conn_info);
|
||||
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(get_fe_conn_info_ptr());
|
||||
|
||||
if (thd->slave_thread) return 0;
|
||||
|
||||
@@ -3855,10 +3849,10 @@ int ha_calpont_impl_update_row()
|
||||
//@Bug 2540. Return the correct error code.
|
||||
THD* thd = current_thd;
|
||||
|
||||
if (!thd->infinidb_vtable.cal_conn_info)
|
||||
thd->infinidb_vtable.cal_conn_info = (void*)(new cal_connection_info());
|
||||
if (get_fe_conn_info_ptr() == NULL)
|
||||
set_fe_conn_info_ptr((void*)new cal_connection_info());
|
||||
|
||||
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(thd->infinidb_vtable.cal_conn_info);
|
||||
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(get_fe_conn_info_ptr());
|
||||
int rc = ci->rc;
|
||||
|
||||
if ( rc != 0 )
|
||||
@@ -3872,10 +3866,10 @@ int ha_calpont_impl_delete_row()
|
||||
//@Bug 2540. Return the correct error code.
|
||||
THD* thd = current_thd;
|
||||
|
||||
if (!thd->infinidb_vtable.cal_conn_info)
|
||||
thd->infinidb_vtable.cal_conn_info = (void*)(new cal_connection_info());
|
||||
if (get_fe_conn_info_ptr() == NULL)
|
||||
set_fe_conn_info_ptr((void*)new cal_connection_info());
|
||||
|
||||
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(thd->infinidb_vtable.cal_conn_info);
|
||||
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(get_fe_conn_info_ptr());
|
||||
int rc = ci->rc;
|
||||
|
||||
if ( rc != 0 )
|
||||
@@ -3888,10 +3882,10 @@ void ha_calpont_impl_start_bulk_insert(ha_rows rows, TABLE* table)
|
||||
{
|
||||
THD* thd = current_thd;
|
||||
|
||||
if (!thd->infinidb_vtable.cal_conn_info)
|
||||
thd->infinidb_vtable.cal_conn_info = (void*)(new cal_connection_info());
|
||||
if (get_fe_conn_info_ptr() == NULL)
|
||||
set_fe_conn_info_ptr((void*)new cal_connection_info());
|
||||
|
||||
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(thd->infinidb_vtable.cal_conn_info);
|
||||
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(get_fe_conn_info_ptr());
|
||||
|
||||
// clear rows variable
|
||||
ci->rowsHaveInserted = 0;
|
||||
@@ -4456,10 +4450,10 @@ int ha_calpont_impl_end_bulk_insert(bool abort, TABLE* table)
|
||||
|
||||
std::string aTmpDir(startup::StartUp::tmpDir());
|
||||
|
||||
if (!thd->infinidb_vtable.cal_conn_info)
|
||||
thd->infinidb_vtable.cal_conn_info = (void*)(new cal_connection_info());
|
||||
if (get_fe_conn_info_ptr() == NULL)
|
||||
set_fe_conn_info_ptr((void*)new cal_connection_info());
|
||||
|
||||
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(thd->infinidb_vtable.cal_conn_info);
|
||||
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(get_fe_conn_info_ptr());
|
||||
|
||||
if (thd->slave_thread) return 0;
|
||||
|
||||
@@ -4714,10 +4708,10 @@ int ha_calpont_impl_commit (handlerton* hton, THD* thd, bool all)
|
||||
thd->infinidb_vtable.vtable_state == THD::INFINIDB_REDO_PHASE1)
|
||||
return 0;
|
||||
|
||||
if (!thd->infinidb_vtable.cal_conn_info)
|
||||
thd->infinidb_vtable.cal_conn_info = (void*)(new cal_connection_info());
|
||||
if (get_fe_conn_info_ptr() == NULL)
|
||||
set_fe_conn_info_ptr((void*)new cal_connection_info());
|
||||
|
||||
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(thd->infinidb_vtable.cal_conn_info);
|
||||
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(get_fe_conn_info_ptr());
|
||||
|
||||
if (ci->isAlter)
|
||||
return 0;
|
||||
@@ -4755,10 +4749,10 @@ int ha_calpont_impl_rollback (handlerton* hton, THD* thd, bool all)
|
||||
// return 0;
|
||||
//}
|
||||
|
||||
if (!thd->infinidb_vtable.cal_conn_info)
|
||||
thd->infinidb_vtable.cal_conn_info = (void*)(new cal_connection_info());
|
||||
if (get_fe_conn_info_ptr() == NULL)
|
||||
set_fe_conn_info_ptr((void*)new cal_connection_info());
|
||||
|
||||
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(thd->infinidb_vtable.cal_conn_info);
|
||||
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(get_fe_conn_info_ptr());
|
||||
|
||||
if ( !ci->dmlProc )
|
||||
{
|
||||
@@ -4785,10 +4779,10 @@ int ha_calpont_impl_close_connection (handlerton* hton, THD* thd)
|
||||
|
||||
execplan::CalpontSystemCatalog::removeCalpontSystemCatalog(tid2sid(thd->thread_id));
|
||||
|
||||
if (!thd->infinidb_vtable.cal_conn_info)
|
||||
thd->infinidb_vtable.cal_conn_info = (void*)(new cal_connection_info());
|
||||
if (get_fe_conn_info_ptr() == NULL)
|
||||
set_fe_conn_info_ptr((void*)new cal_connection_info());
|
||||
|
||||
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(thd->infinidb_vtable.cal_conn_info);
|
||||
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(get_fe_conn_info_ptr());
|
||||
|
||||
if (!ci) return 0;
|
||||
|
||||
@@ -4815,10 +4809,10 @@ int ha_calpont_impl_rename_table(const char* from, const char* to)
|
||||
IDEBUG( cout << "ha_calpont_impl_rename_table: " << from << " => " << to << endl );
|
||||
THD* thd = current_thd;
|
||||
|
||||
if (!thd->infinidb_vtable.cal_conn_info)
|
||||
thd->infinidb_vtable.cal_conn_info = (void*)(new cal_connection_info());
|
||||
if (get_fe_conn_info_ptr() == NULL)
|
||||
set_fe_conn_info_ptr((void*)new cal_connection_info());
|
||||
|
||||
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(thd->infinidb_vtable.cal_conn_info);
|
||||
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(get_fe_conn_info_ptr());
|
||||
|
||||
//@Bug 1948. Alter table call rename table twice
|
||||
if ( ci->alterTableState == cal_connection_info::ALTER_FIRST_RENAME )
|
||||
@@ -4866,10 +4860,10 @@ COND* ha_calpont_impl_cond_push(COND* cond, TABLE* table)
|
||||
alias.assign(table->alias.ptr(), table->alias.length());
|
||||
IDEBUG( cout << "ha_calpont_impl_cond_push: " << alias << endl );
|
||||
|
||||
if (!thd->infinidb_vtable.cal_conn_info)
|
||||
thd->infinidb_vtable.cal_conn_info = (void*)(new cal_connection_info());
|
||||
if (get_fe_conn_info_ptr() == NULL)
|
||||
set_fe_conn_info_ptr((void*)new cal_connection_info());
|
||||
|
||||
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(thd->infinidb_vtable.cal_conn_info);
|
||||
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(get_fe_conn_info_ptr());
|
||||
|
||||
cal_table_info ti = ci->tableMap[table];
|
||||
|
||||
@@ -4947,10 +4941,10 @@ int ha_calpont_impl_external_lock(THD* thd, TABLE* table, int lock_type)
|
||||
if ( thd->infinidb_vtable.vtable_state == THD::INFINIDB_INIT )
|
||||
return 0;
|
||||
|
||||
if (!thd->infinidb_vtable.cal_conn_info)
|
||||
thd->infinidb_vtable.cal_conn_info = (void*)(new cal_connection_info());
|
||||
if (get_fe_conn_info_ptr() == NULL)
|
||||
set_fe_conn_info_ptr((void*)new cal_connection_info());
|
||||
|
||||
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(thd->infinidb_vtable.cal_conn_info);
|
||||
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(get_fe_conn_info_ptr());
|
||||
|
||||
if (thd->killed == KILL_QUERY || thd->killed == KILL_QUERY_HARD)
|
||||
{
|
||||
@@ -5112,10 +5106,10 @@ int ha_calpont_impl_group_by_init(ha_calpont_group_by_handler* group_hand, TABLE
|
||||
boost::shared_ptr<CalpontSystemCatalog> csc = CalpontSystemCatalog::makeCalpontSystemCatalog(sessionID);
|
||||
csc->identity(CalpontSystemCatalog::FE);
|
||||
|
||||
if (!thd->infinidb_vtable.cal_conn_info)
|
||||
thd->infinidb_vtable.cal_conn_info = (void*)(new cal_connection_info());
|
||||
if (get_fe_conn_info_ptr() == NULL)
|
||||
set_fe_conn_info_ptr((void*)new cal_connection_info());
|
||||
|
||||
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(thd->infinidb_vtable.cal_conn_info);
|
||||
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(get_fe_conn_info_ptr());
|
||||
|
||||
idbassert(ci != 0);
|
||||
|
||||
@@ -5614,10 +5608,10 @@ int ha_calpont_impl_group_by_next(ha_calpont_group_by_handler* group_hand, TABLE
|
||||
return ER_INTERNAL_ERROR;
|
||||
}
|
||||
*/
|
||||
if (!thd->infinidb_vtable.cal_conn_info)
|
||||
thd->infinidb_vtable.cal_conn_info = (void*)(new cal_connection_info());
|
||||
if (get_fe_conn_info_ptr() == NULL)
|
||||
set_fe_conn_info_ptr((void*)new cal_connection_info());
|
||||
|
||||
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(thd->infinidb_vtable.cal_conn_info);
|
||||
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(get_fe_conn_info_ptr());
|
||||
|
||||
// @bug 3078
|
||||
if (thd->killed == KILL_QUERY || thd->killed == KILL_QUERY_HARD)
|
||||
@@ -5718,8 +5712,8 @@ int ha_calpont_impl_group_by_end(ha_calpont_group_by_handler* group_hand, TABLE*
|
||||
thd->infinidb_vtable.isNewQuery = true;
|
||||
thd->infinidb_vtable.isUnion = false;
|
||||
|
||||
if (thd->infinidb_vtable.cal_conn_info)
|
||||
ci = reinterpret_cast<cal_connection_info*>(thd->infinidb_vtable.cal_conn_info);
|
||||
if (get_fe_conn_info_ptr() != NULL)
|
||||
ci = reinterpret_cast<cal_connection_info*>(get_fe_conn_info_ptr());
|
||||
|
||||
// MCOL-1052
|
||||
//if (thd->infinidb_vtable.vtable_state == THD::INFINIDB_ORDER_BY )
|
||||
@@ -5756,8 +5750,8 @@ int ha_calpont_impl_group_by_end(ha_calpont_group_by_handler* group_hand, TABLE*
|
||||
|
||||
if (!ci)
|
||||
{
|
||||
thd->infinidb_vtable.cal_conn_info = (void*)(new cal_connection_info());
|
||||
ci = reinterpret_cast<cal_connection_info*>(thd->infinidb_vtable.cal_conn_info);
|
||||
set_fe_conn_info_ptr((void*)new cal_connection_info());
|
||||
ci = reinterpret_cast<cal_connection_info*>(get_fe_conn_info_ptr());
|
||||
}
|
||||
|
||||
// @bug 3078. Also session limit variable works the same as ctrl+c
|
||||
|
@@ -27,7 +27,7 @@ extern int ha_calpont_impl_create(const char* name, TABLE* table_arg, HA_CREATE_
|
||||
extern int ha_calpont_impl_delete_table(const char* name);
|
||||
extern int ha_calpont_impl_open(const char* name, int mode, uint32_t test_if_locked);
|
||||
extern int ha_calpont_impl_close(void);
|
||||
extern int ha_calpont_impl_rnd_init(TABLE* table, mcs_handler_info hndtl_ptr);
|
||||
extern int ha_calpont_impl_rnd_init(TABLE* table);
|
||||
extern int ha_calpont_impl_rnd_next(uchar* buf, TABLE* table);
|
||||
extern int ha_calpont_impl_rnd_end(TABLE* table);
|
||||
extern int ha_calpont_impl_write_row(uchar* buf, TABLE* table);
|
||||
|
@@ -20,6 +20,7 @@ using namespace execplan;
|
||||
#include "functor_str.h"
|
||||
|
||||
#include "ha_calpont_impl_if.h"
|
||||
#include "mcs_sysvars.h"
|
||||
using namespace cal_impl_if;
|
||||
|
||||
namespace
|
||||
@@ -54,10 +55,10 @@ int64_t idblocalpm()
|
||||
{
|
||||
THD* thd = current_thd;
|
||||
|
||||
if (!thd->infinidb_vtable.cal_conn_info)
|
||||
thd->infinidb_vtable.cal_conn_info = (void*)(new cal_connection_info());
|
||||
if (get_fe_conn_info_ptr() == NULL)
|
||||
set_fe_conn_info_ptr((void*)new cal_connection_info());
|
||||
|
||||
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(thd->infinidb_vtable.cal_conn_info);
|
||||
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(get_fe_conn_info_ptr());
|
||||
|
||||
if (ci->localPm == -1)
|
||||
{
|
||||
@@ -485,10 +486,10 @@ execplan::ReturnedColumn* buildPseudoColumn(Item* item,
|
||||
bool& nonSupport,
|
||||
uint32_t pseudoType)
|
||||
{
|
||||
if (!(gwi.thd->infinidb_vtable.cal_conn_info))
|
||||
gwi.thd->infinidb_vtable.cal_conn_info = (void*)(new cal_connection_info());
|
||||
if (get_fe_conn_info_ptr() == NULL)
|
||||
set_fe_conn_info_ptr((void*)new cal_connection_info());
|
||||
|
||||
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(gwi.thd->infinidb_vtable.cal_conn_info);
|
||||
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(get_fe_conn_info_ptr());
|
||||
|
||||
Item_func* ifp = (Item_func*)item;
|
||||
|
||||
|
@@ -28,6 +28,7 @@ using namespace std;
|
||||
|
||||
#include "idb_mysql.h"
|
||||
#include "ha_calpont_impl_if.h"
|
||||
#include "mcs_sysvars.h"
|
||||
|
||||
#include "arithmeticcolumn.h"
|
||||
#include "arithmeticoperator.h"
|
||||
@@ -93,10 +94,10 @@ WF_FRAME frame(Window_frame_bound::Bound_precedence_type bound, Item* offset)
|
||||
}
|
||||
ReturnedColumn* buildBoundExp(WF_Boundary& bound, SRCP& order, gp_walk_info& gwi)
|
||||
{
|
||||
if (!(gwi.thd->infinidb_vtable.cal_conn_info))
|
||||
gwi.thd->infinidb_vtable.cal_conn_info = (void*)(new cal_connection_info());
|
||||
if (get_fe_conn_info_ptr() == NULL)
|
||||
set_fe_conn_info_ptr((void*)new cal_connection_info());
|
||||
|
||||
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(gwi.thd->infinidb_vtable.cal_conn_info);
|
||||
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(get_fe_conn_info_ptr());
|
||||
|
||||
bool addOp = true;
|
||||
ReturnedColumn* rc = NULL;
|
||||
@@ -337,10 +338,10 @@ ReturnedColumn* buildWindowFunctionColumn(Item* item, gp_walk_info& gwi, bool& n
|
||||
//String str;
|
||||
//item->print(&str, QT_INFINIDB_NO_QUOTE);
|
||||
//cout << str.c_ptr() << endl;
|
||||
if (!(gwi.thd->infinidb_vtable.cal_conn_info))
|
||||
gwi.thd->infinidb_vtable.cal_conn_info = (void*)(new cal_connection_info());
|
||||
if (get_fe_conn_info_ptr() == NULL)
|
||||
set_fe_conn_info_ptr((void*)new cal_connection_info());
|
||||
|
||||
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(gwi.thd->infinidb_vtable.cal_conn_info);
|
||||
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(get_fe_conn_info_ptr());
|
||||
|
||||
gwi.hasWindowFunc = true;
|
||||
Item_window_func* wf = (Item_window_func*)item;
|
||||
|
124
dbcon/mysql/mcs_sysvars.cpp
Normal file
124
dbcon/mysql/mcs_sysvars.cpp
Normal file
@@ -0,0 +1,124 @@
|
||||
/* Copyright (C) 2014 InfiniDB, Inc.
|
||||
Copyright (C) 2016 MariaDB Corporaton
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; version 2 of
|
||||
the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
MA 02110-1301, USA. */
|
||||
|
||||
#include <my_config.h>
|
||||
#include "idb_mysql.h"
|
||||
#include "mcs_sysvars.h"
|
||||
|
||||
const char* mcs_compression_type_names[] = {
|
||||
"NO_COMPRESSION",
|
||||
"SNAPPY",
|
||||
NullS
|
||||
};
|
||||
|
||||
static TYPELIB mcs_compression_type_names_lib = {
|
||||
array_elements(mcs_compression_type_names) - 1,
|
||||
"mcs_compression_type_names",
|
||||
mcs_compression_type_names,
|
||||
NULL
|
||||
};
|
||||
|
||||
// compression type
|
||||
static MYSQL_THDVAR_ENUM(
|
||||
compression_type,
|
||||
PLUGIN_VAR_RQCMDARG,
|
||||
"Controls compression type for create tables. Possible values are: "
|
||||
"NO_COMPRESSION segment files aren't compressed; "
|
||||
"SNAPPY segment files are Snappy compressed (default);",
|
||||
NULL,
|
||||
NULL,
|
||||
SNAPPY,
|
||||
&mcs_compression_type_names_lib);
|
||||
|
||||
// original query
|
||||
static MYSQL_THDVAR_STR(
|
||||
original_query, /* name */
|
||||
PLUGIN_VAR_MEMALLOC |
|
||||
PLUGIN_VAR_RQCMDARG,
|
||||
"Original query text", /* comment */
|
||||
NULL, /* check */
|
||||
NULL, /* update */
|
||||
NULL /* def */
|
||||
);
|
||||
|
||||
// fe_conn_info pointer
|
||||
static MYSQL_THDVAR_ULONGLONG(
|
||||
fe_conn_info_ptr,
|
||||
PLUGIN_VAR_NOSYSVAR | PLUGIN_VAR_NOCMDOPT,
|
||||
"FrontEnd connection structure pointer. For internal usage.",
|
||||
NULL,
|
||||
NULL,
|
||||
0,
|
||||
0,
|
||||
~0U,
|
||||
1
|
||||
);
|
||||
|
||||
st_mysql_sys_var* mcs_system_variables[] =
|
||||
{
|
||||
MYSQL_SYSVAR(compression_type),
|
||||
MYSQL_SYSVAR(original_query),
|
||||
MYSQL_SYSVAR(fe_conn_info_ptr),
|
||||
NULL
|
||||
};
|
||||
|
||||
const char* get_original_query(THD* thd) {
|
||||
return THDVAR(thd, original_query);
|
||||
}
|
||||
|
||||
void set_original_query(THD* thd, char* query) {
|
||||
THDVAR(thd, original_query) = query;
|
||||
}
|
||||
|
||||
void* get_fe_conn_info_ptr()
|
||||
{
|
||||
return ( current_thd == NULL ) ? NULL :
|
||||
(void*)THDVAR(current_thd, fe_conn_info_ptr);
|
||||
}
|
||||
|
||||
void set_fe_conn_info_ptr(void* ptr)
|
||||
{
|
||||
if ( current_thd == NULL )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
THDVAR(current_thd, fe_conn_info_ptr) = (uint64_t)(ptr);
|
||||
}
|
||||
|
||||
/*ha_calpont* get_legacy_handler(mcs_handler_info mcs_hndl_ptr)
|
||||
{
|
||||
//MCOL-1101 Add handler type check
|
||||
//hndl_ptr.hndl_type == LEGACY )
|
||||
ha_calpont* hndl;
|
||||
if ( mcs_hndl_ptr.hndl_ptr != NULL )
|
||||
{
|
||||
hndl = (ha_calpont*)(mcs_hndl_ptr.hndl_ptr);
|
||||
}
|
||||
else
|
||||
{
|
||||
hndl = new ha_calpont();
|
||||
hndl->fe_conn_info = (void*)THDVAR(current_thd, fe_conn_info_ptr);
|
||||
}
|
||||
|
||||
return hndl;
|
||||
}*/
|
||||
|
||||
mcs_compression_type_t get_compression_type(THD* thd) {
|
||||
return (mcs_compression_type_t) THDVAR(thd, compression_type);
|
||||
}
|
58
dbcon/mysql/mcs_sysvars.h
Normal file
58
dbcon/mysql/mcs_sysvars.h
Normal file
@@ -0,0 +1,58 @@
|
||||
/* Copyright (C) 2014 InfiniDB, Inc.
|
||||
Copyright (C) 2016 MariaDB Corporaton
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; version 2 of
|
||||
the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
MA 02110-1301, USA. */
|
||||
|
||||
#ifndef MCS_SYSVARS_H__
|
||||
#define MCS_SYSVARS_H__
|
||||
|
||||
#include <my_config.h>
|
||||
#include "idb_mysql.h"
|
||||
|
||||
extern st_mysql_sys_var* mcs_system_variables[];
|
||||
|
||||
enum mcs_handler_types_t
|
||||
{
|
||||
SELECT,
|
||||
GROUP_BY,
|
||||
LEGACY
|
||||
};
|
||||
|
||||
struct mcs_handler_info
|
||||
{
|
||||
mcs_handler_info() : hndl_ptr(NULL), hndl_type(LEGACY) { };
|
||||
mcs_handler_info(mcs_handler_types_t type) : hndl_ptr(NULL), hndl_type(type) { };
|
||||
mcs_handler_info(void* ptr, mcs_handler_types_t type) : hndl_ptr(ptr), hndl_type(type) { };
|
||||
~mcs_handler_info() { };
|
||||
void* hndl_ptr;
|
||||
mcs_handler_types_t hndl_type;
|
||||
};
|
||||
|
||||
// compression_type
|
||||
enum mcs_compression_type_t {
|
||||
NO_COMPRESSION = 0,
|
||||
SNAPPY = 2
|
||||
};
|
||||
|
||||
// simple setters/getters
|
||||
const char* get_original_query(THD* thd);
|
||||
void set_original_query(THD* thd, char* query);
|
||||
mcs_compression_type_t get_compression_type(THD* thd);
|
||||
|
||||
void* get_fe_conn_info_ptr();
|
||||
void set_fe_conn_info_ptr(void* ptr);
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user