1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-29 08:21:15 +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 00e766253c
commit ff534dba7f
6 changed files with 54 additions and 52 deletions

View File

@ -27,7 +27,7 @@
#include <cassert>
#include <stdexcept>
#include <sstream>
//#include <unistd.h>
// #include <unistd.h>
#include <iomanip>
using namespace std;
@ -378,13 +378,12 @@ void partitionByValue_common(UDF_ARGS* args, // inp
try
{
boost::shared_ptr<CalpontSystemCatalog> csc =
CalpontSystemCatalog::makeCalpontSystemCatalog(tid2sid(current_thd->thread_id));
csc->identity(execplan::CalpontSystemCatalog::FE);
CalpontSystemCatalog csc;
csc.identity(execplan::CalpontSystemCatalog::FE);
CalpontSystemCatalog::TableColName tcn = make_tcn(schema, table, column, lower_case_table_names);
csc->identity(CalpontSystemCatalog::FE);
OID_t oid = csc->lookupOID(tcn);
CalpontSystemCatalog::ColType ct = csc->colType(oid);
csc.identity(CalpontSystemCatalog::FE);
OID_t oid = csc.lookupOID(tcn);
CalpontSystemCatalog::ColType ct = csc.colType(oid);
const char* timeZone = current_thd->variables.time_zone->get_name()->ptr();
long timeZoneOffset;
dataconvert::timeZoneToOffset(timeZone, strlen(timeZone), &timeZoneOffset);
@ -626,12 +625,11 @@ extern "C"
}
boost::algorithm::to_lower(column);
boost::shared_ptr<CalpontSystemCatalog> csc =
CalpontSystemCatalog::makeCalpontSystemCatalog(tid2sid(current_thd->thread_id));
csc->identity(CalpontSystemCatalog::FE);
CalpontSystemCatalog csc;
csc.identity(CalpontSystemCatalog::FE);
CalpontSystemCatalog::TableColName tcn = make_tcn(schema, table, column, lower_case_table_names);
OID_t oid = csc->lookupOID(tcn);
ct = csc->colType(oid);
OID_t oid = csc.lookupOID(tcn);
ct = csc.colType(oid);
if (oid == -1)
{
@ -701,7 +699,6 @@ extern "C"
else
output << "Enabled";
}
// use our own buffer to make sure it fits.
initid->ptr = new char[output.str().length() + 1];
memcpy(initid->ptr, output.str().c_str(), output.str().length());
@ -1294,12 +1291,11 @@ extern "C"
}
boost::algorithm::to_lower(column);
boost::shared_ptr<CalpontSystemCatalog> csc =
CalpontSystemCatalog::makeCalpontSystemCatalog(tid2sid(current_thd->thread_id));
csc->identity(CalpontSystemCatalog::FE);
CalpontSystemCatalog csc;
csc.identity(CalpontSystemCatalog::FE);
CalpontSystemCatalog::TableColName tcn = make_tcn(schema, table, column, lower_case_table_names);
OID_t oid = csc->lookupOID(tcn);
ct = csc->colType(oid);
OID_t oid = csc.lookupOID(tcn);
ct = csc.colType(oid);
if (oid == -1)
{