1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-08-01 06:46:55 +03:00

MCOL-5384 This commit replaces shared pointer to CSC with CSC ctor that is cleaned up leaving a scope

CSC default ctor was private b/c it must not allow to use CSC outside thread cache.
  However there are some places in the plugin code that need a standalone syscat that
  is cleaned up leaving the scope. The decision is to make the restriction mentioned
  organizational rather than syntactical.
This commit is contained in:
Roman Nozdrin
2023-01-24 12:54:50 +00:00
parent c07e0c1cae
commit b989238ff7
6 changed files with 54 additions and 52 deletions

View File

@ -38,7 +38,7 @@ using namespace oam;
#include "errorids.h"
using namespace logging;
//#include "resourcemanager.h"
// #include "resourcemanager.h"
#include "columnstoreversion.h"
#include "ha_mcs_sysvars.h"
@ -97,7 +97,8 @@ extern "C"
std::string pstr(parameter);
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());
thd_set_ha_data(thd, mcs_hton, get_fe_conn_info_ptr());
}
@ -198,7 +199,8 @@ extern "C"
const char* calgetstats(UDF_INIT* initid, UDF_ARGS* args, char* result, unsigned long* length,
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());
thd_set_ha_data(current_thd, mcs_hton, get_fe_conn_info_ptr());
}
@ -250,7 +252,8 @@ extern "C"
#endif
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());
thd_set_ha_data(current_thd, mcs_hton, get_fe_conn_info_ptr());
}
@ -298,7 +301,7 @@ extern "C"
try
{
if (dbrm.getSystemReady() > 0 && dbrm.getSystemQueryReady() > 0)
if (dbrm.getSystemReady() > 0 && dbrm.getSystemQueryReady() > 0)
{
return 1;
}
@ -462,7 +465,8 @@ extern "C"
{
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());
thd_set_ha_data(thd, mcs_hton, get_fe_conn_info_ptr());
}
@ -541,7 +545,8 @@ extern "C"
const char* calcleartablelock(UDF_INIT* initid, UDF_ARGS* args, char* result, unsigned long* length,
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());
thd_set_ha_data(current_thd, mcs_hton, get_fe_conn_info_ptr());
}
@ -635,14 +640,12 @@ extern "C"
boost::algorithm::to_lower(tableName.table);
}
boost::shared_ptr<execplan::CalpontSystemCatalog> csc =
execplan::CalpontSystemCatalog::makeCalpontSystemCatalog(
execplan::CalpontSystemCatalog::idb_tid2sid(thd->thread_id));
csc->identity(execplan::CalpontSystemCatalog::FE);
execplan::CalpontSystemCatalog csc;
csc.identity(execplan::CalpontSystemCatalog::FE);
try
{
nextVal = csc->nextAutoIncrValue(tableName);
nextVal = csc.nextAutoIncrValue(tableName);
}
catch (std::exception&)
{
@ -726,7 +729,8 @@ 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());
thd_set_ha_data(current_thd, mcs_hton, get_fe_conn_info_ptr());
}
@ -821,7 +825,8 @@ extern "C"
const char* calgetsqlcount(UDF_INIT* initid, UDF_ARGS* args, char* result, unsigned long* length,
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());
thd_set_ha_data(current_thd, mcs_hton, get_fe_conn_info_ptr());
}