You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-08-05 16:15:50 +03:00
Connection resource cleaning by Karol Roslaniec
This commit is contained in:
committed by
Roman Nozdrin
parent
5923beeab9
commit
26b641ac06
@@ -97,8 +97,10 @@ extern "C"
|
|||||||
std::string pstr(parameter);
|
std::string pstr(parameter);
|
||||||
boost::algorithm::to_lower(pstr);
|
boost::algorithm::to_lower(pstr);
|
||||||
|
|
||||||
if (get_fe_conn_info_ptr() == NULL)
|
if (get_fe_conn_info_ptr() == NULL) {
|
||||||
set_fe_conn_info_ptr((void*)new cal_connection_info());
|
set_fe_conn_info_ptr((void*)new cal_connection_info());
|
||||||
|
thd_set_ha_data(thd, mcs_hton, get_fe_conn_info_ptr());
|
||||||
|
}
|
||||||
|
|
||||||
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(get_fe_conn_info_ptr());
|
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(get_fe_conn_info_ptr());
|
||||||
idbassert(ci != 0);
|
idbassert(ci != 0);
|
||||||
@@ -196,8 +198,10 @@ extern "C"
|
|||||||
const char* calgetstats(UDF_INIT* initid, UDF_ARGS* args, char* result, unsigned long* length,
|
const char* calgetstats(UDF_INIT* initid, UDF_ARGS* args, char* result, unsigned long* length,
|
||||||
char* is_null, char* error)
|
char* is_null, char* error)
|
||||||
{
|
{
|
||||||
if (get_fe_conn_info_ptr() == NULL)
|
if (get_fe_conn_info_ptr() == NULL) {
|
||||||
set_fe_conn_info_ptr((void*)new cal_connection_info());
|
set_fe_conn_info_ptr((void*)new cal_connection_info());
|
||||||
|
thd_set_ha_data(current_thd, mcs_hton, get_fe_conn_info_ptr());
|
||||||
|
}
|
||||||
|
|
||||||
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(get_fe_conn_info_ptr());
|
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(get_fe_conn_info_ptr());
|
||||||
|
|
||||||
@@ -246,8 +250,10 @@ extern "C"
|
|||||||
#endif
|
#endif
|
||||||
long long calsettrace(UDF_INIT* initid, UDF_ARGS* args, char* is_null, char* error)
|
long long calsettrace(UDF_INIT* initid, UDF_ARGS* args, char* is_null, char* error)
|
||||||
{
|
{
|
||||||
if (get_fe_conn_info_ptr() == NULL)
|
if (get_fe_conn_info_ptr() == NULL) {
|
||||||
set_fe_conn_info_ptr((void*)new cal_connection_info());
|
set_fe_conn_info_ptr((void*)new cal_connection_info());
|
||||||
|
thd_set_ha_data(current_thd, mcs_hton, get_fe_conn_info_ptr());
|
||||||
|
}
|
||||||
|
|
||||||
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(get_fe_conn_info_ptr());
|
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(get_fe_conn_info_ptr());
|
||||||
|
|
||||||
@@ -456,8 +462,10 @@ extern "C"
|
|||||||
{
|
{
|
||||||
THD* thd = current_thd;
|
THD* thd = current_thd;
|
||||||
|
|
||||||
if (get_fe_conn_info_ptr() == NULL)
|
if (get_fe_conn_info_ptr() == NULL) {
|
||||||
set_fe_conn_info_ptr((void*)new cal_connection_info());
|
set_fe_conn_info_ptr((void*)new cal_connection_info());
|
||||||
|
thd_set_ha_data(thd, mcs_hton, get_fe_conn_info_ptr());
|
||||||
|
}
|
||||||
|
|
||||||
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(get_fe_conn_info_ptr());
|
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(get_fe_conn_info_ptr());
|
||||||
execplan::CalpontSystemCatalog::TableName tableName;
|
execplan::CalpontSystemCatalog::TableName tableName;
|
||||||
@@ -533,8 +541,10 @@ extern "C"
|
|||||||
const char* calcleartablelock(UDF_INIT* initid, UDF_ARGS* args, char* result, unsigned long* length,
|
const char* calcleartablelock(UDF_INIT* initid, UDF_ARGS* args, char* result, unsigned long* length,
|
||||||
char* is_null, char* error)
|
char* is_null, char* error)
|
||||||
{
|
{
|
||||||
if (get_fe_conn_info_ptr() == NULL)
|
if (get_fe_conn_info_ptr() == NULL) {
|
||||||
set_fe_conn_info_ptr((void*)new cal_connection_info());
|
set_fe_conn_info_ptr((void*)new cal_connection_info());
|
||||||
|
thd_set_ha_data(current_thd, mcs_hton, get_fe_conn_info_ptr());
|
||||||
|
}
|
||||||
|
|
||||||
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(get_fe_conn_info_ptr());
|
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(get_fe_conn_info_ptr());
|
||||||
long long lockID = *reinterpret_cast<long long*>(args->args[0]);
|
long long lockID = *reinterpret_cast<long long*>(args->args[0]);
|
||||||
@@ -716,8 +726,10 @@ extern "C"
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (get_fe_conn_info_ptr() == NULL)
|
if (get_fe_conn_info_ptr() == NULL) {
|
||||||
set_fe_conn_info_ptr((void*)new cal_connection_info());
|
set_fe_conn_info_ptr((void*)new cal_connection_info());
|
||||||
|
thd_set_ha_data(current_thd, mcs_hton, get_fe_conn_info_ptr());
|
||||||
|
}
|
||||||
|
|
||||||
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(get_fe_conn_info_ptr());
|
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(get_fe_conn_info_ptr());
|
||||||
|
|
||||||
@@ -809,8 +821,10 @@ extern "C"
|
|||||||
const char* calgetsqlcount(UDF_INIT* initid, UDF_ARGS* args, char* result, unsigned long* length,
|
const char* calgetsqlcount(UDF_INIT* initid, UDF_ARGS* args, char* result, unsigned long* length,
|
||||||
char* is_null, char* error)
|
char* is_null, char* error)
|
||||||
{
|
{
|
||||||
if (get_fe_conn_info_ptr() == NULL)
|
if (get_fe_conn_info_ptr() == NULL) {
|
||||||
set_fe_conn_info_ptr((void*)new cal_connection_info());
|
set_fe_conn_info_ptr((void*)new cal_connection_info());
|
||||||
|
thd_set_ha_data(current_thd, mcs_hton, get_fe_conn_info_ptr());
|
||||||
|
}
|
||||||
|
|
||||||
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(get_fe_conn_info_ptr());
|
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(get_fe_conn_info_ptr());
|
||||||
idbassert(ci != 0);
|
idbassert(ci != 0);
|
||||||
|
@@ -52,6 +52,7 @@ using namespace boost;
|
|||||||
#include "ha_mcs_sysvars.h"
|
#include "ha_mcs_sysvars.h"
|
||||||
#include "idb_mysql.h"
|
#include "idb_mysql.h"
|
||||||
|
|
||||||
|
#include "ha_mcs.h"
|
||||||
#include "ha_mcs_impl_if.h"
|
#include "ha_mcs_impl_if.h"
|
||||||
using namespace cal_impl_if;
|
using namespace cal_impl_if;
|
||||||
|
|
||||||
@@ -775,8 +776,10 @@ int ProcessDDLStatement(string& ddlStatement, string& schema, const string& tabl
|
|||||||
int rc = 0;
|
int rc = 0;
|
||||||
parser.Parse(ddlStatement.c_str());
|
parser.Parse(ddlStatement.c_str());
|
||||||
|
|
||||||
if (get_fe_conn_info_ptr() == NULL)
|
if (get_fe_conn_info_ptr() == NULL) {
|
||||||
set_fe_conn_info_ptr((void*)new cal_connection_info());
|
set_fe_conn_info_ptr((void*)new cal_connection_info());
|
||||||
|
thd_set_ha_data(thd, mcs_hton, get_fe_conn_info_ptr());
|
||||||
|
}
|
||||||
|
|
||||||
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(get_fe_conn_info_ptr());
|
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(get_fe_conn_info_ptr());
|
||||||
|
|
||||||
|
@@ -1885,8 +1885,10 @@ bool buildPredicateItem(Item_func* ifp, gp_walk_info* gwip)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (get_fe_conn_info_ptr() == NULL)
|
if (get_fe_conn_info_ptr() == NULL) {
|
||||||
set_fe_conn_info_ptr((void*)new cal_connection_info());
|
set_fe_conn_info_ptr((void*)new cal_connection_info());
|
||||||
|
thd_set_ha_data(current_thd, mcs_hton, get_fe_conn_info_ptr());
|
||||||
|
}
|
||||||
|
|
||||||
if (ifp->functype() == Item_func::BETWEEN)
|
if (ifp->functype() == Item_func::BETWEEN)
|
||||||
{
|
{
|
||||||
@@ -2784,8 +2786,10 @@ void setError(THD* thd, uint32_t errcode, string errmsg)
|
|||||||
thd->raise_error_printf(errcode, errmsg.c_str());
|
thd->raise_error_printf(errcode, errmsg.c_str());
|
||||||
|
|
||||||
// reset expressionID
|
// reset expressionID
|
||||||
if (get_fe_conn_info_ptr() == NULL)
|
if (get_fe_conn_info_ptr() == NULL) {
|
||||||
set_fe_conn_info_ptr((void*)new cal_connection_info());
|
set_fe_conn_info_ptr((void*)new cal_connection_info());
|
||||||
|
thd_set_ha_data(current_thd, mcs_hton, get_fe_conn_info_ptr());
|
||||||
|
}
|
||||||
|
|
||||||
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(get_fe_conn_info_ptr());
|
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(get_fe_conn_info_ptr());
|
||||||
ci->expressionId = 0;
|
ci->expressionId = 0;
|
||||||
@@ -3553,8 +3557,10 @@ ReturnedColumn* buildReturnedColumn(Item* item, gp_walk_info& gwi, bool& nonSupp
|
|||||||
|
|
||||||
ArithmeticColumn* buildArithmeticColumn(Item_func* item, gp_walk_info& gwi, bool& nonSupport)
|
ArithmeticColumn* buildArithmeticColumn(Item_func* item, gp_walk_info& gwi, bool& nonSupport)
|
||||||
{
|
{
|
||||||
if (get_fe_conn_info_ptr() == NULL)
|
if (get_fe_conn_info_ptr() == NULL) {
|
||||||
set_fe_conn_info_ptr((void*)new cal_connection_info());
|
set_fe_conn_info_ptr((void*)new cal_connection_info());
|
||||||
|
thd_set_ha_data(current_thd, mcs_hton, get_fe_conn_info_ptr());
|
||||||
|
}
|
||||||
|
|
||||||
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(get_fe_conn_info_ptr());
|
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(get_fe_conn_info_ptr());
|
||||||
|
|
||||||
@@ -3814,8 +3820,10 @@ ArithmeticColumn* buildArithmeticColumn(Item_func* item, gp_walk_info& gwi, bool
|
|||||||
|
|
||||||
ReturnedColumn* buildFunctionColumn(Item_func* ifp, gp_walk_info& gwi, bool& nonSupport, bool selectBetweenIn)
|
ReturnedColumn* buildFunctionColumn(Item_func* ifp, gp_walk_info& gwi, bool& nonSupport, bool selectBetweenIn)
|
||||||
{
|
{
|
||||||
if (get_fe_conn_info_ptr() == NULL)
|
if (get_fe_conn_info_ptr() == NULL) {
|
||||||
set_fe_conn_info_ptr((void*)new cal_connection_info());
|
set_fe_conn_info_ptr((void*)new cal_connection_info());
|
||||||
|
thd_set_ha_data(current_thd, mcs_hton, get_fe_conn_info_ptr());
|
||||||
|
}
|
||||||
|
|
||||||
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(get_fe_conn_info_ptr());
|
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(get_fe_conn_info_ptr());
|
||||||
|
|
||||||
@@ -4412,8 +4420,10 @@ ReturnedColumn* buildFunctionColumn(Item_func* ifp, gp_walk_info& gwi, bool& non
|
|||||||
|
|
||||||
FunctionColumn* buildCaseFunction(Item_func* item, gp_walk_info& gwi, bool& nonSupport)
|
FunctionColumn* buildCaseFunction(Item_func* item, gp_walk_info& gwi, bool& nonSupport)
|
||||||
{
|
{
|
||||||
if (get_fe_conn_info_ptr() == NULL)
|
if (get_fe_conn_info_ptr() == NULL) {
|
||||||
set_fe_conn_info_ptr((void*)new cal_connection_info());
|
set_fe_conn_info_ptr((void*)new cal_connection_info());
|
||||||
|
thd_set_ha_data(current_thd, mcs_hton, get_fe_conn_info_ptr());
|
||||||
|
}
|
||||||
|
|
||||||
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(get_fe_conn_info_ptr());
|
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(get_fe_conn_info_ptr());
|
||||||
|
|
||||||
@@ -4838,8 +4848,10 @@ ReturnedColumn* buildAggregateColumn(Item* item, gp_walk_info& gwi)
|
|||||||
vector<SRCP> orderCols;
|
vector<SRCP> orderCols;
|
||||||
ConstArgParam constArgParam;
|
ConstArgParam constArgParam;
|
||||||
|
|
||||||
if (get_fe_conn_info_ptr() == NULL)
|
if (get_fe_conn_info_ptr() == NULL) {
|
||||||
set_fe_conn_info_ptr((void*)new cal_connection_info());
|
set_fe_conn_info_ptr((void*)new cal_connection_info());
|
||||||
|
thd_set_ha_data(current_thd, mcs_hton, get_fe_conn_info_ptr());
|
||||||
|
}
|
||||||
|
|
||||||
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(get_fe_conn_info_ptr());
|
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(get_fe_conn_info_ptr());
|
||||||
|
|
||||||
|
@@ -775,8 +775,10 @@ vector<string> getOnUpdateTimestampColumns(string& schema, string& tableName, in
|
|||||||
|
|
||||||
uint32_t doUpdateDelete(THD* thd, gp_walk_info& gwi, const std::vector<COND*>& condStack)
|
uint32_t doUpdateDelete(THD* thd, gp_walk_info& gwi, const std::vector<COND*>& condStack)
|
||||||
{
|
{
|
||||||
if (get_fe_conn_info_ptr() == nullptr)
|
if (get_fe_conn_info_ptr() == nullptr) {
|
||||||
set_fe_conn_info_ptr((void*)new cal_connection_info());
|
set_fe_conn_info_ptr((void*)new cal_connection_info());
|
||||||
|
thd_set_ha_data(thd, mcs_hton, get_fe_conn_info_ptr());
|
||||||
|
}
|
||||||
|
|
||||||
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(get_fe_conn_info_ptr());
|
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(get_fe_conn_info_ptr());
|
||||||
|
|
||||||
@@ -2072,8 +2074,10 @@ int ha_mcs_impl_analyze(THD* thd, TABLE* table)
|
|||||||
query.assign(idb_mysql_query_str(thd));
|
query.assign(idb_mysql_query_str(thd));
|
||||||
caep->data(query);
|
caep->data(query);
|
||||||
|
|
||||||
if (!get_fe_conn_info_ptr())
|
if (!get_fe_conn_info_ptr()) {
|
||||||
set_fe_conn_info_ptr(reinterpret_cast<void*>(new cal_connection_info(), thd));
|
set_fe_conn_info_ptr(reinterpret_cast<void*>(new cal_connection_info(), thd));
|
||||||
|
thd_set_ha_data(thd, mcs_hton, get_fe_conn_info_ptr());
|
||||||
|
}
|
||||||
|
|
||||||
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(get_fe_conn_info_ptr());
|
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(get_fe_conn_info_ptr());
|
||||||
idbassert(ci != 0);
|
idbassert(ci != 0);
|
||||||
@@ -2268,8 +2272,10 @@ int ha_mcs::impl_rnd_init(TABLE* table, const std::vector<COND*>& condStack)
|
|||||||
boost::shared_ptr<CalpontSystemCatalog> csc = CalpontSystemCatalog::makeCalpontSystemCatalog(sessionID);
|
boost::shared_ptr<CalpontSystemCatalog> csc = CalpontSystemCatalog::makeCalpontSystemCatalog(sessionID);
|
||||||
csc->identity(CalpontSystemCatalog::FE);
|
csc->identity(CalpontSystemCatalog::FE);
|
||||||
|
|
||||||
if (get_fe_conn_info_ptr() == nullptr)
|
if (get_fe_conn_info_ptr() == nullptr) {
|
||||||
set_fe_conn_info_ptr((void*)new cal_connection_info());
|
set_fe_conn_info_ptr((void*)new cal_connection_info());
|
||||||
|
thd_set_ha_data(thd, mcs_hton, get_fe_conn_info_ptr());
|
||||||
|
}
|
||||||
|
|
||||||
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(get_fe_conn_info_ptr());
|
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(get_fe_conn_info_ptr());
|
||||||
|
|
||||||
@@ -2592,8 +2598,10 @@ int ha_mcs_impl_rnd_next(uchar* buf, TABLE* table, long timeZone)
|
|||||||
// if (MIGR::infinidb_vtable.impossibleWhereOnUnion)
|
// if (MIGR::infinidb_vtable.impossibleWhereOnUnion)
|
||||||
// return HA_ERR_END_OF_FILE;
|
// return HA_ERR_END_OF_FILE;
|
||||||
|
|
||||||
if (get_fe_conn_info_ptr() == nullptr)
|
if (get_fe_conn_info_ptr() == nullptr) {
|
||||||
set_fe_conn_info_ptr((void*)new cal_connection_info());
|
set_fe_conn_info_ptr((void*)new cal_connection_info());
|
||||||
|
thd_set_ha_data(thd, mcs_hton, get_fe_conn_info_ptr());
|
||||||
|
}
|
||||||
|
|
||||||
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(get_fe_conn_info_ptr());
|
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(get_fe_conn_info_ptr());
|
||||||
|
|
||||||
@@ -2678,6 +2686,7 @@ int ha_mcs_impl_rnd_end(TABLE* table, bool is_pushdown_hand)
|
|||||||
{
|
{
|
||||||
set_fe_conn_info_ptr((void*)new cal_connection_info());
|
set_fe_conn_info_ptr((void*)new cal_connection_info());
|
||||||
ci = reinterpret_cast<cal_connection_info*>(get_fe_conn_info_ptr());
|
ci = reinterpret_cast<cal_connection_info*>(get_fe_conn_info_ptr());
|
||||||
|
thd_set_ha_data(thd, mcs_hton, ci);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (thd->killed == KILL_QUERY || thd->killed == KILL_QUERY_HARD)
|
if (thd->killed == KILL_QUERY || thd->killed == KILL_QUERY_HARD)
|
||||||
@@ -2775,8 +2784,10 @@ int ha_mcs_impl_create(const char* name, TABLE* table_arg, HA_CREATE_INFO* creat
|
|||||||
{
|
{
|
||||||
THD* thd = current_thd;
|
THD* thd = current_thd;
|
||||||
|
|
||||||
if (get_fe_conn_info_ptr() == nullptr)
|
if (get_fe_conn_info_ptr() == nullptr) {
|
||||||
set_fe_conn_info_ptr((void*)new cal_connection_info());
|
set_fe_conn_info_ptr((void*)new cal_connection_info());
|
||||||
|
thd_set_ha_data(thd, mcs_hton, get_fe_conn_info_ptr());
|
||||||
|
}
|
||||||
|
|
||||||
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(get_fe_conn_info_ptr());
|
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(get_fe_conn_info_ptr());
|
||||||
|
|
||||||
@@ -2817,8 +2828,10 @@ int ha_mcs_impl_delete_table(const char* name)
|
|||||||
if (!memcmp((uchar*)name, tmp_file_prefix, tmp_file_prefix_length))
|
if (!memcmp((uchar*)name, tmp_file_prefix, tmp_file_prefix_length))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (get_fe_conn_info_ptr() == nullptr)
|
if (get_fe_conn_info_ptr() == nullptr) {
|
||||||
set_fe_conn_info_ptr((void*)new cal_connection_info());
|
set_fe_conn_info_ptr((void*)new cal_connection_info());
|
||||||
|
thd_set_ha_data(thd, mcs_hton, get_fe_conn_info_ptr());
|
||||||
|
}
|
||||||
|
|
||||||
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(get_fe_conn_info_ptr());
|
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(get_fe_conn_info_ptr());
|
||||||
|
|
||||||
@@ -2880,8 +2893,10 @@ int ha_mcs_impl_write_row(const uchar* buf, TABLE* table, uint64_t rows_changed,
|
|||||||
return ER_CHECK_NOT_IMPLEMENTED;
|
return ER_CHECK_NOT_IMPLEMENTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (get_fe_conn_info_ptr() == nullptr)
|
if (get_fe_conn_info_ptr() == nullptr) {
|
||||||
set_fe_conn_info_ptr((void*)new cal_connection_info());
|
set_fe_conn_info_ptr((void*)new cal_connection_info());
|
||||||
|
thd_set_ha_data(thd, mcs_hton, get_fe_conn_info_ptr());
|
||||||
|
}
|
||||||
|
|
||||||
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(get_fe_conn_info_ptr());
|
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(get_fe_conn_info_ptr());
|
||||||
|
|
||||||
@@ -2931,8 +2946,10 @@ int ha_mcs_impl_write_row(const uchar* buf, TABLE* table, uint64_t rows_changed,
|
|||||||
|
|
||||||
int ha_mcs_impl_update_row()
|
int ha_mcs_impl_update_row()
|
||||||
{
|
{
|
||||||
if (get_fe_conn_info_ptr() == nullptr)
|
if (get_fe_conn_info_ptr() == nullptr) {
|
||||||
set_fe_conn_info_ptr((void*)new cal_connection_info());
|
set_fe_conn_info_ptr((void*)new cal_connection_info());
|
||||||
|
thd_set_ha_data(current_thd, mcs_hton, get_fe_conn_info_ptr());
|
||||||
|
}
|
||||||
|
|
||||||
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(get_fe_conn_info_ptr());
|
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(get_fe_conn_info_ptr());
|
||||||
int rc = ci->rc;
|
int rc = ci->rc;
|
||||||
@@ -2945,8 +2962,10 @@ int ha_mcs_impl_update_row()
|
|||||||
|
|
||||||
int ha_mcs_impl_delete_row()
|
int ha_mcs_impl_delete_row()
|
||||||
{
|
{
|
||||||
if (get_fe_conn_info_ptr() == nullptr)
|
if (get_fe_conn_info_ptr() == nullptr) {
|
||||||
set_fe_conn_info_ptr((void*)new cal_connection_info());
|
set_fe_conn_info_ptr((void*)new cal_connection_info());
|
||||||
|
thd_set_ha_data(current_thd, mcs_hton, get_fe_conn_info_ptr());
|
||||||
|
}
|
||||||
|
|
||||||
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(get_fe_conn_info_ptr());
|
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(get_fe_conn_info_ptr());
|
||||||
int rc = ci->rc;
|
int rc = ci->rc;
|
||||||
@@ -2964,8 +2983,10 @@ void ha_mcs_impl_start_bulk_insert(ha_rows rows, TABLE* table, bool is_cache_ins
|
|||||||
if (thd->slave_thread && !get_replication_slave(thd))
|
if (thd->slave_thread && !get_replication_slave(thd))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (get_fe_conn_info_ptr() == nullptr)
|
if (get_fe_conn_info_ptr() == nullptr) {
|
||||||
set_fe_conn_info_ptr((void*)new cal_connection_info());
|
set_fe_conn_info_ptr((void*)new cal_connection_info());
|
||||||
|
thd_set_ha_data(thd, mcs_hton, get_fe_conn_info_ptr());
|
||||||
|
}
|
||||||
|
|
||||||
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(get_fe_conn_info_ptr());
|
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(get_fe_conn_info_ptr());
|
||||||
|
|
||||||
@@ -3518,8 +3539,10 @@ int ha_mcs_impl_end_bulk_insert(bool abort, TABLE* table)
|
|||||||
|
|
||||||
std::string aTmpDir(startup::StartUp::tmpDir());
|
std::string aTmpDir(startup::StartUp::tmpDir());
|
||||||
|
|
||||||
if (get_fe_conn_info_ptr() == nullptr)
|
if (get_fe_conn_info_ptr() == nullptr) {
|
||||||
set_fe_conn_info_ptr((void*)new cal_connection_info());
|
set_fe_conn_info_ptr((void*)new cal_connection_info());
|
||||||
|
thd_set_ha_data(thd, mcs_hton, get_fe_conn_info_ptr());
|
||||||
|
}
|
||||||
|
|
||||||
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(get_fe_conn_info_ptr());
|
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(get_fe_conn_info_ptr());
|
||||||
|
|
||||||
@@ -3669,7 +3692,12 @@ int ha_mcs_impl_end_bulk_insert(bool abort, TABLE* table)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ha_mcs_impl::log_this(thd, "End SQL statement with error", logging::LOG_TYPE_DEBUG,
|
ostringstream oss;
|
||||||
|
oss << "End SQL statement with error, rc=" << rc
|
||||||
|
<< ", aPid=" << aPid
|
||||||
|
<< ", WIF=" << WIFEXITED(aStatus)
|
||||||
|
<< ", WEXIT=" << WEXITSTATUS(aStatus);
|
||||||
|
ha_mcs_impl::log_this(thd, oss.str().c_str(), logging::LOG_TYPE_DEBUG,
|
||||||
tid2sid(thd->thread_id));
|
tid2sid(thd->thread_id));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3756,8 +3784,10 @@ int ha_mcs_impl_end_bulk_insert(bool abort, TABLE* table)
|
|||||||
|
|
||||||
int ha_mcs_impl_commit(handlerton* hton, THD* thd, bool all)
|
int ha_mcs_impl_commit(handlerton* hton, THD* thd, bool all)
|
||||||
{
|
{
|
||||||
if (get_fe_conn_info_ptr() == nullptr)
|
if (get_fe_conn_info_ptr() == nullptr) {
|
||||||
set_fe_conn_info_ptr((void*)new cal_connection_info());
|
set_fe_conn_info_ptr((void*)new cal_connection_info());
|
||||||
|
thd_set_ha_data(thd, mcs_hton, get_fe_conn_info_ptr());
|
||||||
|
}
|
||||||
|
|
||||||
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(get_fe_conn_info_ptr());
|
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(get_fe_conn_info_ptr());
|
||||||
|
|
||||||
@@ -3789,8 +3819,10 @@ int ha_mcs_impl_commit(handlerton* hton, THD* thd, bool all)
|
|||||||
|
|
||||||
int ha_mcs_impl_rollback(handlerton* hton, THD* thd, bool all)
|
int ha_mcs_impl_rollback(handlerton* hton, THD* thd, bool all)
|
||||||
{
|
{
|
||||||
if (get_fe_conn_info_ptr() == nullptr)
|
if (get_fe_conn_info_ptr() == nullptr) {
|
||||||
set_fe_conn_info_ptr((void*)new cal_connection_info());
|
set_fe_conn_info_ptr((void*)new cal_connection_info());
|
||||||
|
thd_set_ha_data(thd, mcs_hton, get_fe_conn_info_ptr());
|
||||||
|
}
|
||||||
|
|
||||||
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(get_fe_conn_info_ptr());
|
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(get_fe_conn_info_ptr());
|
||||||
|
|
||||||
@@ -3848,6 +3880,10 @@ int ha_mcs_impl_close_connection(handlerton* hton, THD* thd)
|
|||||||
ci->cal_conn_hndl = 0;
|
ci->cal_conn_hndl = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
delete ci;
|
||||||
|
set_fe_conn_info_ptr(nullptr, thd);
|
||||||
|
thd_set_ha_data(thd, hton, nullptr);
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3855,8 +3891,10 @@ int ha_mcs_impl_rename_table(const char* from, const char* to)
|
|||||||
{
|
{
|
||||||
IDEBUG(cout << "ha_mcs_impl_rename_table: " << from << " => " << to << endl);
|
IDEBUG(cout << "ha_mcs_impl_rename_table: " << from << " => " << to << endl);
|
||||||
|
|
||||||
if (get_fe_conn_info_ptr() == nullptr)
|
if (get_fe_conn_info_ptr() == nullptr) {
|
||||||
set_fe_conn_info_ptr((void*)new cal_connection_info());
|
set_fe_conn_info_ptr((void*)new cal_connection_info());
|
||||||
|
thd_set_ha_data(current_thd, mcs_hton, get_fe_conn_info_ptr());
|
||||||
|
}
|
||||||
|
|
||||||
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(get_fe_conn_info_ptr());
|
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(get_fe_conn_info_ptr());
|
||||||
|
|
||||||
@@ -3899,8 +3937,10 @@ COND* ha_mcs_impl_cond_push(COND* cond, TABLE* table, std::vector<COND*>& condSt
|
|||||||
alias.assign(table->alias.ptr(), table->alias.length());
|
alias.assign(table->alias.ptr(), table->alias.length());
|
||||||
IDEBUG(cout << "ha_mcs_impl_cond_push: " << alias << endl);
|
IDEBUG(cout << "ha_mcs_impl_cond_push: " << alias << endl);
|
||||||
|
|
||||||
if (get_fe_conn_info_ptr() == nullptr)
|
if (get_fe_conn_info_ptr() == nullptr) {
|
||||||
set_fe_conn_info_ptr((void*)new cal_connection_info());
|
set_fe_conn_info_ptr((void*)new cal_connection_info());
|
||||||
|
thd_set_ha_data(thd, mcs_hton, get_fe_conn_info_ptr());
|
||||||
|
}
|
||||||
|
|
||||||
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(get_fe_conn_info_ptr());
|
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(get_fe_conn_info_ptr());
|
||||||
|
|
||||||
@@ -4006,8 +4046,10 @@ int ha_mcs::impl_external_lock(THD* thd, TABLE* table, int lock_type)
|
|||||||
alias.assign(table->alias.ptr(), table->alias.length());
|
alias.assign(table->alias.ptr(), table->alias.length());
|
||||||
IDEBUG(cout << "external_lock for " << alias << endl);
|
IDEBUG(cout << "external_lock for " << alias << endl);
|
||||||
|
|
||||||
if (get_fe_conn_info_ptr() == nullptr)
|
if (get_fe_conn_info_ptr() == nullptr) {
|
||||||
set_fe_conn_info_ptr((void*)new cal_connection_info());
|
set_fe_conn_info_ptr((void*)new cal_connection_info());
|
||||||
|
thd_set_ha_data(thd, mcs_hton, get_fe_conn_info_ptr());
|
||||||
|
}
|
||||||
|
|
||||||
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(get_fe_conn_info_ptr());
|
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(get_fe_conn_info_ptr());
|
||||||
|
|
||||||
@@ -4169,8 +4211,10 @@ int ha_mcs_impl_group_by_init(mcs_handler_info* handler_info, TABLE* table)
|
|||||||
boost::shared_ptr<CalpontSystemCatalog> csc = CalpontSystemCatalog::makeCalpontSystemCatalog(sessionID);
|
boost::shared_ptr<CalpontSystemCatalog> csc = CalpontSystemCatalog::makeCalpontSystemCatalog(sessionID);
|
||||||
csc->identity(CalpontSystemCatalog::FE);
|
csc->identity(CalpontSystemCatalog::FE);
|
||||||
|
|
||||||
if (get_fe_conn_info_ptr() == nullptr)
|
if (get_fe_conn_info_ptr() == nullptr) {
|
||||||
set_fe_conn_info_ptr((void*)new cal_connection_info());
|
set_fe_conn_info_ptr((void*)new cal_connection_info());
|
||||||
|
thd_set_ha_data(thd, mcs_hton, get_fe_conn_info_ptr());
|
||||||
|
}
|
||||||
|
|
||||||
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(get_fe_conn_info_ptr());
|
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(get_fe_conn_info_ptr());
|
||||||
|
|
||||||
@@ -4586,8 +4630,10 @@ int ha_mcs_impl_group_by_next(TABLE* table, long timeZone)
|
|||||||
if (isMCSTableUpdate(thd) || isMCSTableDelete(thd))
|
if (isMCSTableUpdate(thd) || isMCSTableDelete(thd))
|
||||||
return HA_ERR_END_OF_FILE;
|
return HA_ERR_END_OF_FILE;
|
||||||
|
|
||||||
if (get_fe_conn_info_ptr() == nullptr)
|
if (get_fe_conn_info_ptr() == nullptr) {
|
||||||
set_fe_conn_info_ptr((void*)new cal_connection_info());
|
set_fe_conn_info_ptr((void*)new cal_connection_info());
|
||||||
|
thd_set_ha_data(thd, mcs_hton, get_fe_conn_info_ptr());
|
||||||
|
}
|
||||||
|
|
||||||
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(get_fe_conn_info_ptr());
|
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(get_fe_conn_info_ptr());
|
||||||
|
|
||||||
@@ -4667,6 +4713,7 @@ int ha_mcs_impl_group_by_end(TABLE* table)
|
|||||||
{
|
{
|
||||||
set_fe_conn_info_ptr((void*)new cal_connection_info());
|
set_fe_conn_info_ptr((void*)new cal_connection_info());
|
||||||
ci = reinterpret_cast<cal_connection_info*>(get_fe_conn_info_ptr());
|
ci = reinterpret_cast<cal_connection_info*>(get_fe_conn_info_ptr());
|
||||||
|
thd_set_ha_data(thd, mcs_hton, ci);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (((thd->lex)->sql_command == SQLCOM_INSERT) || ((thd->lex)->sql_command == SQLCOM_INSERT_SELECT))
|
if (((thd->lex)->sql_command == SQLCOM_INSERT) || ((thd->lex)->sql_command == SQLCOM_INSERT_SELECT))
|
||||||
@@ -4870,8 +4917,10 @@ int ha_mcs_impl_pushdown_init(mcs_handler_info* handler_info, TABLE* table)
|
|||||||
boost::shared_ptr<CalpontSystemCatalog> csc = CalpontSystemCatalog::makeCalpontSystemCatalog(sessionID);
|
boost::shared_ptr<CalpontSystemCatalog> csc = CalpontSystemCatalog::makeCalpontSystemCatalog(sessionID);
|
||||||
csc->identity(CalpontSystemCatalog::FE);
|
csc->identity(CalpontSystemCatalog::FE);
|
||||||
|
|
||||||
if (!get_fe_conn_info_ptr())
|
if (!get_fe_conn_info_ptr()) {
|
||||||
set_fe_conn_info_ptr(reinterpret_cast<void*>(new cal_connection_info(), thd));
|
set_fe_conn_info_ptr(reinterpret_cast<void*>(new cal_connection_info(), thd));
|
||||||
|
thd_set_ha_data(thd, mcs_hton, get_fe_conn_info_ptr());
|
||||||
|
}
|
||||||
|
|
||||||
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(get_fe_conn_info_ptr());
|
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(get_fe_conn_info_ptr());
|
||||||
|
|
||||||
@@ -5271,8 +5320,10 @@ int ha_mcs_impl_select_next(uchar* buf, TABLE* table, long timeZone)
|
|||||||
|
|
||||||
int rc = HA_ERR_END_OF_FILE;
|
int rc = HA_ERR_END_OF_FILE;
|
||||||
|
|
||||||
if (get_fe_conn_info_ptr() == nullptr)
|
if (get_fe_conn_info_ptr() == nullptr) {
|
||||||
set_fe_conn_info_ptr((void*)new cal_connection_info());
|
set_fe_conn_info_ptr((void*)new cal_connection_info());
|
||||||
|
thd_set_ha_data(thd, mcs_hton, get_fe_conn_info_ptr());
|
||||||
|
}
|
||||||
|
|
||||||
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(get_fe_conn_info_ptr());
|
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(get_fe_conn_info_ptr());
|
||||||
|
|
||||||
|
@@ -233,12 +233,10 @@ void* get_fe_conn_info_ptr(THD* thd)
|
|||||||
|
|
||||||
void set_fe_conn_info_ptr(void* ptr, THD* thd)
|
void set_fe_conn_info_ptr(void* ptr, THD* thd)
|
||||||
{
|
{
|
||||||
if (current_thd == NULL && thd == NULL)
|
if (thd == NULL) thd = current_thd;
|
||||||
{
|
if (thd == NULL) return;
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
THDVAR(current_thd, fe_conn_info_ptr) = (uint64_t)(ptr);
|
THDVAR(thd, fe_conn_info_ptr) = (uint64_t)(ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
ulonglong get_original_optimizer_flags(THD* thd)
|
ulonglong get_original_optimizer_flags(THD* thd)
|
||||||
|
@@ -20,6 +20,7 @@ using namespace execplan;
|
|||||||
#include "functor.h"
|
#include "functor.h"
|
||||||
#include "functor_str.h"
|
#include "functor_str.h"
|
||||||
|
|
||||||
|
#include "ha_mcs.h"
|
||||||
#include "ha_mcs_impl_if.h"
|
#include "ha_mcs_impl_if.h"
|
||||||
#include "ha_mcs_sysvars.h"
|
#include "ha_mcs_sysvars.h"
|
||||||
using namespace cal_impl_if;
|
using namespace cal_impl_if;
|
||||||
@@ -53,8 +54,10 @@ void bailout(char* error, const string& funcName)
|
|||||||
|
|
||||||
int64_t idblocalpm()
|
int64_t idblocalpm()
|
||||||
{
|
{
|
||||||
if (get_fe_conn_info_ptr() == NULL)
|
if (get_fe_conn_info_ptr() == NULL) {
|
||||||
set_fe_conn_info_ptr((void*)new cal_connection_info());
|
set_fe_conn_info_ptr((void*)new cal_connection_info());
|
||||||
|
thd_set_ha_data(current_thd, mcs_hton, get_fe_conn_info_ptr());
|
||||||
|
}
|
||||||
|
|
||||||
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(get_fe_conn_info_ptr());
|
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(get_fe_conn_info_ptr());
|
||||||
|
|
||||||
@@ -477,8 +480,10 @@ uint32_t isPseudoColumn(string funcName)
|
|||||||
execplan::ReturnedColumn* buildPseudoColumn(Item* item, gp_walk_info& gwi, bool& nonSupport,
|
execplan::ReturnedColumn* buildPseudoColumn(Item* item, gp_walk_info& gwi, bool& nonSupport,
|
||||||
uint32_t pseudoType)
|
uint32_t pseudoType)
|
||||||
{
|
{
|
||||||
if (get_fe_conn_info_ptr() == NULL)
|
if (get_fe_conn_info_ptr() == NULL) {
|
||||||
set_fe_conn_info_ptr((void*)new cal_connection_info());
|
set_fe_conn_info_ptr((void*)new cal_connection_info());
|
||||||
|
thd_set_ha_data(current_thd, mcs_hton, get_fe_conn_info_ptr());
|
||||||
|
}
|
||||||
|
|
||||||
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(get_fe_conn_info_ptr());
|
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(get_fe_conn_info_ptr());
|
||||||
|
|
||||||
|
@@ -30,6 +30,7 @@ using namespace std;
|
|||||||
#include "idb_mysql.h"
|
#include "idb_mysql.h"
|
||||||
#include "ha_mcs_impl_if.h"
|
#include "ha_mcs_impl_if.h"
|
||||||
#include "ha_mcs_sysvars.h"
|
#include "ha_mcs_sysvars.h"
|
||||||
|
#include "ha_mcs.h"
|
||||||
|
|
||||||
#include "arithmeticcolumn.h"
|
#include "arithmeticcolumn.h"
|
||||||
#include "arithmeticoperator.h"
|
#include "arithmeticoperator.h"
|
||||||
@@ -95,8 +96,10 @@ WF_FRAME frame(Window_frame_bound::Bound_precedence_type bound, Item* offset)
|
|||||||
}
|
}
|
||||||
ReturnedColumn* buildBoundExp(WF_Boundary& bound, SRCP& order, gp_walk_info& gwi)
|
ReturnedColumn* buildBoundExp(WF_Boundary& bound, SRCP& order, gp_walk_info& gwi)
|
||||||
{
|
{
|
||||||
if (get_fe_conn_info_ptr() == NULL)
|
if (get_fe_conn_info_ptr() == NULL) {
|
||||||
set_fe_conn_info_ptr((void*)new cal_connection_info());
|
set_fe_conn_info_ptr((void*)new cal_connection_info());
|
||||||
|
thd_set_ha_data(current_thd, mcs_hton, get_fe_conn_info_ptr());
|
||||||
|
}
|
||||||
|
|
||||||
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(get_fe_conn_info_ptr());
|
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(get_fe_conn_info_ptr());
|
||||||
|
|
||||||
@@ -302,8 +305,10 @@ ReturnedColumn* buildWindowFunctionColumn(Item* item, gp_walk_info& gwi, bool& n
|
|||||||
// String str;
|
// String str;
|
||||||
// item->print(&str, QT_INFINIDB_NO_QUOTE);
|
// item->print(&str, QT_INFINIDB_NO_QUOTE);
|
||||||
// cout << str.c_ptr() << endl;
|
// cout << str.c_ptr() << endl;
|
||||||
if (get_fe_conn_info_ptr() == NULL)
|
if (get_fe_conn_info_ptr() == NULL) {
|
||||||
set_fe_conn_info_ptr((void*)new cal_connection_info());
|
set_fe_conn_info_ptr((void*)new cal_connection_info());
|
||||||
|
thd_set_ha_data(current_thd, mcs_hton, get_fe_conn_info_ptr());
|
||||||
|
}
|
||||||
|
|
||||||
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(get_fe_conn_info_ptr());
|
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(get_fe_conn_info_ptr());
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user