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
MCOL-1101 Add plugin variables to replace the legacy system vars.
Legacy system vars with names infinidb_* was preserved for backward compatibility and they will be used if columnstore_use_legacy_vars variable is set. Remove unused structure and plugin variable.
This commit is contained in:
@@ -4,8 +4,8 @@ include_directories( ${ENGINE_COMMON_INCLUDES}
|
|||||||
|
|
||||||
|
|
||||||
SET ( libcalmysql_SRCS
|
SET ( libcalmysql_SRCS
|
||||||
mcs_sysvars.cpp
|
ha_mcs_sysvars.cpp
|
||||||
mcs_client_udfs.cpp
|
ha_mcs_client_udfs.cpp
|
||||||
ha_calpont.cpp
|
ha_calpont.cpp
|
||||||
ha_calpont_impl.cpp
|
ha_calpont_impl.cpp
|
||||||
ha_calpont_dml.cpp
|
ha_calpont_dml.cpp
|
||||||
|
@@ -592,9 +592,6 @@ int ha_calpont::rnd_init(bool scan)
|
|||||||
{
|
{
|
||||||
DBUG_ENTER("ha_calpont::rnd_init");
|
DBUG_ENTER("ha_calpont::rnd_init");
|
||||||
|
|
||||||
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);
|
int rc = ha_calpont_impl_rnd_init(table);
|
||||||
|
|
||||||
DBUG_RETURN(rc);
|
DBUG_RETURN(rc);
|
||||||
@@ -1241,54 +1238,6 @@ int ha_calpont_group_by_handler::end_scan()
|
|||||||
|
|
||||||
DBUG_RETURN(rc);
|
DBUG_RETURN(rc);
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
// compression_type
|
|
||||||
enum mcs_compression_type_t {
|
|
||||||
NO_COMPRESSION = 0,
|
|
||||||
SNAPPY = 2
|
|
||||||
};
|
|
||||||
|
|
||||||
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
|
|
||||||
};
|
|
||||||
|
|
||||||
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,
|
|
||||||
PLUGIN_VAR_MEMALLOC |
|
|
||||||
PLUGIN_VAR_RQCMDARG,
|
|
||||||
"Original query text",
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
NULL
|
|
||||||
);
|
|
||||||
|
|
||||||
static struct st_mysql_sys_var* columnstore_system_variables[] =
|
|
||||||
{
|
|
||||||
MYSQL_SYSVAR(compression_type),
|
|
||||||
MYSQL_SYSVAR(original_query),
|
|
||||||
NULL
|
|
||||||
};*/
|
|
||||||
|
|
||||||
mysql_declare_plugin(columnstore)
|
mysql_declare_plugin(columnstore)
|
||||||
{
|
{
|
||||||
|
@@ -19,7 +19,7 @@
|
|||||||
#define HA_CALPONT_H__
|
#define HA_CALPONT_H__
|
||||||
#include <my_config.h>
|
#include <my_config.h>
|
||||||
#include "idb_mysql.h"
|
#include "idb_mysql.h"
|
||||||
#include "mcs_sysvars.h"
|
#include "ha_mcs_sysvars.h"
|
||||||
|
|
||||||
extern handlerton* calpont_hton;
|
extern handlerton* calpont_hton;
|
||||||
|
|
||||||
|
@@ -49,7 +49,7 @@ using namespace std;
|
|||||||
#include <boost/tokenizer.hpp>
|
#include <boost/tokenizer.hpp>
|
||||||
using namespace boost;
|
using namespace boost;
|
||||||
|
|
||||||
#include "mcs_sysvars.h"
|
#include "ha_mcs_sysvars.h"
|
||||||
#include "idb_mysql.h"
|
#include "idb_mysql.h"
|
||||||
|
|
||||||
#include "ha_calpont_impl_if.h"
|
#include "ha_calpont_impl_if.h"
|
||||||
|
@@ -58,7 +58,7 @@ using namespace logging;
|
|||||||
#include "idb_mysql.h"
|
#include "idb_mysql.h"
|
||||||
|
|
||||||
#include "ha_calpont_impl_if.h"
|
#include "ha_calpont_impl_if.h"
|
||||||
#include "mcs_sysvars.h"
|
#include "ha_mcs_sysvars.h"
|
||||||
#include "ha_subquery.h"
|
#include "ha_subquery.h"
|
||||||
//#include "ha_view.h"
|
//#include "ha_view.h"
|
||||||
using namespace cal_impl_if;
|
using namespace cal_impl_if;
|
||||||
@@ -3276,7 +3276,7 @@ ArithmeticColumn* buildArithmeticColumn(
|
|||||||
//idbassert(pt->left() && pt->right() && pt->left()->data() && pt->right()->data());
|
//idbassert(pt->left() && pt->right() && pt->left()->data() && pt->right()->data());
|
||||||
CalpontSystemCatalog::ColType mysql_type = colType_MysqlToIDB(item);
|
CalpontSystemCatalog::ColType mysql_type = colType_MysqlToIDB(item);
|
||||||
|
|
||||||
if (current_thd->variables.infinidb_double_for_decimal_math == 1)
|
if (get_double_for_decimal_math(current_thd) == true)
|
||||||
aop->adjustResultType(mysql_type);
|
aop->adjustResultType(mysql_type);
|
||||||
else
|
else
|
||||||
aop->resultType(mysql_type);
|
aop->resultType(mysql_type);
|
||||||
@@ -5776,7 +5776,8 @@ int getSelectPlan(gp_walk_info& gwi, SELECT_LEX& select_lex, SCSEP& csep, bool i
|
|||||||
return ER_CHECK_NOT_IMPLEMENTED;
|
return ER_CHECK_NOT_IMPLEMENTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
gwi.internalDecimalScale = (gwi.thd->variables.infinidb_use_decimal_scale ? gwi.thd->variables.infinidb_decimal_scale : -1);
|
gwi.internalDecimalScale = (get_use_decimal_scale(gwi.thd) ? get_decimal_scale(gwi.thd) : -1);
|
||||||
|
|
||||||
gwi.subSelectType = csep->subType();
|
gwi.subSelectType = csep->subType();
|
||||||
|
|
||||||
JOIN* join = select_lex.join;
|
JOIN* join = select_lex.join;
|
||||||
@@ -5809,25 +5810,25 @@ int getSelectPlan(gp_walk_info& gwi, SELECT_LEX& select_lex, SCSEP& csep, bool i
|
|||||||
|
|
||||||
// @bug 2123. Override large table estimate if infinidb_ordered hint was used.
|
// @bug 2123. Override large table estimate if infinidb_ordered hint was used.
|
||||||
// @bug 2404. Always override if the infinidb_ordered_only variable is turned on.
|
// @bug 2404. Always override if the infinidb_ordered_only variable is turned on.
|
||||||
if (gwi.thd->infinidb_vtable.override_largeside_estimate || gwi.thd->variables.infinidb_ordered_only)
|
if (gwi.thd->infinidb_vtable.override_largeside_estimate || get_ordered_only(gwi.thd))
|
||||||
csep->overrideLargeSideEstimate(true);
|
csep->overrideLargeSideEstimate(true);
|
||||||
|
|
||||||
// @bug 5741. Set a flag when in Local PM only query mode
|
// @bug 5741. Set a flag when in Local PM only query mode
|
||||||
csep->localQuery(gwi.thd->variables.infinidb_local_query);
|
csep->localQuery(get_local_query(gwi.thd));
|
||||||
|
|
||||||
// @bug 3321. Set max number of blocks in a dictionary file to be scanned for filtering
|
// @bug 3321. Set max number of blocks in a dictionary file to be scanned for filtering
|
||||||
csep->stringScanThreshold(gwi.thd->variables.infinidb_string_scan_threshold);
|
csep->stringScanThreshold(get_string_scan_threshold(gwi.thd));
|
||||||
|
|
||||||
csep->stringTableThreshold(gwi.thd->variables.infinidb_stringtable_threshold);
|
csep->stringTableThreshold(get_stringtable_threshold(gwi.thd));
|
||||||
|
|
||||||
csep->djsSmallSideLimit(gwi.thd->variables.infinidb_diskjoin_smallsidelimit * 1024ULL * 1024);
|
csep->djsSmallSideLimit(get_diskjoin_smallsidelimit(gwi.thd) * 1024ULL * 1024);
|
||||||
csep->djsLargeSideLimit(gwi.thd->variables.infinidb_diskjoin_largesidelimit * 1024ULL * 1024);
|
csep->djsLargeSideLimit(get_diskjoin_largesidelimit(gwi.thd) * 1024ULL * 1024);
|
||||||
csep->djsPartitionSize(gwi.thd->variables.infinidb_diskjoin_bucketsize * 1024ULL * 1024);
|
csep->djsPartitionSize(get_diskjoin_bucketsize(gwi.thd) * 1024ULL * 1024);
|
||||||
|
|
||||||
if (gwi.thd->variables.infinidb_um_mem_limit == 0)
|
if (get_um_mem_limit(gwi.thd) == 0)
|
||||||
csep->umMemLimit(numeric_limits<int64_t>::max());
|
csep->umMemLimit(numeric_limits<int64_t>::max());
|
||||||
else
|
else
|
||||||
csep->umMemLimit(gwi.thd->variables.infinidb_um_mem_limit * 1024ULL * 1024);
|
csep->umMemLimit(get_um_mem_limit(gwi.thd) * 1024ULL * 1024);
|
||||||
|
|
||||||
// populate table map and trigger syscolumn cache for all the tables (@bug 1637).
|
// populate table map and trigger syscolumn cache for all the tables (@bug 1637).
|
||||||
// all tables on FROM list must have at least one col in colmap
|
// all tables on FROM list must have at least one col in colmap
|
||||||
@@ -8242,7 +8243,7 @@ int cp_get_table_plan(THD* thd, SCSEP& csep, cal_table_info& ti)
|
|||||||
csep->tableList(tblist);
|
csep->tableList(tblist);
|
||||||
|
|
||||||
// @bug 3321. Set max number of blocks in a dictionary file to be scanned for filtering
|
// @bug 3321. Set max number of blocks in a dictionary file to be scanned for filtering
|
||||||
csep->stringScanThreshold(gwi->thd->variables.infinidb_string_scan_threshold);
|
csep->stringScanThreshold(get_string_scan_threshold(gwi->thd));
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -8340,7 +8341,7 @@ int getGroupPlan(gp_walk_info& gwi, SELECT_LEX& select_lex, SCSEP& csep, cal_gro
|
|||||||
return ER_CHECK_NOT_IMPLEMENTED;
|
return ER_CHECK_NOT_IMPLEMENTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
gwi.internalDecimalScale = (gwi.thd->variables.infinidb_use_decimal_scale ? gwi.thd->variables.infinidb_decimal_scale : -1);
|
gwi.internalDecimalScale = (get_use_decimal_scale(gwi.thd) ? get_decimal_scale(gwi.thd) : -1);
|
||||||
gwi.subSelectType = csep->subType();
|
gwi.subSelectType = csep->subType();
|
||||||
|
|
||||||
JOIN* join = select_lex.join;
|
JOIN* join = select_lex.join;
|
||||||
@@ -8357,25 +8358,25 @@ int getGroupPlan(gp_walk_info& gwi, SELECT_LEX& select_lex, SCSEP& csep, cal_gro
|
|||||||
|
|
||||||
// @bug 2123. Override large table estimate if infinidb_ordered hint was used.
|
// @bug 2123. Override large table estimate if infinidb_ordered hint was used.
|
||||||
// @bug 2404. Always override if the infinidb_ordered_only variable is turned on.
|
// @bug 2404. Always override if the infinidb_ordered_only variable is turned on.
|
||||||
if (gwi.thd->infinidb_vtable.override_largeside_estimate || gwi.thd->variables.infinidb_ordered_only)
|
if (gwi.thd->infinidb_vtable.override_largeside_estimate || get_ordered_only(gwi.thd))
|
||||||
csep->overrideLargeSideEstimate(true);
|
csep->overrideLargeSideEstimate(true);
|
||||||
|
|
||||||
// @bug 5741. Set a flag when in Local PM only query mode
|
// @bug 5741. Set a flag when in Local PM only query mode
|
||||||
csep->localQuery(gwi.thd->variables.infinidb_local_query);
|
csep->localQuery(get_local_query(gwi.thd));
|
||||||
|
|
||||||
// @bug 3321. Set max number of blocks in a dictionary file to be scanned for filtering
|
// @bug 3321. Set max number of blocks in a dictionary file to be scanned for filtering
|
||||||
csep->stringScanThreshold(gwi.thd->variables.infinidb_string_scan_threshold);
|
csep->stringScanThreshold(get_string_scan_threshold(gwi.thd));
|
||||||
|
|
||||||
csep->stringTableThreshold(gwi.thd->variables.infinidb_stringtable_threshold);
|
csep->stringTableThreshold(get_stringtable_threshold(gwi.thd));
|
||||||
|
|
||||||
csep->djsSmallSideLimit(gwi.thd->variables.infinidb_diskjoin_smallsidelimit * 1024ULL * 1024);
|
csep->djsSmallSideLimit(get_diskjoin_smallsidelimit(gwi.thd) * 1024ULL * 1024);
|
||||||
csep->djsLargeSideLimit(gwi.thd->variables.infinidb_diskjoin_largesidelimit * 1024ULL * 1024);
|
csep->djsLargeSideLimit(get_diskjoin_largesidelimit(gwi.thd) * 1024ULL * 1024);
|
||||||
csep->djsPartitionSize(gwi.thd->variables.infinidb_diskjoin_bucketsize * 1024ULL * 1024);
|
csep->djsPartitionSize(get_diskjoin_bucketsize(gwi.thd) * 1024ULL * 1024);
|
||||||
|
|
||||||
if (gwi.thd->variables.infinidb_um_mem_limit == 0)
|
if (get_um_mem_limit(gwi.thd) == 0)
|
||||||
csep->umMemLimit(numeric_limits<int64_t>::max());
|
csep->umMemLimit(numeric_limits<int64_t>::max());
|
||||||
else
|
else
|
||||||
csep->umMemLimit(gwi.thd->variables.infinidb_um_mem_limit * 1024ULL * 1024);
|
csep->umMemLimit(get_um_mem_limit(gwi.thd) * 1024ULL * 1024);
|
||||||
|
|
||||||
// populate table map and trigger syscolumn cache for all the tables (@bug 1637).
|
// populate table map and trigger syscolumn cache for all the tables (@bug 1637).
|
||||||
// all tables on FROM list must have at least one col in colmap
|
// all tables on FROM list must have at least one col in colmap
|
||||||
|
@@ -142,7 +142,7 @@ using namespace funcexp;
|
|||||||
|
|
||||||
#include "installdir.h"
|
#include "installdir.h"
|
||||||
#include "columnstoreversion.h"
|
#include "columnstoreversion.h"
|
||||||
#include "mcs_sysvars.h"
|
#include "ha_mcs_sysvars.h"
|
||||||
|
|
||||||
namespace cal_impl_if
|
namespace cal_impl_if
|
||||||
{
|
{
|
||||||
@@ -560,7 +560,7 @@ int fetchNextRow(uchar* buf, cal_table_info& ti, cal_connection_info* ci, bool h
|
|||||||
{
|
{
|
||||||
Field_varstring* f2 = (Field_varstring*)*f;
|
Field_varstring* f2 = (Field_varstring*)*f;
|
||||||
|
|
||||||
if (current_thd->variables.infinidb_varbin_always_hex)
|
if (get_varbin_always_hex(current_thd))
|
||||||
{
|
{
|
||||||
uint32_t l;
|
uint32_t l;
|
||||||
const uint8_t* p = row.getVarBinaryField(l, s);
|
const uint8_t* p = row.getVarBinaryField(l, s);
|
||||||
@@ -762,7 +762,7 @@ int fetchNextRow(uchar* buf, cal_table_info& ti, cal_connection_info* ci, bool h
|
|||||||
ti.moreRows = false;
|
ti.moreRows = false;
|
||||||
rc = logging::ERR_LOST_CONN_EXEMGR;
|
rc = logging::ERR_LOST_CONN_EXEMGR;
|
||||||
sm::sm_init(tid2sid(current_thd->thread_id), &ci->cal_conn_hndl,
|
sm::sm_init(tid2sid(current_thd->thread_id), &ci->cal_conn_hndl,
|
||||||
current_thd->variables.infinidb_local_query);
|
get_local_query(current_thd));
|
||||||
idbassert(ci->cal_conn_hndl != 0);
|
idbassert(ci->cal_conn_hndl != 0);
|
||||||
ci->rc = rc;
|
ci->rc = rc;
|
||||||
}
|
}
|
||||||
@@ -2096,7 +2096,7 @@ int ha_calpont_impl_rnd_init(TABLE* table)
|
|||||||
CalpontSelectExecutionPlan::TRACE_TUPLE_OFF;
|
CalpontSelectExecutionPlan::TRACE_TUPLE_OFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool localQuery = (thd->variables.infinidb_local_query > 0 ? true : false);
|
bool localQuery = get_local_query(thd);
|
||||||
|
|
||||||
// table mode
|
// table mode
|
||||||
if (thd->infinidb_vtable.vtable_state == THD::INFINIDB_DISABLE_VTABLE)
|
if (thd->infinidb_vtable.vtable_state == THD::INFINIDB_DISABLE_VTABLE)
|
||||||
@@ -2264,9 +2264,8 @@ int ha_calpont_impl_rnd_init(TABLE* table)
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
string query;
|
string query;
|
||||||
const char *original_query = get_original_query(current_thd);
|
query.assign(thd->infinidb_vtable.original_query.ptr(),
|
||||||
query.assign(original_query,
|
thd->infinidb_vtable.original_query.length());
|
||||||
strlen(original_query));
|
|
||||||
csep->data(query);
|
csep->data(query);
|
||||||
|
|
||||||
try
|
try
|
||||||
@@ -3121,7 +3120,7 @@ void ha_calpont_impl_start_bulk_insert(ha_rows rows, TABLE* table)
|
|||||||
((thd->lex)->sql_command == SQLCOM_LOAD) ||
|
((thd->lex)->sql_command == SQLCOM_LOAD) ||
|
||||||
(thd->lex)->sql_command == SQLCOM_INSERT_SELECT) && !ci->singleInsert )
|
(thd->lex)->sql_command == SQLCOM_INSERT_SELECT) && !ci->singleInsert )
|
||||||
{
|
{
|
||||||
ci->useCpimport = thd->variables.infinidb_use_import_for_batchinsert;
|
ci->useCpimport = get_use_import_for_batchinsert(thd);
|
||||||
|
|
||||||
if (((thd->lex)->sql_command == SQLCOM_INSERT) && (rows > 0))
|
if (((thd->lex)->sql_command == SQLCOM_INSERT) && (rows > 0))
|
||||||
ci->useCpimport = 0;
|
ci->useCpimport = 0;
|
||||||
@@ -3194,14 +3193,14 @@ void ha_calpont_impl_start_bulk_insert(ha_rows rows, TABLE* table)
|
|||||||
ci->mysqld_pid = getpid();
|
ci->mysqld_pid = getpid();
|
||||||
|
|
||||||
//get delimiter
|
//get delimiter
|
||||||
if (char(thd->variables.infinidb_import_for_batchinsert_delimiter) != '\007')
|
if (char(get_import_for_batchinsert_delimiter(thd)) != '\007')
|
||||||
ci->delimiter = char(thd->variables.infinidb_import_for_batchinsert_delimiter);
|
ci->delimiter = char(get_import_for_batchinsert_delimiter(thd));
|
||||||
else
|
else
|
||||||
ci->delimiter = '\007';
|
ci->delimiter = '\007';
|
||||||
|
|
||||||
//get enclosed by
|
//get enclosed by
|
||||||
if (char(thd->variables.infinidb_import_for_batchinsert_enclosed_by) != 8)
|
if (char(get_import_for_batchinsert_enclosed_by(thd)) != 8)
|
||||||
ci->enclosed_by = char(thd->variables.infinidb_import_for_batchinsert_enclosed_by);
|
ci->enclosed_by = char(get_import_for_batchinsert_enclosed_by(thd));
|
||||||
else
|
else
|
||||||
ci->enclosed_by = 8;
|
ci->enclosed_by = 8;
|
||||||
|
|
||||||
@@ -3217,7 +3216,7 @@ void ha_calpont_impl_start_bulk_insert(ha_rows rows, TABLE* table)
|
|||||||
if (ci->enclosed_by == 34) // Double quotes
|
if (ci->enclosed_by == 34) // Double quotes
|
||||||
strcat(escapechar, "\\");
|
strcat(escapechar, "\\");
|
||||||
|
|
||||||
if (thd->variables.infinidb_local_query > 0 )
|
if (get_local_query(thd))
|
||||||
{
|
{
|
||||||
OamCache* oamcache = OamCache::makeOamCache();
|
OamCache* oamcache = OamCache::makeOamCache();
|
||||||
int localModuleId = oamcache->getLocalPMId();
|
int localModuleId = oamcache->getLocalPMId();
|
||||||
@@ -4322,7 +4321,7 @@ int ha_calpont_impl_group_by_init(ha_calpont_group_by_handler* group_hand, TABLE
|
|||||||
sm::cpsm_conhdl_t* hndl;
|
sm::cpsm_conhdl_t* hndl;
|
||||||
SCSEP csep;
|
SCSEP csep;
|
||||||
|
|
||||||
bool localQuery = (thd->variables.infinidb_local_query > 0 ? true : false);
|
bool localQuery = get_local_query(thd);
|
||||||
|
|
||||||
{
|
{
|
||||||
ci->stats.reset(); // reset query stats
|
ci->stats.reset(); // reset query stats
|
||||||
|
@@ -40,7 +40,7 @@ using namespace logging;
|
|||||||
//#include "resourcemanager.h"
|
//#include "resourcemanager.h"
|
||||||
|
|
||||||
#include "columnstoreversion.h"
|
#include "columnstoreversion.h"
|
||||||
#include "mcs_sysvars.h"
|
#include "ha_mcs_sysvars.h"
|
||||||
|
|
||||||
extern "C"
|
extern "C"
|
||||||
{
|
{
|
520
dbcon/mysql/ha_mcs_sysvars.cpp
Normal file
520
dbcon/mysql/ha_mcs_sysvars.cpp
Normal file
@@ -0,0 +1,520 @@
|
|||||||
|
/* 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 "ha_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 algorithm for create tables. Possible values are: "
|
||||||
|
"NO_COMPRESSION segment files aren't compressed; "
|
||||||
|
"SNAPPY segment files are Snappy compressed (default);",
|
||||||
|
NULL, // check
|
||||||
|
NULL, // update
|
||||||
|
1, //default
|
||||||
|
&mcs_compression_type_names_lib); // values lib
|
||||||
|
|
||||||
|
// 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
|
||||||
|
);
|
||||||
|
|
||||||
|
// legacy system variables
|
||||||
|
static MYSQL_THDVAR_ULONG(
|
||||||
|
decimal_scale,
|
||||||
|
PLUGIN_VAR_RQCMDARG,
|
||||||
|
"The default decimal precision for calculated column sub-operations ",
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
8,
|
||||||
|
0,
|
||||||
|
18,
|
||||||
|
1
|
||||||
|
);
|
||||||
|
|
||||||
|
static MYSQL_THDVAR_BOOL(
|
||||||
|
varbin_always_hex,
|
||||||
|
PLUGIN_VAR_NOCMDARG,
|
||||||
|
"Always display/process varbinary columns as if they have been hexified.",
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
0
|
||||||
|
);
|
||||||
|
|
||||||
|
static MYSQL_THDVAR_BOOL(
|
||||||
|
use_decimal_scale,
|
||||||
|
PLUGIN_VAR_NOCMDARG,
|
||||||
|
"Enable/disable the MCS decimal scale to be used internally",
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
0
|
||||||
|
);
|
||||||
|
|
||||||
|
static MYSQL_THDVAR_BOOL(
|
||||||
|
double_for_decimal_math,
|
||||||
|
PLUGIN_VAR_NOCMDARG,
|
||||||
|
"Enable/disable the InfiniDB to replace DECIMAL with DOUBLE in arithmetic operation.",
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
0
|
||||||
|
);
|
||||||
|
|
||||||
|
static MYSQL_THDVAR_BOOL(
|
||||||
|
ordered_only,
|
||||||
|
PLUGIN_VAR_NOCMDARG,
|
||||||
|
"Always use the first table in the from clause as the large side "
|
||||||
|
"table for joins",
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
0
|
||||||
|
);
|
||||||
|
|
||||||
|
static MYSQL_THDVAR_ULONG(
|
||||||
|
string_scan_threshold,
|
||||||
|
PLUGIN_VAR_RQCMDARG,
|
||||||
|
"Max number of blocks in a dictionary file to be scanned for filtering",
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
10,
|
||||||
|
1,
|
||||||
|
~0U,
|
||||||
|
1
|
||||||
|
);
|
||||||
|
|
||||||
|
static MYSQL_THDVAR_ULONG(
|
||||||
|
stringtable_threshold,
|
||||||
|
PLUGIN_VAR_RQCMDARG,
|
||||||
|
"The minimum width of a string column to be stored in a string table",
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
20,
|
||||||
|
9,
|
||||||
|
~0U,
|
||||||
|
1
|
||||||
|
);
|
||||||
|
|
||||||
|
static MYSQL_THDVAR_ULONG(
|
||||||
|
diskjoin_smallsidelimit,
|
||||||
|
PLUGIN_VAR_RQCMDARG,
|
||||||
|
"The maximum amount of disk space in MB to use per query for storing "
|
||||||
|
"'small side' tables for a disk-based join. (0 = unlimited)",
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
~0U,
|
||||||
|
1
|
||||||
|
);
|
||||||
|
|
||||||
|
static MYSQL_THDVAR_ULONG(
|
||||||
|
diskjoin_largesidelimit,
|
||||||
|
PLUGIN_VAR_RQCMDARG,
|
||||||
|
"The maximum amount of disk space in MB to use per join for storing "
|
||||||
|
"'large side' table data for a disk-based join. (0 = unlimited)",
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
~0U,
|
||||||
|
1
|
||||||
|
);
|
||||||
|
|
||||||
|
static MYSQL_THDVAR_ULONG(
|
||||||
|
diskjoin_bucketsize,
|
||||||
|
PLUGIN_VAR_RQCMDARG,
|
||||||
|
"The maximum size in MB of each 'small side' table in memory.",
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
100,
|
||||||
|
1,
|
||||||
|
~0U,
|
||||||
|
1
|
||||||
|
);
|
||||||
|
|
||||||
|
static MYSQL_THDVAR_ULONG(
|
||||||
|
um_mem_limit,
|
||||||
|
PLUGIN_VAR_RQCMDARG,
|
||||||
|
"Per user Memory limit(MB). Switch to disk-based JOIN when limit is reached",
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
~0U,
|
||||||
|
1
|
||||||
|
);
|
||||||
|
|
||||||
|
static MYSQL_THDVAR_ULONG(
|
||||||
|
local_query,
|
||||||
|
PLUGIN_VAR_RQCMDARG,
|
||||||
|
"Enable/disable the Infinidb local PM query only feature.",
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
2,
|
||||||
|
1
|
||||||
|
);
|
||||||
|
|
||||||
|
static MYSQL_THDVAR_ULONG(
|
||||||
|
import_for_batchinsert_delimiter,
|
||||||
|
PLUGIN_VAR_RQCMDARG,
|
||||||
|
"ASCII value of the delimiter used by LDI and INSERT..SELECT",
|
||||||
|
NULL, // check
|
||||||
|
NULL, // update
|
||||||
|
7, // default
|
||||||
|
0, // min
|
||||||
|
127, // max
|
||||||
|
1 // block size
|
||||||
|
);
|
||||||
|
|
||||||
|
static MYSQL_THDVAR_ULONG(
|
||||||
|
import_for_batchinsert_enclosed_by,
|
||||||
|
PLUGIN_VAR_RQCMDARG,
|
||||||
|
"ASCII value of the quote symbol used by batch data ingestion",
|
||||||
|
NULL, // check
|
||||||
|
NULL, // update
|
||||||
|
17, // default
|
||||||
|
17, // min
|
||||||
|
127, // max
|
||||||
|
1 // block size
|
||||||
|
);
|
||||||
|
|
||||||
|
static MYSQL_THDVAR_BOOL(
|
||||||
|
use_import_for_batchinsert,
|
||||||
|
PLUGIN_VAR_NOCMDARG,
|
||||||
|
"LOAD DATA INFILE and INSERT..SELECT will use cpimport internally",
|
||||||
|
NULL, // check
|
||||||
|
NULL, // update
|
||||||
|
1 // default
|
||||||
|
);
|
||||||
|
|
||||||
|
static MYSQL_THDVAR_BOOL(
|
||||||
|
use_legacy_sysvars,
|
||||||
|
PLUGIN_VAR_NOCMDARG,
|
||||||
|
"Control CS behavior using legacy * sysvars",
|
||||||
|
NULL, // check
|
||||||
|
NULL, // update
|
||||||
|
0 // default
|
||||||
|
);
|
||||||
|
|
||||||
|
st_mysql_sys_var* mcs_system_variables[] =
|
||||||
|
{
|
||||||
|
MYSQL_SYSVAR(compression_type),
|
||||||
|
MYSQL_SYSVAR(fe_conn_info_ptr),
|
||||||
|
MYSQL_SYSVAR(decimal_scale),
|
||||||
|
MYSQL_SYSVAR(use_decimal_scale),
|
||||||
|
MYSQL_SYSVAR(ordered_only),
|
||||||
|
MYSQL_SYSVAR(string_scan_threshold),
|
||||||
|
MYSQL_SYSVAR(stringtable_threshold),
|
||||||
|
MYSQL_SYSVAR(diskjoin_smallsidelimit),
|
||||||
|
MYSQL_SYSVAR(diskjoin_largesidelimit),
|
||||||
|
MYSQL_SYSVAR(diskjoin_bucketsize),
|
||||||
|
MYSQL_SYSVAR(um_mem_limit),
|
||||||
|
MYSQL_SYSVAR(double_for_decimal_math),
|
||||||
|
MYSQL_SYSVAR(local_query),
|
||||||
|
MYSQL_SYSVAR(use_import_for_batchinsert),
|
||||||
|
MYSQL_SYSVAR(import_for_batchinsert_delimiter),
|
||||||
|
MYSQL_SYSVAR(import_for_batchinsert_enclosed_by),
|
||||||
|
MYSQL_SYSVAR(use_legacy_sysvars),
|
||||||
|
MYSQL_SYSVAR(varbin_always_hex),
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
|
||||||
|
void* get_fe_conn_info_ptr(THD* thd)
|
||||||
|
{
|
||||||
|
return ( current_thd == NULL && thd == NULL ) ? NULL :
|
||||||
|
(void*)THDVAR(current_thd, fe_conn_info_ptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
void set_fe_conn_info_ptr(void* ptr, THD* thd)
|
||||||
|
{
|
||||||
|
if ( current_thd == NULL && thd == NULL)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
THDVAR(current_thd, fe_conn_info_ptr) = (uint64_t)(ptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool get_use_legacy_sysvars(THD* thd)
|
||||||
|
{
|
||||||
|
return ( thd == NULL ) ? false : THDVAR(thd, use_legacy_sysvars);
|
||||||
|
}
|
||||||
|
|
||||||
|
void set_use_legacy_sysvars(THD* thd, bool value)
|
||||||
|
{
|
||||||
|
THDVAR(thd, use_legacy_sysvars) = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
void set_compression_type(THD* thd, ulong value)
|
||||||
|
{
|
||||||
|
THDVAR(thd, compression_type) = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
mcs_compression_type_t get_compression_type(THD* thd) {
|
||||||
|
return (mcs_compression_type_t) THDVAR(thd, compression_type);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool get_use_decimal_scale(THD* thd)
|
||||||
|
{
|
||||||
|
if(get_use_legacy_sysvars(thd))
|
||||||
|
return ( thd == NULL ) ? false : thd->variables.infinidb_use_decimal_scale;
|
||||||
|
else
|
||||||
|
return ( thd == NULL ) ? false : THDVAR(thd, use_decimal_scale);
|
||||||
|
}
|
||||||
|
void set_use_decimal_scale(THD* thd, bool value)
|
||||||
|
{
|
||||||
|
if(get_use_legacy_sysvars(thd))
|
||||||
|
thd->variables.infinidb_use_decimal_scale = value;
|
||||||
|
else
|
||||||
|
THDVAR(thd, use_decimal_scale) = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
ulong get_decimal_scale(THD* thd)
|
||||||
|
{
|
||||||
|
if(get_use_legacy_sysvars(thd))
|
||||||
|
return ( thd == NULL ) ? 0 : thd->variables.infinidb_decimal_scale;
|
||||||
|
else
|
||||||
|
return ( thd == NULL ) ? 0 : THDVAR(thd, decimal_scale);
|
||||||
|
}
|
||||||
|
void set_decimal_scale(THD* thd, ulong value)
|
||||||
|
{
|
||||||
|
if(get_use_legacy_sysvars(thd))
|
||||||
|
thd->variables.infinidb_decimal_scale = value;
|
||||||
|
else
|
||||||
|
THDVAR(thd, decimal_scale) = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool get_ordered_only(THD* thd)
|
||||||
|
{
|
||||||
|
if(get_use_legacy_sysvars(thd))
|
||||||
|
return ( thd == NULL ) ? false : thd->variables.infinidb_ordered_only;
|
||||||
|
else
|
||||||
|
return ( thd == NULL ) ? false : THDVAR(thd, ordered_only);
|
||||||
|
}
|
||||||
|
void set_ordered_only(THD* thd, bool value)
|
||||||
|
{
|
||||||
|
if(get_use_legacy_sysvars(thd))
|
||||||
|
thd->variables.infinidb_ordered_only = value;
|
||||||
|
else
|
||||||
|
THDVAR(thd, ordered_only) = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
ulong get_string_scan_threshold(THD* thd)
|
||||||
|
{
|
||||||
|
if(get_use_legacy_sysvars(thd))
|
||||||
|
return ( thd == NULL ) ? 0 : thd->variables.infinidb_string_scan_threshold;
|
||||||
|
else
|
||||||
|
return ( thd == NULL ) ? 0 : THDVAR(thd, string_scan_threshold);
|
||||||
|
}
|
||||||
|
void set_string_scan_threshold(THD* thd, ulong value)
|
||||||
|
{
|
||||||
|
if(get_use_legacy_sysvars(thd))
|
||||||
|
thd->variables.infinidb_string_scan_threshold = value;
|
||||||
|
else
|
||||||
|
THDVAR(thd, string_scan_threshold) = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
ulong get_stringtable_threshold(THD* thd)
|
||||||
|
{
|
||||||
|
if(get_use_legacy_sysvars(thd))
|
||||||
|
return ( thd == NULL ) ? 0 : thd->variables.infinidb_stringtable_threshold;
|
||||||
|
else
|
||||||
|
return ( thd == NULL ) ? 0 : THDVAR(thd, stringtable_threshold);
|
||||||
|
}
|
||||||
|
void set_stringtable_threshold(THD* thd, ulong value)
|
||||||
|
{
|
||||||
|
if(get_use_legacy_sysvars(thd))
|
||||||
|
thd->variables.infinidb_stringtable_threshold = value;
|
||||||
|
else
|
||||||
|
THDVAR(thd, stringtable_threshold) = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
ulong get_diskjoin_smallsidelimit(THD* thd)
|
||||||
|
{
|
||||||
|
if(get_use_legacy_sysvars(thd))
|
||||||
|
return ( thd == NULL ) ? 0 : thd->variables.infinidb_diskjoin_smallsidelimit;
|
||||||
|
else
|
||||||
|
return ( thd == NULL ) ? 0 : THDVAR(thd, diskjoin_smallsidelimit);
|
||||||
|
}
|
||||||
|
void set_diskjoin_smallsidelimit(THD* thd, ulong value)
|
||||||
|
{
|
||||||
|
if(get_use_legacy_sysvars(thd))
|
||||||
|
thd->variables.infinidb_diskjoin_smallsidelimit = value;
|
||||||
|
else
|
||||||
|
THDVAR(thd, diskjoin_smallsidelimit) = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
ulong get_diskjoin_largesidelimit(THD* thd)
|
||||||
|
{
|
||||||
|
if(get_use_legacy_sysvars(thd))
|
||||||
|
return ( thd == NULL ) ? 0 : thd->variables.infinidb_diskjoin_largesidelimit;
|
||||||
|
else
|
||||||
|
return ( thd == NULL ) ? 0 : THDVAR(thd, diskjoin_largesidelimit);
|
||||||
|
}
|
||||||
|
void set_diskjoin_largesidelimit(THD* thd, ulong value)
|
||||||
|
{
|
||||||
|
if(get_use_legacy_sysvars(thd))
|
||||||
|
thd->variables.infinidb_diskjoin_largesidelimit = value;
|
||||||
|
else
|
||||||
|
THDVAR(thd, diskjoin_largesidelimit) = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
ulong get_diskjoin_bucketsize(THD* thd)
|
||||||
|
{
|
||||||
|
if(get_use_legacy_sysvars(thd))
|
||||||
|
return ( thd == NULL ) ? 0 : thd->variables.infinidb_diskjoin_bucketsize;
|
||||||
|
else
|
||||||
|
return ( thd == NULL ) ? 0 : THDVAR(thd, diskjoin_bucketsize);
|
||||||
|
}
|
||||||
|
void set_diskjoin_bucketsize(THD* thd, ulong value)
|
||||||
|
{
|
||||||
|
if(get_use_legacy_sysvars(thd))
|
||||||
|
thd->variables.infinidb_diskjoin_bucketsize = value;
|
||||||
|
else
|
||||||
|
THDVAR(thd, diskjoin_bucketsize) = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
ulong get_um_mem_limit(THD* thd)
|
||||||
|
{
|
||||||
|
if(get_use_legacy_sysvars(thd))
|
||||||
|
return ( thd == NULL ) ? 0 : thd->variables.infinidb_um_mem_limit;
|
||||||
|
else
|
||||||
|
return ( thd == NULL ) ? 0 : THDVAR(thd, um_mem_limit);
|
||||||
|
}
|
||||||
|
void set_um_mem_limit(THD* thd, ulong value)
|
||||||
|
{
|
||||||
|
if(get_use_legacy_sysvars(thd))
|
||||||
|
thd->variables.infinidb_um_mem_limit = value;
|
||||||
|
else
|
||||||
|
THDVAR(thd, um_mem_limit) = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool get_varbin_always_hex(THD* thd)
|
||||||
|
{
|
||||||
|
if(get_use_legacy_sysvars(thd))
|
||||||
|
return ( thd == NULL ) ? false : thd->variables.infinidb_varbin_always_hex;
|
||||||
|
else
|
||||||
|
return ( thd == NULL ) ? false : THDVAR(thd, varbin_always_hex);
|
||||||
|
}
|
||||||
|
void set_varbin_always_hex(THD* thd, bool value)
|
||||||
|
{
|
||||||
|
if(get_use_legacy_sysvars(thd))
|
||||||
|
thd->variables.infinidb_varbin_always_hex = value;
|
||||||
|
else
|
||||||
|
THDVAR(thd, varbin_always_hex) = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool get_double_for_decimal_math(THD* thd)
|
||||||
|
{
|
||||||
|
if(get_use_legacy_sysvars(thd))
|
||||||
|
return ( thd == NULL ) ? false : thd->variables.infinidb_double_for_decimal_math;
|
||||||
|
else
|
||||||
|
return ( thd == NULL ) ? false : THDVAR(thd, double_for_decimal_math);
|
||||||
|
}
|
||||||
|
void set_double_for_decimal_math(THD* thd, bool value)
|
||||||
|
{
|
||||||
|
if(get_use_legacy_sysvars(thd))
|
||||||
|
thd->variables.infinidb_double_for_decimal_math = value;
|
||||||
|
else
|
||||||
|
THDVAR(thd, double_for_decimal_math) = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
ulong get_local_query(THD* thd)
|
||||||
|
{
|
||||||
|
if(get_use_legacy_sysvars(thd))
|
||||||
|
return ( thd == NULL ) ? 0 : thd->variables.infinidb_local_query;
|
||||||
|
else
|
||||||
|
return ( thd == NULL ) ? 0 : THDVAR(thd, local_query);
|
||||||
|
}
|
||||||
|
void set_local_query(THD* thd, ulong value)
|
||||||
|
{
|
||||||
|
if(get_use_legacy_sysvars(thd))
|
||||||
|
thd->variables.infinidb_local_query = value;
|
||||||
|
else
|
||||||
|
THDVAR(thd, local_query) = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool get_use_import_for_batchinsert(THD* thd)
|
||||||
|
{
|
||||||
|
if(get_use_legacy_sysvars(thd))
|
||||||
|
return ( thd == NULL ) ? false : thd->variables.infinidb_use_import_for_batchinsert;
|
||||||
|
else
|
||||||
|
return ( thd == NULL ) ? false : THDVAR(thd, use_import_for_batchinsert);
|
||||||
|
}
|
||||||
|
void set_use_import_for_batchinsert(THD* thd, bool value)
|
||||||
|
{
|
||||||
|
if(get_use_legacy_sysvars(thd))
|
||||||
|
thd->variables.infinidb_use_import_for_batchinsert = value;
|
||||||
|
else
|
||||||
|
THDVAR(thd, use_import_for_batchinsert) = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
ulong get_import_for_batchinsert_delimiter(THD* thd)
|
||||||
|
{
|
||||||
|
if(get_use_legacy_sysvars(thd))
|
||||||
|
return ( thd == NULL ) ? 0 : thd->variables.infinidb_import_for_batchinsert_delimiter;
|
||||||
|
else
|
||||||
|
return ( thd == NULL ) ? 0 : THDVAR(thd, import_for_batchinsert_delimiter);
|
||||||
|
}
|
||||||
|
void set_import_for_batchinsert_delimiter(THD* thd, ulong value)
|
||||||
|
{
|
||||||
|
if(get_use_legacy_sysvars(thd))
|
||||||
|
thd->variables.infinidb_import_for_batchinsert_delimiter = value;
|
||||||
|
else
|
||||||
|
THDVAR(thd, import_for_batchinsert_delimiter) = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
ulong get_import_for_batchinsert_enclosed_by(THD* thd)
|
||||||
|
{
|
||||||
|
if(get_use_legacy_sysvars(thd))
|
||||||
|
return ( thd == NULL ) ? 0 : thd->variables.infinidb_import_for_batchinsert_enclosed_by;
|
||||||
|
else
|
||||||
|
return ( thd == NULL ) ? 0 : THDVAR(thd, import_for_batchinsert_enclosed_by);
|
||||||
|
}
|
||||||
|
void set_import_for_batchinsert_enclosed_by(THD* thd, ulong value)
|
||||||
|
{
|
||||||
|
if(get_use_legacy_sysvars(thd))
|
||||||
|
thd->variables.infinidb_import_for_batchinsert_enclosed_by = value;
|
||||||
|
else
|
||||||
|
THDVAR(thd, import_for_batchinsert_enclosed_by) = value;
|
||||||
|
}
|
91
dbcon/mysql/ha_mcs_sysvars.h
Normal file
91
dbcon/mysql/ha_mcs_sysvars.h
Normal file
@@ -0,0 +1,91 @@
|
|||||||
|
/* 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[];
|
||||||
|
|
||||||
|
// 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 set_compression_type(THD* thd, ulong value);
|
||||||
|
|
||||||
|
void* get_fe_conn_info_ptr(THD* thd = NULL);
|
||||||
|
void set_fe_conn_info_ptr(void* ptr, THD* thd = NULL);
|
||||||
|
|
||||||
|
bool get_use_legacy_sysvars(THD* thd);
|
||||||
|
void set_use_legacy_sysvars(THD* thd, bool value);
|
||||||
|
|
||||||
|
bool get_use_decimal_scale(THD* thd);
|
||||||
|
void set_use_decimal_scale(THD* thd, bool value);
|
||||||
|
|
||||||
|
ulong get_decimal_scale(THD* thd);
|
||||||
|
void set_decimal_scale(THD* thd, ulong value);
|
||||||
|
|
||||||
|
bool get_ordered_only(THD* thd);
|
||||||
|
void set_ordered_only(THD* thd, bool value);
|
||||||
|
|
||||||
|
ulong get_string_scan_threshold(THD* thd);
|
||||||
|
void set_string_scan_threshold(THD* thd, ulong value);
|
||||||
|
|
||||||
|
ulong get_stringtable_threshold(THD* thd);
|
||||||
|
void set_stringtable_threshold(THD* thd, ulong value);
|
||||||
|
|
||||||
|
ulong get_diskjoin_smallsidelimit(THD* thd);
|
||||||
|
void set_diskjoin_smallsidelimit(THD* thd, ulong value);
|
||||||
|
|
||||||
|
ulong get_diskjoin_largesidelimit(THD* thd);
|
||||||
|
void set_diskjoin_largesidelimit(THD* thd, ulong value);
|
||||||
|
|
||||||
|
ulong get_diskjoin_bucketsize(THD* thd);
|
||||||
|
void set_diskjoin_bucketsize(THD* thd, ulong value);
|
||||||
|
|
||||||
|
ulong get_um_mem_limit(THD* thd);
|
||||||
|
void set_um_mem_limit(THD* thd, ulong value);
|
||||||
|
|
||||||
|
bool get_varbin_always_hex(THD* thd);
|
||||||
|
void set_varbin_always_hex(THD* thd, bool value);
|
||||||
|
|
||||||
|
bool get_double_for_decimal_math(THD* thd);
|
||||||
|
void set_double_for_decimal_math(THD* thd, bool value);
|
||||||
|
|
||||||
|
ulong get_local_query(THD* thd);
|
||||||
|
void set_local_query(THD* thd, ulong value);
|
||||||
|
|
||||||
|
bool get_use_import_for_batchinsert(THD* thd);
|
||||||
|
void set_use_import_for_batchinsert(THD* thd, bool value);
|
||||||
|
|
||||||
|
ulong get_import_for_batchinsert_delimiter(THD* thd);
|
||||||
|
void set_import_for_batchinsert_delimiter(THD* thd, ulong value);
|
||||||
|
|
||||||
|
ulong get_import_for_batchinsert_enclosed_by(THD* thd);
|
||||||
|
void set_import_for_batchinsert_enclosed_by(THD* thd, ulong value);
|
||||||
|
|
||||||
|
#endif
|
@@ -20,7 +20,7 @@ using namespace execplan;
|
|||||||
#include "functor_str.h"
|
#include "functor_str.h"
|
||||||
|
|
||||||
#include "ha_calpont_impl_if.h"
|
#include "ha_calpont_impl_if.h"
|
||||||
#include "mcs_sysvars.h"
|
#include "ha_mcs_sysvars.h"
|
||||||
using namespace cal_impl_if;
|
using namespace cal_impl_if;
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
|
@@ -28,7 +28,7 @@ using namespace std;
|
|||||||
|
|
||||||
#include "idb_mysql.h"
|
#include "idb_mysql.h"
|
||||||
#include "ha_calpont_impl_if.h"
|
#include "ha_calpont_impl_if.h"
|
||||||
#include "mcs_sysvars.h"
|
#include "ha_mcs_sysvars.h"
|
||||||
|
|
||||||
#include "arithmeticcolumn.h"
|
#include "arithmeticcolumn.h"
|
||||||
#include "arithmeticoperator.h"
|
#include "arithmeticoperator.h"
|
||||||
@@ -903,7 +903,7 @@ ReturnedColumn* buildWindowFunctionColumn(Item* item, gp_walk_info& gwi, bool& n
|
|||||||
{
|
{
|
||||||
ac->resultType(colType_MysqlToIDB(item_sum));
|
ac->resultType(colType_MysqlToIDB(item_sum));
|
||||||
// bug5736. Make the result type double for some window functions when
|
// bug5736. Make the result type double for some window functions when
|
||||||
// infinidb_double_for_decimal_math is set.
|
// plugin variable double_for_decimal_math is set.
|
||||||
ac->adjustResultType();
|
ac->adjustResultType();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,106 +0,0 @@
|
|||||||
/* 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);
|
|
||||||
}
|
|
||||||
|
|
||||||
mcs_compression_type_t get_compression_type(THD* thd) {
|
|
||||||
return (mcs_compression_type_t) THDVAR(thd, compression_type);
|
|
||||||
}
|
|
@@ -1,59 +0,0 @@
|
|||||||
/* 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[];
|
|
||||||
|
|
||||||
/* MCOL-1101 Remove before release
|
|
||||||
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